Add axis_labels and units, refactor to using properties in nImage#45
Merged
TimMonko merged 3 commits intondev-kit:mainfrom Jan 31, 2026
Merged
Add axis_labels and units, refactor to using properties in nImage#45TimMonko merged 3 commits intondev-kit:mainfrom
nImage#45TimMonko merged 3 commits intondev-kit:mainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
TimMonko
added a commit
that referenced
this pull request
Feb 3, 2026
# Description Follow-up to #45 This fixes an accidentally broken property and then continues to refactor nImage. Largely, this is meant to super clean up the API. It 1. Refactors out many methods to a new module `_layer_utils.py` 2. Cleans up the `get_layer_data_tuples` code path, especially for RGB 3. Cleans up typing throughout 4. Removes dead code
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.
Description
I've been long unhappy with the cruft I set up in
nImage, and I've long been wanting to convert to a cleaner API.I think I finally am starting to grok
@propertywhere it can be used effectively as a function to "get" an object, while still accessing it like an attribute. This is a step towards cleaning up the API :)Second, I've also been wanting to incorporate more axis metadata, and bioio has recently added both
unitsanddimension_properties. So, this PR uses properties to also add:axis_labelsunitsIn addition to scale. Speaking of scale, this now contains a bugfix for layers that contain time, woops! the tuple wasn't long enough because it only inherited from physical pixel sizes, and not time. Gah
I have also made the decision to break the public API here I have renamed attributes from
napari_scaletolayer_scalebecause it was causing some overlap and redundancy. Now it's more clear that this is getting something for a layer object and not, e.g. a viewer.Going forward I promise not to break these objects like this again. Please open an issue if this is a problem, but I know there is not yet much use of this so I can easily make a backwards compatible patch if needed.