What it does¶
After stitching, each image is converted into a SpatialData store: one folder ({sample}.zarr)
that holds the image, the cell outlines and the table of measurements together, aligned to each
other.
Parameters¶
None directly. use_preprocessing decides
where channel names come from: the marker sheet when the pipeline
stitched the image, or the image’s own names when you give a stitched image.
How it works¶
SpatialData is a data format and Python library for spatial omics. A dataset is built from five kinds of element: images, labels (segmentation masks), points, shapes (polygons, such as cells) and tables (one row per cell, with its measurements). Each element carries a transformation into a shared coordinate system, so elements from different sources can be overlaid and queried together Marconato et al., 2024.
On disk it is a Zarr store, a folder built on the OME-NGFF image standard. Zarr stores arrays in chunks and at several resolutions, so a program loads only the chunks and the resolution it needs, and an image larger than memory can be read one piece at a time.

SpatialData’s design. (a) The storage format: tables, points, shapes, labels and images in Zarr. (b) The Python library: aligned datasets, spatial queries and aggregation. (c–f) Readers, annotation, deep learning and ecosystem tools, which this pipeline does not use. Reproduced from Marconato et al., 2024, CC BY 4.0.
The store is built up step by step:
The stitched OME-TIFF is converted into
{sample}.zarr.The marker names from the marker sheet are written onto the image’s channels. Stitching drops them; without this step channels would be called
Channel:0:0and so on.Later steps add the tissue outline, the patch grid, the projection, and finally the cell outlines and one table per segmentation method.
On a TMA each core has its own store until the cores are merged into one store per slide, with every element renamed
{core_id}__{name}.The finished store is copied to your results folder.
Images stay in pixels, and so do all areas and lengths; the pixel size stays in the stitched OME-TIFF.
Inputs and outputs. In: one stitched OME-TIFF per sample (or per TMA core). Out:
{sample}.zarr (or {slide}_merged.zarr on a TMA) in your results folder. Its layout, and how
to open it: The SpatialData store.
Similar tools¶
OME-TIFF images with CSV tables, as MCMICRO writes them: simple, but outlines, image and table sit in separate files that you align yourself.
AnnData alone (
.h5ad) holds the table but not the image or outlines.
SpatialData came with the downstream half from nf-core/sopa, which is built on it. Sopa reads the image chunk by chunk, so the whole image never has to fit in memory Blampey et al., 2024.
Read more¶
The SpatialData paper: Marconato et al., 2024.
The Sopa paper, on how it uses SpatialData: Blampey et al., 2024.
Version used:
| Module | Tool | Version | Container | Paper |
|---|---|---|---|---|
| TO_SPATIALDATA | sopa | 2.2.9 | community.wave.seqera.io/library/python_sopa:54a97bc5a187152d | |
| SET_CHANNEL_NAMES | sopa | 2.2.9 | community.wave.seqera.io/library/python_sopa:54a97bc5a187152d | |
| WRITE_SEGMENTATIONS | sopa | 2.3.0 | docker.io/josenimo/sopa:2.3.0-1 | Blampey et al. (2024) |
| MERGE_SPATIALDATA | sopa | 2.2.9 | community.wave.seqera.io/library/python_sopa:54a97bc5a187152d | |
| PUBLISH_SPATIALDATA | publish_spatialdata | none (runs on the host) |
- Marconato, L., Palla, G., Yamauchi, K. A., Virshup, I., Heidari, E., Treis, T., Vierdag, W.-M., Toth, M., Stockhaus, S., Shrestha, R. B., Rombaut, B., Pollaris, L., Lehner, L., Vöhringer, H., Kats, I., Saeys, Y., Saka, S. K., Huber, W., Gerstung, M., … Stegle, O. (2024). SpatialData: an open and universal data framework for spatial omics. Nature Methods, 22(1), 58–62. 10.1038/s41592-024-02212-x
- Blampey, Q., Mulder, K., Gardet, M., Christodoulidis, S., Dutertre, C.-A., André, F., Ginhoux, F., & Cournède, P.-H. (2024). Sopa: a technology-invariant pipeline for analyses of image-based spatial omics. Nature Communications, 15(1). 10.1038/s41467-024-48981-z