Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The Zarr store

{sample}.zarr holds everything the pipeline learned about a sample: the image, the outlines of every cell and nucleus, and one table of measurements per method. It is a SpatialData object saved as Zarr: a folder, not a single file. To read it in Python, see Open the results in Python.

Layout

{m} is the method, cellpose or instanseg; one set per method.

{sample}.zarr/
├── images/
│   ├── <image>            the image, channels named from the marker sheet
│   └── <image>_projected  with keep_projection: the nuclear and cell channels Cellpose saw
├── shapes/
│   ├── image_patches      the patch grid segmentation ran on
│   ├── region_of_interest with use_tissue_segmentation: the tissue outline
│   ├── {m}_cells          cell outlines, with segment_cells
│   ├── {m}_nuclei         nucleus outlines, with segment_nuclei
│   └── {m}_cytoplasm      each cell minus its nucleus, with both targets
└── tables/
    └── {m}_table          one row per cell; per nucleus in a nuclei-only run

Cell ids

Cell ids are {image}_{m}_cells_{n} ({image}_{m}_nuclei_{n} for nuclei). The same id is the outline’s index in shapes/ and the row name of the table, so outlines and measurements match up directly. Ids are unique within a store, not across stores.

The table

tables/{m}_table is an AnnData table: one row per cell, one column per marker and statistic.

PartHolds
Xmarker intensities over the whole cell, e.g. CD3_mean. Statistics set by quantification_statistics (default mean, median, standard deviation)
varper column: marker and statistic. Select columns with these, not by splitting names
layers['nucleus']the same columns over the cell’s nucleus, with cells and nuclei
layers['cytoplasm']the same over its cytoplasm, with cells and nuclei
obsper cell: cell_id, slide, core_id on a TMA, shape features (below)
obsm['spatial']the cell centres, in pixels
uns['quantification']the statistics used and how the image was read
uns['segmentation']the settings each segmentation ran with: check here which parameters made the store

Shape features, in pixels and px²: cell_area, cell_perimeter, cell_circularity, cell_solidity, cell_eccentricity, cell_major_axis_length, cell_minor_axis_length. With cells and nuclei also n_nuclei, nucleus_id, cytoplasm_area, the same seven as nucleus_*, and nc_ratio (nucleus area over cell area). A nuclei-only run has nucleus_* and no cell_*.

Areas are in px², not µm²: the store does not carry the pixel size. Convert with the pixel size in the stitched OME-TIFF; at 0.65 µm per pixel, 1 px² is 0.42 µm².

With expand_radius_ratio, X is measured over cells grown outwards by that fraction; the layers, shape features and centres use the original outlines.

NaN and 0

NaN means “not measured”; 0 means “measured, nothing there”.

Celllayersnucleus_areacytoplasm_area
No linked nucleusnucleus, cytoplasm NaN0NaN
Nuclei fill the cellcytoplasm NaN> 00
Covers no pixel centreX and both layers NaN

Without a linked nucleus, the other nucleus_* columns and nc_ratio are NaN too. Cells are never dropped.

TMA stores

A dearrayed TMA gives one {slide}_merged.zarr per slide instead of one store per core, with {slide}_merge_manifest.json listing what was merged. Every element is prefixed with its core, {core_id}__{name}, for example TMA01_core001__cellpose_table, and every table has a core_id column.

When you combine tables from several stores or cores, keep slide and core_id, and make row names unique, for example with anndata.concat(..., index_unique="-").

Names the pipeline owns

Shapes and tables named {cellpose,instanseg}_{cells,nuclei,cytoplasm,table} belong to the pipeline: a run replaces those it writes and removes the rest. With VirTues, a run also replaces {cellpose,instanseg}_virtues, virtues_niches, virtues_niches_table and virtues_tissue. Do not give your own additions these names.

Why Zarr

Pitfalls

Format

The stores are Zarr version 3: each group and array has its metadata in a zarr.json file, where version 2 used .zgroup and .zattrs. Image metadata, including channel names, sits under attributes.ome in the image’s zarr.json, the layout of OME-NGFF 0.5. The stores are written by spatialdata as installed with sopa 2.2.9 and 2.3.0 in the pipeline’s containers.