-
Notifications
You must be signed in to change notification settings - Fork 54
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
Support opening of masks #30
Conversation
With that last commit, and with
loads masks along with the Image: And this works locally (with images exported as above) loading masks with the Image:
|
In testing against a local array, I was failing to load the masks, @will-moore. I tried unifying the logic and this now works. This, however, removes your directory listing code. Two thoughts:
cc: @tlambert03 |
masks: unify remote and local handling
ome_zarr.py
Outdated
data = da.from_zarr(mask_path) | ||
# mask data is 5D (t, c, z, y, x) but each layer in napari is 4D (no C) | ||
# NB: Assume we want 'first Channel' | ||
data = data[:,0,:,:,:] |
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.
Shouldn't this be handled on the napari side, instead of in this library?
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.
ah interesting. There does seem to be a limitation here in napari if you have multiple (image) channels along with a mask for each one. In the near(ish) future, we'll have layer "groups" that would let you associate each labels layer with a given image layer... but for now, you basically have no choice but to have nC x 2 unassociated layers in napari if you have a mask for every image channel.
So for here, doing data[:, 0, :, :, :]
will make sure you only have a single labels layer, but will obviously omit some data. So you could return a list of [(data[:,n,:,:,:],meta,'labels') for n in range(nChannels)]
if you want to (and, until we provide layer groups, give them names that indicate which image layer they go with?)
lastly, singleton dimensions are handled well in napari, so if nC == 1, you wouldn't need to squeeze it.
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.
Without that line, the masks shape is 5D: (40, 1, 31, 256, 256)
whereas the Image channels have 4D shape (40, 31, 256, 256)
, so you get a mismatch of dimensions (masks and Image have independent T sliders):
In 9f7f878 I've split mask channels into layers, as suggested by @tlambert03 - Thanks.
@joshmoore Your logic from ec13afd for detecting masks relies on ome/omero-cli-zarr#12 ? |
Yes. Happy to roll that back if you need to get this in before 12 lands. |
This works now (loading masks):
|
Merging this as is. I'll updated ome/omero-ms-zarr#55 to list labeled images as zarrays rather than multiscale zgroups and then we can make that move in a follow up. (It'll be the first test of a breaking change!) |
Currently supports opening of local zarr masks.
To test:
$ omero napari view Image:5514375
napari
console, doviewer.open('path/to/5514375.zarr/masks/')