bioimageflow-segmentation-tools¶
bioimageflow-segmentation-tools contains segmentation wrappers for classical
threshold/watershed workflows and optional deep-learning models. It is the
package to install when a workflow needs label images from intensity,
probability, or binary inputs.
Install-time libraries are imageio, NumPy, and scikit-image.
Classical tool runtime environments include tifffile where file-format handling needs it.
Cellpose, StarDist, TensorFlow, and other model-runtime dependencies live in isolated EnvironmentSpec environments and are imported inside process_row, so graph construction and schema tests remain lightweight.
Tools¶
ThresholdSegment: threshold and connected component labeling.
OtsuThresholdSegment: global Otsu thresholding with connected-component labeling.
LocalThresholdSegment: Sauvola adaptive thresholding with connected-component labeling.
WatershedSegment: marker-controlled foreground splitting.
DistanceWatershedSegment: marker-free distance-transform watershed.
SplitTouchingObjects: split clumped label masks with distance watershed semantics.
FilterLabels: filter labels by area, border contact, intensity, and shape.
PostprocessLabels: minimum-size filtering and sequential relabeling.
Cellpose3: Cellpose v3 pretrained model wrapper.
CellposeSAM: Cellpose-SAM model wrapper.
nnInteractive: prompt-driven nnInteractive wrapper.
StarDistSegmenter: StarDist 2D pretrained model wrapper.
Demo Workflow¶
BBBC038 segmentation benchmark: comparison of Cellpose v3, Cellpose-SAM, StarDist, and a classical branch on BBBC038-style nuclei masks.
Tests and Demo Data¶
Run package tests with:
uv run pytest packages/bioimageflow-segmentation-tools/tests
Fast tests execute the classical tools on small local fixtures and verify that heavy tools build workflow graphs without importing model dependencies.
Optional model-runtime validation should be marked complete, wetlands, and model_runtime; public datasets additionally use public_data and define expected object-count or benchmark ranges.