Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Review startup uses APIs unavailable in supported napari versions, and setup failures can leave layers hidden or locked without a usable session to restore the viewer.
6 open issues
Restore viewer state when review setup fails · New Support the declared minimum napari version · New Match new labels transform to the existing image · New Capture the original layer selection before adding review layers · New Convert cursor coordinates before calculating the crop center · New Map slice checks to the reviewed layer’s Z axis · New
What changed in this PR
Refactors the Review plugin to run in the current napari viewer, with an explicit finish flow, reorganized controls, and projections that follow the image’s display settings.
Changes:
- Adds session tracking, save prompts, and viewer-state restoration when finishing a review.
- Combines review controls in a left dock and places projections side by side below the viewer.
- Updates projection styling and crop dtype handling, passes the reviewed image shape to the slice checker, and expands tests.
| File | Description |
|---|---|
napari_cellseg3d/interface.py |
Adds button hover styling and an OS folder-opening helper. |
napari_cellseg3d/code_plugins/plugin_review.py |
Implements in-viewer review sessions, finish handling, dock layout, and layer-aware projection styling. |
napari_cellseg3d/code_plugins/plugin_review_dock.py |
Accepts the reviewed image shape instead of relying on the first viewer layer. |
napari_cellseg3d/_tests/test_review.py |
Expands coverage for session lifecycle, saving, controls, projections, and cropping. |
Review effort: Balanced
- Implemented volume_slice_index function to accurately track the current slice in the viewer. - Updated Datamanager to accept an optional slice_num parameter for better integration with viewer dimensions. - Enhanced test cases to validate slice behavior with additional viewer axes.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Reworks the Review plugin so a review runs inside the current napari viewer instead of opening a new one, and has a clean finish state.
Also changes the dock layout and makes the projection plots match napari display better.
Summary
Reworks the Review plugin so a review runs inside the current napari viewer instead of opening a new one, and can be finished cleanly. Also changes the dock layout and makes the projection plots match how napari displays the volume.
Review in the current viewer
Before this PR, "Start reviewing" opened a new
napari.Viewer. Any layers or widgets in that viewer were lost.Now the review runs in the existing viewer:
uint16labels layer is added when no labels are given. Every other layer is hidden, and the two review layers are locked so they can't be deleted from the UI.ReviewSessiondataclass, which records what to restore when the review ends.Layout
Datamanager), the save folder field, and the "Choose directory", "Open directory", "Save" and "Exit review" buttons. This replaces the magicgui save widget.Projections follow the layer
The projections previously used hardcoded
infernowith contrast 200–2000, and the crop was cast toint16. Now:PowerNorm)float32when resized for anisotropycrop_volume_around_pointis now a module-level function and takes an array instead of a layer.Fixes
self.anisotropy_widgets.enabledwas tested without being called, so the zoom factor was always applied.datamanagerread the volume shape fromviewer.layers], which is wrong in a viewer that has other layers. The shape is now passed in asimage_shape.Behaviour changes
uint16. It used to take the image's dtype.Stack created with GitHub Stacks CLI • Give Feedback 💬