-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiscale labeled images #45
Conversation
The introduction of multiple types per node of the Zarr hierarchy (e.g. multiscales AND labeled image) made the existing code flow difficult to extend and test. This reworks the previous BaseZarr type into multiple hierarches: - ome_zarr.io: Locations hierarchy for choosing Remote or Local - ome_zarr.reader: Spec hierarchy for choosing metadata types The general code flow consists of: - ome_zarr.napari.napari_get_reader() - ome_zarr.io.parse_url() - ome_zarr.reader.Reader.__call__() - ome_zarr.reader.Layer() -ome_zarr.reader.Spec() [recursion] - ome_zarr.napari.transform
- replace test lookup for labels/coins - don't write labels group if no label exists
Provides the `ome_zarr scale` CLI command as well as the `ome_zarr.scale.Scaler` class for downsampling arrays as multiscales. originally: ome/omero-ms-zarr#61
New tests and code require a substantial number of requirements like opencv and Qt. Rather than try to encapsulate that configuration directly in .travis, we copy the napari-omero strategy of using conda in GH actions.
ome_zarr/data.py
Outdated
if pyramid[0].shape[CHANNEL_DIMENSION] == 1: | ||
image_data = { | ||
"channels": [{"window": {"start": 0, "end": 1}}], | ||
"rdefs": {"model": "grayscale"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the OMERO metadata JSON I think we previously had "greyscale" matching RenderingModel
. I don't know if this matters or what it should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to defer to @will-moore, but I agree at least the three zarr related repos should use uniform spelling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. OMERO has greyscale
everywhere. napari grayscale
. I'll update to use the former and if we need to, we can transform in ome_zarr.napari
.
NB: ome-model primarily uses "e", "a" appears only twice in docs. Bio-Formats leans more towards "a" including the CLI argument.
Co-authored-by: Mark Carroll <[email protected]>
Testing as above with latest commits from here and
I noticed the labels layer is visible initially. Is that a change of behaviour?
? |
I tried downloading:
I guess the s3 data hasn't been updated from masks -> labels yet, but even if labels are missing, should the image data itself still download OK? |
Yeah, I noticed that as well. One of my bug fixes must have reverted. I assume it's not overly critical, but I'll look into it.
Definitely. |
My point was not so much that the 'masks -> labels` updates need to happen on s3, but that any image fails to download if it doesn't have any labels.
|
Ah, this was a lack of output dir.
|
ome_zarr/reader.py
Outdated
node which will likely be turned into a lower layer for display. | ||
|
||
By unsetting visible, the node (and in turn the layer) can be | ||
deactivated for initial display. By default, the value of the current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly confused: "by default" suggests a means of override but I am not seeing what that is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing a value would override the None. I'm pushing a commit to rework the wording. Let me know if you think it's better.
The For |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for the overall refactoring of this class into more tractable and testable modules. Are we effectively approaching an 0.1.0
?
self.pre_nodes: List[Node] = [] | ||
self.post_nodes: List[Node] = [] | ||
|
||
# TODO: this should be some form of plugin infra over subclasses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume another todo might be to add some validation for incompatible specs i.e. I assume a node cannot be both a Label
and Labels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the Labels
pointed to itself with .
it might just work...
Ah thanks. I've fixed this to work again without the flag. |
3c428c8
to
fee5d7a
Compare
fee5d7a
to
fbfa932
Compare
a211f82
to
4ed3078
Compare
Non-Windows tasks are all now passing. It's going to be fiddly to get Windows passing, so I'd like to do that in a new PR. Any objections to merging? |
GFI. I think any fixes will be much smaller increments than this. |
ome-zarr now expects a multiscale zgroup rather than a single zarray as the content of a label. Along with the previous round of changes (#44 (comment)) this means to modify an existing ome-zarr with masks you need to:
ome_zarr scale 6001240.py/labels/{0,1}
1
to thelabels/.zattrs
"names" element, optionally removing0
(This will be put into a script to be run against s3.embassy.ebi.ac.uk)
Interestingly, with the current changes, loading is still successful without the changes above since the the mask is treated as a raw zarr array.
Summary of other user changes:
labels/
directory to napari. The mask is opened visible, and the image is loaded invisible. This is the first usage of the link{"image": { "array" ...
. See Fix masks.[].image.array to match spec omero-cli-zarr#19 . Future work will likely make it possible to point at the label itself and have the images loaded, too.ome_zarr create
command for creating sample data. Note: colors are not working correctly yet.ome_zarr scale
commandome_zarr info
now displays different output.ome_zarr download
now downloads recursively.Summary of other developer changes: