Back to skills
extension
Category: Productivity & OfficeNo API key required

cellpose-segmentation

run cellpose-based segmentation for common bioimage analysis tasks in python, cli, or gui workflows, including 2d, 3d, batch processing, model selection, parameter tuning, result export, and optional training or fine-tuning. use when the user explicitly wants cellpose or when classical segmentation is likely insufficient for cell or nucleus segmentation. prefer this skill for napari-centered workflows that need cellpose masks, labels, qc outputs, scripts, and notebooks.

personAuthor: TashanworldhubOpenAPI

Cellpose Segmentation

Overview

Use Cellpose as a dedicated segmentation skill for microscopy workflows that benefit from pretrained models, Cellpose-specific parameters, or human-in-the-loop correction.

Default stack

Baseline stack:

  • numpy
  • scipy
  • scikit-image
  • tifffile
  • pandas
  • matplotlib
  • napari

Cellpose-specific additions when needed:

  • cellpose
  • optional napari integration if the environment supports it

When to prefer Cellpose

Prefer Cellpose when:

  • the user explicitly asks for Cellpose
  • object boundaries are irregular or hard to threshold classically
  • pretrained cell or nucleus models are likely to work well
  • the user wants a fast strong baseline before manual refinement

Supported modes

Cover all of these when relevant:

  • GUI usage
  • CLI usage
  • Python API usage
  • 2D inference
  • 3D inference
  • batch processing
  • training or fine-tuning

Workflow

1. Clarify the segmentation target

State the target explicitly:

  • cells
  • nuclei
  • cytoplasm
  • other compartments

Also state:

  • image dimensionality
  • channel mapping
  • whether output should be binary mask, labels, outlines, or all of them

2. Pick a starting model

Use a practical initial model choice and say why. Examples include nucleus-oriented or cell-oriented defaults. If the best model is unclear, say so and provide one or two candidate starting points.

3. Name the critical parameters

Always call out the parameters most likely to matter:

  • diameter or scale assumptions
  • channels
  • flow or probability thresholds when exposed
  • 2D vs 3D mode
  • tile / memory considerations for large images

4. Save reproducible outputs

By default, generate:

  • labels / masks image
  • optional outlines
  • CSV measurements or handoff to measurement workflow
  • QC visualization
  • runnable Python script
  • notebook version

5. Support iterative improvement

If first-pass results are poor, propose specific next actions:

  • adjust diameter
  • change model family
  • normalize channels differently
  • refine image preprocessing
  • switch between 2D and 3D mode appropriately
  • consider fine-tuning when repeated failure occurs on representative data

Training and fine-tuning guidance

When the user asks for training or fine-tuning:

  • state required training data format explicitly
  • separate training instructions from inference instructions
  • warn about overfitting on small curated examples
  • recommend a representative validation split when possible

Napari integration guidance

When the workflow is napari-centered:

  • display raw image as image layer
  • display Cellpose result as labels layer
  • keep model settings and run parameters in the notebook or script
  • recommend a manual review pass before quantitative analysis

Safety and quality rules

  • Do not imply a pretrained model is universally valid.
  • Do not claim biological correctness from visual plausibility alone.
  • Flag when channel interpretation is uncertain.
  • For large datasets, mention compute and memory tradeoffs.

Resources

  • references/cellpose-playbook.md: decision rules for inference vs training
  • scripts/cellpose_stub.py: minimal placeholder entry point for API-driven runs