Skip to main content

pip package CellSegmentation Evaluator

Cell Segmentation Evaluator: evaluation of cell segmentation methods without reference segmentations

Haoran Chen and Robert F. Murphy and Ted Zhang
Carnegie Mellon University
V1.5.19 July 26, 2025

Cell segmentation evaluation approach

This package implements an approach for cell segmentation evaluation (CSE) that does not rely upon comparison to annotations from humans. For this, we defined a series of segmentation quality metrics that can be applied to multichannel images. The metrics are designed mainly for tissue images assuming that (1) there are multiple channels, and (2) there are multiple cell types that are expected to differ in their expression values for the channels. We calculated these metrics for 11 previously-described segmentation methods applied to 2D images from 4 multiplexed microscope modalities covering 5 tissues. Using principal component analysis to combine the metrics, we defined an overall cell segmentation quality score. The individual metrics and the quality score are returned.

The package supports both 2D and 3D images. It can be installed using

pip install CellSegmentationEvaluator

Then import the desired function, e.g.,

from CellSegmentationEvaluator import single_method_eval, single_method_eval3D, CSE3D

There are three main functions to evaluate an image and associated masks. For providing inputs as AICSImage object (see https://github.com/AllenCellModeling/aicsimageio and https://pypi.org/project/aicsimageio/), use

single_method_eval(imgpath, maskpath, PCA_model, output_dir, bz, unit, pixelsizex, pixelsizey) #for 2D
single_method_eval3D(imgpath, maskpath, PCA_model, output_dir, unit, pixelsizex, pixelsizey) #for 3D

where PCAmodel defaults to "2Dv1.5" or "3Dv1.6", bz and unit are ignored, and the pixel sizes are in micrometers and must be provided if not present in the OME-TIFF metadata.

Or for providing 3D images and masks as nd-arrays, use

CSE3D(img, mask, [PCAmodel], [threshimage], [voxel_size])

where PCAmodel defaults to "3Dv1.6", threshimage defaults to the sum of all channels, and the voxel size is in cubic micrometers and defaults to 1.

Reference:

Chen, Haoran, and Robert F. Murphy. "Evaluation of cell segmentation methods without reference segmentations." Molecular Biology of the Cell 34.6 (2023): ar50. https://doi.org/10.1091/mbc.E22-08-0364

Chen, Haoran, and Robert F. Murphy. "3DCellComposer: A versatile pipeline utilizing 2D cell segmentation methods for 3D cell segmentation" (2024) under review

Inputs

Two input files are required, one containing a multichannel image (e.g., CODEX image) and the other containing the segmentation mask image to evaluate. The mask image should contain channels for a cell mask and a nucleus mask (in that order). Other mask channels may be present but will be ignored. Each channel should contain an indexed image, in which pixels contain the integer number of the cell that that pixel belongs to. Note that nuclear masks should not extend beyond cell masks; such nuclear masks will be truncated. Note also that cell and/or nuclear masks that are not matched will be ignored but reflected in the 'FractionOfMatchedCellsAndNuclei' metric.

Examples

Please see https://github.com/murphygroup/CellSegmentationEvaluator for examples of use. In the the SimpleCSE folder are an example python main program ("read_and_eval_seg.py") and a Jupyter Notebook ("SegEvalExample.ipynb") that read input files and call CellSegmentationEvaluator.

The multichannel image should be in a format readable by AICSimageio (e.g., OME-TIFF). The masks should be in a similar format with an indexed image for cell masks in the first channel and an indexed image (with corresponding indices) for nuclear masks in the second channel.

The output is a JSON file with the metrics and the scores.

Contact

Robert F. Murphy - murphy@cmu.edu
Haoran Chen - hrchen@cmu.edu

Metadata

Release files for CellSegmentationEvaluator 1.5.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CellSegmentationEvaluator 1.5.19
File Size Uploaded
CellSegmentationEvaluator-1.5.19.tar.gz 15.7 kB Details

Release files / CellSegmentationEvaluator-1.5.19.tar.gz

Download URL CellSegmentationEvaluator-1.5.19.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f24d66898cab92ef3e2d5b5f7c1a0d505819216a449d77b9a970a8493a3bbf42
BLAKE2b-256 checksum
How to use checksums
3adebc1d827589f0cd83c843df7396ed6604b4a8faa2d6414a567c8a1b35033b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.13

Release history Release notifications | RSS feed

This release

1.5.19 This release

1 release file

1.5.18

1 release file

1.5.17

1 release file

1.5.16

1 release file

1.5.15

1 release file

1.5.14

1 release file

1.5.13

1 release file

1.5.11

1 release file

1.5.10

1 release file

1.5.9

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page