Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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.
.claude/skills/clawbio-cell-detection/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -20% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 784% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -12% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 60% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 60% | 0% |
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 TIFF, CZI, ND2, PNG, or JPG fluorescence imagesreport.md, {stem}_measurements.csv, and histogram figures--use_gpu / --use_cpu override flags| 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 | | Zeiss microscopy | .czi | Reads CZI via czifile and uses CZI axis metadata (CziFile.axes) to map C/Z/Y/X deterministically | | Nikon microscopy | .nd2 | Reads ND2 via nd2 and uses ND2 named dimensions (ND2File.sizes) for deterministic C/Z/Y/X mapping | | PNG / JPEG | .png, .jpg, .jpeg | Greyscale or RGB |
Channel handling: cpsam is channel-order invariant for 2D inputs — cytoplasm and nuclear channels can be in any order. For 2D segmentation, if you have more than 3 channels, the first 3 are used and the rest are truncated with a warning. For 3D segmentation (--do_3D) with --z_projection none, 4D stacks are preserved as Z×C×Y×X (no channel truncation at load time).
--do_3D + --z_projection none): keep 4D volume as Z×C×Y×XCellposeModel()z_axis=0, channel_axis=1--use_cpu forces CPUskimage.measure.regionpropsreport.md + {stem}_measurements.csv + reproducibility bundle (commands.sh, environment.yml, checksums.sha256)bash# 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 # Override 4D stack Z handling (default is max projection) python skills/cell-detection/cell_detection.py \ --input <image.nd2> --z_projection none --do_3D --output <report_dir> # Force CPU mode python skills/cell-detection/cell_detection.py \ --input <image.tif> --use_cpu --output <report_dir>
bashpython 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), czifile (CZI), nd2 (ND2), or PIL (PNG/JPG); use CZI/ND2 metadata axes to assign C/Z/Y/X--z_projection none: preserve 4D volume as Z×C×Y×XCellposeModel(gpu=<flag>)model.eval(img, diameter=<arg_or_None>)channels/channel_axis needed (cpsam is channel-order invariant)Z×C×Y×X: pass z_axis=0, channel_axis=1masks via skimage.measure.regionprops{stem}_measurements.csv, figures, report.mdKey parameters:
cpsam (Cellpose 4.0 unified model — channel-order invariant)--z_projection none: multichannel 4D stacks are kept as Z×C×Y×XNone triggers Cellpose auto-estimation--z_projection max (default): max-project over Z while preserving channels for 2D segmentation (H×W×C)--z_projection none: preserve Z; 4D stacks remain volumetric (Z×C×Y×X) for 3D segmentation--do_3D requires volumetric input (Z×Y×X or Z×C×Y×X)--do_3D falls back to 2D mode when safe, otherwise errors{stem}_cp_outlines_unavailable.txt) because Cellpose does not emit 3D outlines PNGs.output_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.ymlcellpose>=4.0 — cpsam modeltifffile — TIFF I/Oczifile>=2019.7.2.2 — Zeiss CZI I/O (manually verified with 2019.7.2.2)nd2>=0.11.1 — Nikon ND2 I/O (manually verified with 0.11.1)Pillow — 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:
Other measured skills in the registry, with their headline benchmark lift.