Add cellpose v4 support; migrate to npe2 and pyproject.toml#62
Add cellpose v4 support; migrate to npe2 and pyproject.toml#62jeskowagner wants to merge 9 commits into
Conversation
The plugin now detects the installed cellpose major version at import time and adapts accordingly. On v4, model/channel selection and image- based diameter estimation are hidden because cellpose-sam only provides the one model. Other changes: - Migrate from npe1 (napari-plugin-engine) to npe2: remove legacy hook registrations, add napari.yaml manifest with valid python_name entries - Replace setup.cfg/requirements.txt/tox.ini/MANIFEST.in with a single pyproject.toml (tox config embedded under [tool.tox]) - Remove the Cells 2D sample data contribution; the source URL was broken - Guard _compute_diameter_shape against no shape layer being selected
|
Just saw the unit test failures, will investigate in the next days and ping again when fixed :) |
- For cellpose V4, show z_axis and channel_axis dropdowns for 4D images (required)
and 3D images (optional; -1 sentinel = pure spatial ZYX); defaults inferred
from napari axis labels
- Fix 3D flow/cellprob handling: skip resize_image for 3D outputs to avoid
collapsing the Z axis and leaving layers in a broken vispy state
- Remove output_flows/output_outlines checkboxes; always write all output layers
- Replace sample data source with OSF zip (rgb_2D_tif + rgb_3D); add
rgb_2D sample ("Cells (2D+2Ch)") to napari.yaml
- Exclude build/ directory from setuptools package discovery
- Update tests: switch sample from local file to 'rgb_2D' napari sample, fix
dock_widgets API (drop underscore prefix), update expected mask counts for
cellpose V4 vs V3, and adjust diameter tolerance for Windows/CPU
- Rewrite sample data loader: fetch from OSF zip instead of per-file URLs,
add rgb_2D sample, set axis_labels on rgb_3D so z/channel dropdowns
auto-populate correctly
|
@carsen-stringer I have changed out some of the tests - Cellpose-SAM on CPU in 3D simply takes too long. I also had to make sure that torch is loaded in before pyqt due to pytorch/pytorch#166628. I added some new tests, and a CI test for cellpose=3 to make sure the GUI stays compatible. With these changes in place, all tests are passing now! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62 +/- ##
==========================================
- Coverage 54.31% 52.98% -1.33%
==========================================
Files 3 3
Lines 232 285 +53
==========================================
+ Hits 126 151 +25
- Misses 106 134 +28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Looks like there were two problems with CI:
|
The plugin now detects the installed cellpose major version at import time and adapts accordingly. On v4, model/channel selection and image- based diameter estimation are hidden because cellpose-sam only provides the one model.
Other changes:
Fixes #61.