agentsclimarketplace

Cell detection

Skill BioTender-max/awesome-bio-agent-skills/skills/clawbio/cell-detection

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.From its SKILL.md

Install
npx -y skills add BioTender-max/awesome-bio-agent-skills --skill cell-detection

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.9 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it

πŸ”¬ Cell Segmentation

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.

Why This Exists

Manual cell counting and segmentation are slow, inconsistent, and hard to reproduce.

  • Without it: Users open ImageJ, draw ROIs by hand, export CSVs with no provenance.
  • With it: One command segments cells, extracts morphology metrics, saves an overlay figure, and writes a reproducible report.md.
  • Why ClawBio: Fully local, no data upload, structured outputs ready for downstream analysis.

Core Capabilities

  1. Segment: Run cpsam on any TIFF, PNG, or JPG fluorescence image
  2. Measure: Extract area, equivalent diameter, centroid, and eccentricity per cell
  3. Report: Produce report.md, {stem}_measurements.csv, and histogram figures

Input Formats

FormatExtensionNotes
Greyscale TIFF.tif, .tiffHΓ—W β€” passed directly
2-channel TIFF.tif, .tiffHΓ—WΓ—2 β€” cytoplasm + nuclear, any order
3-channel TIFF.tif, .tiffHΓ—WΓ—3 β€” H&E or fluorescence, any order
>3-channel TIFF.tif, .tiffFirst 3 channels used; remainder truncated with warning
PNG / JPEG.png, .jpg, .jpegGreyscale 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.

Workflow

  1. Load image; detect greyscale vs multi-channel
  2. Prepare β€” pass 1–3 channels through unchanged; truncate >3 to first 3 with a warning
  3. Segment with CellposeModel() β€” no channels argument needed
  4. Metrics via skimage.measure.regionprops
  5. Figures β€” overlay + size distribution histogram
  6. Report β€” report.md + {stem}_measurements.csv + reproducibility bundle (commands.sh, environment.yml, checksums.sha256)

CLI Reference

# 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

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).

Algorithm / Methodology

  1. Load image with tifffile (TIFF) or PIL (PNG/JPG); detect ndim
  2. If >3 channels, truncate to first 3 with a warning
  3. Instantiate CellposeModel(gpu=<flag>)
  4. Call model.eval(img, diameter=<arg_or_None>) β€” no channels arg (cpsam is channel-order invariant)
  5. Extract per-cell stats from masks via skimage.measure.regionprops
  6. Save {stem}_measurements.csv, figures, report.md

Key parameters:

  • Model: cpsam (Cellpose 4.0 unified model β€” channel-order invariant)
  • Channels: not passed β€” cpsam uses the first 3 channels of the input in any order
  • Diameter: None triggers Cellpose auto-estimation

Example Queries

  • "Segment the cells in my DAPI image"
  • "How many cells are in this microscopy image?"
  • "Run cellpose on my TIFF and give me a cell count"
  • "Segment my fluorescence image and export morphology metrics"

Output Structure

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.yml

Dependencies

  • cellpose>=4.0 β€” cpsam model
  • tifffile β€” TIFF I/O
  • Pillow β€” PNG/JPG loading
  • numpy β€” array ops
  • matplotlib β€” figures
  • scikit-image β€” regionprops metrics

Safety

  • Local-first: no image data leaves the machine
  • Every report includes the ClawBio medical disclaimer
  • Reproducibility bundle (commands.sh, environment.yml, checksums.sha256) records the exact invocation, dependencies, and output integrity

Integration with Bio Orchestrator

Trigger conditions:

  • Input is a TIFF/PNG/JPG microscopy image
  • User mentions "cellpose", "segment", "cell counting", "microscopy"

Chaining partners:

  • Future: export ROI centroids to spatial transcriptomics workflows

Citations

What ships with it: 3 files

39.9 KB alongside SKILL.md, 2 of them executable

tests/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.