Cell segmentation in fluorescence microscopy images. Supports Cellpose/cpsam (Cellpose 4.0) with additional backends planned. Produces segmentation masks, per-cell morphology metrics (area, diameter, centroid, eccentricity), overlay figures, and a report.md.
You are the cell-detection agent, a specialised ClawBio skill for cell
segmentation in fluorescence microscopy images. The default backend is cpsam
(Cellpose 4.0); additional backends (e.g. StarDist) are planned.
Manual cell counting and segmentation are slow, inconsistent, and hard to reproduce.
report.md.cpsam on any TIFF, PNG, or JPG fluorescence imagereport.md, {stem}_measurements.csv, and histogram figures| Format | Extension | Notes |
|---|---|---|
| Greyscale TIFF | .tif, .tiff | H×W — passed directly |
| 2-channel TIFF | .tif, .tiff | H×W×2 — cytoplasm + nuclear, any order |
| 3-channel TIFF | .tif, .tiff | H×W×3 — H&E or fluorescence, any order |
| >3-channel TIFF | .tif, .tiff | First 3 channels used; remainder truncated with warning |
| PNG / JPEG | .png, .jpg, .jpeg | Greyscale or RGB |
Channel handling: cpsam is channel-order invariant — cytoplasm and nuclear channels can be in any order. You do not need to specify which channel is which. If you have more than 3 channels, consider omitting the extra channel or combining it with another before running.
CellposeModel() — no channels argument neededskimage.measure.regionpropsreport.md + {stem}_measurements.csv + reproducibility bundle (commands.sh, environment.yml, checksums.sha256)# Standard usage — greyscale or multi-channel (cpsam handles channels automatically)
python skills/cell-detection/cell_detection.py \
--input <image.tif> --output <report_dir>
# Override diameter estimate (pixels)
python skills/cell-detection/cell_detection.py \
--input <image.tif> --diameter 30 --output <report_dir>
# Demo (synthetic image, no user file needed)
python skills/cell-detection/cell_detection.py --demo --output /tmp/cell_detection_demo
python skills/cell-detection/cell_detection.py --demo --output /tmp/cell_detection_demo
Expected output: report.md with ~67 cells detected from a synthetic 512×512 blob image (67 blobs generated).
tifffile (TIFF) or PIL (PNG/JPG); detect ndimCellposeModel(gpu=<flag>)model.eval(img, diameter=<arg_or_None>) — no channels arg (cpsam is channel-order invariant)masks via skimage.measure.regionprops{stem}_measurements.csv, figures, report.mdKey parameters:
cpsam (Cellpose 4.0 unified model — channel-order invariant)None triggers Cellpose auto-estimationoutput_dir/
├── report.md
├── {stem}_measurements.csv
├── {stem}_cp_masks.tif
├── {stem}_seg.npy
├── figures/
│ ├── {stem}_cp_outlines.png
│ └── {stem}_histogram.png
└── reproducibility/
├── checksums.sha256
├── commands.sh
└── environment.yml
cellpose>=4.0 — cpsam modeltifffile — TIFF I/OPillow — PNG/JPG loadingnumpy — array opsmatplotlib — figuresscikit-image — regionprops metricscommands.sh, environment.yml, checksums.sha256) records the exact invocation, dependencies, and output integrityTrigger conditions:
Chaining partners: