Conversation
…lposeModel and new vars for cellposeSAM
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…into cellpose_sam
for more information, see https://pre-commit.ci
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:
CELLPOSE_VERSIONinDockerfileto4.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:
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:
CellposeModelfrom 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:
cellprobab_threshold→cellprob_threshold).Output simplification:
Docs refinement: