What it does¶
Each cell becomes one row of a table: for every marker, the intensity of the pixels inside the cell (mean, median and standard deviation by default), plus the cell’s size and shape.
Parameters¶
quantification_statistics, defaultmean,median,std: which summaries to compute. Choose frommean,median,std,min,max,q25,q75,q90; comma-separated, no spaces, andmeanis always needed.expand_radius_ratio: grow each cell by this ratio times its mean radius before measuring, to catch membrane stains at the edge. Shape and compartments use the unexpanded cell.segment_nucleiwithsegment_cells: also measure the nucleus and the cytoplasm of each cell.
How it works¶
For every marker, all the pixels inside the cell’s outline, holes excluded, are summarised. With nuclei linked to cells, the same is done for the nucleus compartment and the cytoplasm. The image is read in 2048 px tiles; a cell belongs to the tile holding its centre, and that tile grows to cover it, so every cell is measured whole. The segmentation patches are not reused, so the patch size never changes the table.
Shape features are measured on the outline itself, not on pixels:
| Shape feature | Meaning |
|---|---|
| area, perimeter | in px² and px |
| circularity | 4π × area / perimeter²; 1 for a circle; empty below 30 px² |
| solidity | area / area of the convex hull |
| eccentricity | of the ellipse with the same second moments; 0 for a circle |
| major, minor axis | lengths of that ellipse’s axes |
nc_ratio | nucleus area / cell area, with linked nuclei |
Areas and lengths are in pixels; convert with the pixel size in the stitched OME-TIFF. An empty value (NaN) means “not measured”, 0 means “measured, nothing there”. Cells are never dropped.
Inputs and outputs. In: the full image and one method’s cell outlines (and nuclei and
cytoplasm, when linked). Out: one table per method, {m}_table, in the store. Columns are named
{marker}_{statistic}, e.g. CD3_mean; the nucleus and cytoplasm values sit in two extra
layers, nucleus and cytoplasm; shape features are per-cell annotations. Values are 32-bit
floats. See The SpatialData store.
Similar tools¶
MCMICRO’s MCQuant measures mean intensity per cell from a label mask and writes CSV (Schapiro et al. 2022).
sopa’s own aggregation, which this step is copied from.
This step is sopa’s, with one fix: sopa’s mask drawing ignores holes, so a cytoplasm ring would
be measured as the whole cell. Here holes are cut out. Mean is the baseline, since no benchmark
ranks statistics for phenotyping; median and quartiles are the usual extras. q99 is not
offered: in a 50-pixel cell it is the maximum. min and max are mostly background and hot
pixels, so they are off by default.
Read more¶
The design, with the definitions of each feature.
Reading the table, including how to select one statistic.
Version used:
| Module | Tool | Version | Container | Paper |
|---|---|---|---|---|
| AGGREGATE | sopa | 2.3.0 | docker.io/josenimo/sopa:2.3.0-1 | Blampey et al. (2024) |
- Schapiro, D., Sokolov, A., Yapp, C., Chen, Y.-A., Muhlich, J. L., Hess, J., Creason, A. L., Nirmal, A. J., Baker, G. J., Nariya, M. K., Lin, J.-R., Maliga, Z., Jacobson, C. A., Hodgman, M. W., Ruokonen, J., Farhi, S. L., Abbondanza, D., McKinley, E. T., Persson, D., … Sorger, P. K. (2021). MCMICRO: a scalable, modular image-processing pipeline for multiplexed tissue imaging. Nature Methods, 19(3), 311–315. 10.1038/s41592-021-01308-y
- 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