cell-detection
Cell segmentation in fluorescence microscopy images.
Skill by MubasherMohammed
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mubashermohammed-cell-detection
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
cell-detection- Description
- 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.
- License
- MIT
- Instructions
- 131 lines in SKILL.md ยท view on GitHub
Before installing
- Ships executable scripts
Files (4)
- SKILL.md
- cell_detection.py
- requirements.txt
- test_cell_detection.py ยท tests/
SKILL.md (first lines)
# ๐ฌ 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
| 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.
## 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
```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
```
## Demo
```bash
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 OrchestratorFrom MubasherMohammed/opencode-BioInfo, MIT.
More from MubasherMohammed/opencode-BioInfo
- 0.466score
dnasp
David De Lorenzo
Full reimplementation of DnaSP 6 for population genetics analysis of aligned DNA sequences.
SkillCFreshness: CClaude Code +9 - 0.247score
claw-ancestry-pca
MubasherMohammed
No description from the publisher yet.
SkillCFreshness: CClaude Code +9 - 0.247score
claw-metagenomics
MubasherMohammed
No description from the publisher yet.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- May 10, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
Cite this page
cell-detection skill. Agent Mart. https://agentmart.dev/skills/mubashermohammed-cell-detection (last updated 2026-10-24)