Skip to content

Cellpose sam#287

Merged
victorjonathanibanez merged 19 commits intomainfrom
cellpose_sam
Mar 24, 2026
Merged

Cellpose sam#287
victorjonathanibanez merged 19 commits intomainfrom
cellpose_sam

Conversation

@victorjonathanibanez
Copy link
Copy Markdown
Contributor

@victorjonathanibanez victorjonathanibanez commented Feb 25, 2026

This pull request updates the Cellpose integration in Steinbock to support Cellpose v4 and its new SAM model, and modernizes the segmentation CLI and backend to match the latest Cellpose API. The changes remove legacy options, add new parameters, and update model handling for improved segmentation flexibility and compatibility.

Cellpose version and model management:

  • Updated CELLPOSE_VERSION in Dockerfile to 4.0.8, and replaced manual model downloads with a single download of the new SAM model from HuggingFace (cpsam). [1] [2]

CLI and API modernization:

  • Removed legacy model selection and options (model_name, net_avg, tile, interp, etc.), and replaced them with new parameters matching Cellpose v4 (e.g., resample, channel_axis, invert, rescale, max_size_fraction, niter, augment). [1] [2] [3] [4] [5] [6] [7]

Backend refactor for Cellpose v4:

  • Changed backend to use CellposeModel from Cellpose v4, removed legacy channel handling, and updated the segmentation call to use new arguments and output structure. [1] [2] [3]

Parameter and naming updates:

  • Updated option and variable names for clarity and to match Cellpose documentation (e.g., cellprobab_thresholdcellprob_threshold).

Output simplification:

  • Simplified output handling in segmentation generator to match new Cellpose API (no diameter output, updated tuple structure). [1] [2]

Docs refinement:

  • Updated description of cellpose container and usage according to Cellpose documentation. [1]

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the Cellpose integration from v2.2 to v4.0.8, introducing support for the new SAM model and modernizing the CLI and backend API. The changes remove legacy Cellpose v2 parameters (model_name, net_avg, tile, interp) and add new Cellpose v4 parameters (resample, channel_axis, invert, rescale, max_size_fraction, niter, augment). The backend switches from cellpose.models.Cellpose to models.CellposeModel, removes channel handling logic, and simplifies output handling by no longer returning diameter values.

Changes:

  • Updated Cellpose from v2.2 to v4.0.8 and replaced legacy model downloads with SAM model from HuggingFace
  • Modernized CLI by removing 5 legacy options and adding 7 new parameters matching Cellpose v4 API
  • Refactored backend to use CellposeModel without model selection, removed channel validation, and updated eval() parameters

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.

File Description
Dockerfile Updates CELLPOSE_VERSION to 4.0.8 and replaces multiple model downloads with single SAM model from HuggingFace
steinbock/segmentation/cellpose.py Changes import, removes model_name parameter, eliminates channel handling logic, updates CellposeModel initialization and eval() call with new parameters
steinbock/segmentation/_cli/cellpose.py Removes --model and legacy parameter options, adds 7 new Cellpose v4 parameters, fixes cellprobab→cellprob typo, updates function signature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BodenmillerGroup BodenmillerGroup deleted a comment from DarioS Mar 24, 2026
@victorjonathanibanez victorjonathanibanez merged commit 5f5b9fe into main Mar 24, 2026
2 checks passed
@victorjonathanibanez victorjonathanibanez deleted the cellpose_sam branch March 24, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants