Skip to content
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

Are "labels" supported by the plugin? #33

Closed
constantinpape opened this issue Mar 15, 2022 · 5 comments
Closed

Are "labels" supported by the plugin? #33

constantinpape opened this issue Mar 15, 2022 · 5 comments

Comments

@constantinpape
Copy link

constantinpape commented Mar 15, 2022

I have an ome.zarr file with a multi-channel image and two label images, a cell segmentation and a nucleus segmentation:

$ tree -L 2 MMStack_Pos0.ome.zarr
MMStack_Pos0.ome.zarr
├── 0
...
└── labels
    ├── cells
    └── nuclei

When I open this file via the napari-ome-zarr plugin the image is opened and displayed correctly, but the labels are not opened:

napari-ome-zarr.mp4

Are "labels" supported by the plugin? (If yes, then maybe something with how I save the labels is incorrect.)
The example file is available here: https://oc.embl.de/index.php/s/ezHha9qb8HjxSfd

@constantinpape
Copy link
Author

cc @sbesson

@joshmoore
Copy link
Member

ome_zarr -vvv info ... output can be useful with these types of issues.

@constantinpape
Copy link
Author

constantinpape commented Mar 15, 2022

Here's the output I get via info:

$ ome_zarr -vvv info MMStack_Pos0.ome.zarr
DEBUG:ome_zarr.format:Created nested FSStore(MMStack_Pos0.ome.zarr, r, {'dimension_separator': '/', 'normalize_keys': False})
DEBUG:ome_zarr.format:0.4 matches 0.4?
DEBUG:ome_zarr.reader:treating /home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr [zgroup] as Multiscales
INFO:ome_zarr.reader:root_attr: multiscales
DEBUG:ome_zarr.reader:[{'axes': [{'name': 'c', 'type': 'channel'}, {'name': 'z', 'type': 'space', 'unit': 'micrometer'}, {'name': 'y', 'type': 'space', 'unit': 'micrometer'}, {'name': 'x', 'type': 'space', 'unit': 'micrometer'}], 'datasets': [{'coordinateTransformations': [{'scale': [1.0, 4.0, 0.17, 0.17], 'type': 'scale'}], 'path': '0'}, {'coordinateTransformations': [{'scale': [1.0, 4.0, 0.34, 0.34], 'type': 'scale'}], 'path': '1'}, {'coordinateTransformations': [{'scale': [1.0, 4.0, 0.68, 0.68], 'type': 'scale'}], 'path': '2'}, {'coordinateTransformations': [{'scale': [1.0, 4.0, 1.36, 1.36], 'type': 'scale'}], 'path': '3'}, {'coordinateTransformations': [{'scale': [1.0, 4.0, 2.72, 2.72], 'type': 'scale'}], 'path': '4'}], 'version': '0.4'}]
INFO:ome_zarr.reader:datasets [{'coordinateTransformations': [{'scale': [1.0, 4.0, 0.17, 0.17], 'type': 'scale'}], 'path': '0'}, {'coordinateTransformations': [{'scale': [1.0, 4.0, 0.34, 0.34], 'type': 'scale'}], 'path': '1'}, {'coordinateTransformations': [{'scale': [1.0, 4.0, 0.68, 0.68], 'type': 'scale'}], 'path': '2'}, {'coordinateTransformations': [{'scale': [1.0, 4.0, 1.36, 1.36], 'type': 'scale'}], 'path': '3'}, {'coordinateTransformations': [{'scale': [1.0, 4.0, 2.72, 2.72], 'type': 'scale'}], 'path': '4'}]
INFO:ome_zarr.reader:resolution: 0
INFO:ome_zarr.reader: - shape ('c', 'z', 'y', 'x') = (4, 6, 2048, 2048)
INFO:ome_zarr.reader: - chunks =  ['1', '1', '512', '512']
INFO:ome_zarr.reader: - dtype = uint16
INFO:ome_zarr.reader:resolution: 1
INFO:ome_zarr.reader: - shape ('c', 'z', 'y', 'x') = (4, 6, 1024, 1024)
INFO:ome_zarr.reader: - chunks =  ['1', '1', '512', '512']
INFO:ome_zarr.reader: - dtype = float64
INFO:ome_zarr.reader:resolution: 2
INFO:ome_zarr.reader: - shape ('c', 'z', 'y', 'x') = (4, 6, 512, 512)
INFO:ome_zarr.reader: - chunks =  ['1', '1', '512', '512']
INFO:ome_zarr.reader: - dtype = float64
INFO:ome_zarr.reader:resolution: 3
INFO:ome_zarr.reader: - shape ('c', 'z', 'y', 'x') = (4, 6, 256, 256)
INFO:ome_zarr.reader: - chunks =  ['1', '1', '256', '256']
INFO:ome_zarr.reader: - dtype = float64
INFO:ome_zarr.reader:resolution: 4
INFO:ome_zarr.reader: - shape ('c', 'z', 'y', 'x') = (4, 6, 128, 128)
INFO:ome_zarr.reader: - chunks =  ['1', '1', '128', '128']
INFO:ome_zarr.reader: - dtype = float64
DEBUG:ome_zarr.io:open(ZarrLocation(/home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr/labels))
DEBUG:ome_zarr.format:Created nested FSStore(/home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr/labels, r, {'dimension_separator': '/', 'normalize_keys': False})
DEBUG:ome_zarr.reader:treating /home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr [zgroup] as ome-zarr
DEBUG:ome_zarr.reader:returning /home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr [zgroup]
/home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr [zgroup]
 - metadata
   - Multiscales
 - data
   - (4, 6, 2048, 2048)
   - (4, 6, 1024, 1024)
   - (4, 6, 512, 512)
   - (4, 6, 256, 256)
   - (4, 6, 128, 128)
DEBUG:ome_zarr.utils:[dask.array<from-zarr, shape=(4, 6, 2048, 2048), dtype=uint16, chunksize=(1, 1, 512, 512), chunktype=numpy.ndarray>, dask.array<from-zarr, shape=(4, 6, 1024, 1024), dtype=float64, chunksize=(1, 1, 512, 512), chunktype=numpy.ndarray>, dask.array<from-zarr, shape=(4, 6, 512, 512), dtype=float64, chunksize=(1, 1, 512, 512), chunktype=numpy.ndarray>, dask.array<from-zarr, shape=(4, 6, 256, 256), dtype=float64, chunksize=(1, 1, 256, 256), chunktype=numpy.ndarray>, dask.array<from-zarr, shape=(4, 6, 128, 128), dtype=float64, chunksize=(1, 1, 128, 128), chunktype=numpy.ndarray>]
DEBUG:ome_zarr.reader:returning /home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr/labels [zgroup] (hidden)
not an ome-zarr node: /home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr/labels [zgroup] (hidden)

so I guess it does not recognize this as a label node.

For some context: I have implemented the code to write this based on discussions in ome/ome-zarr-py#171. I will post a link to the actual code shortly.

@sbesson
Copy link
Member

sbesson commented Mar 15, 2022

Fromt the error message

not an ome-zarr node: /home/pape/Work/data/shila/ngff/MMStack_Pos0.ome.zarr/labels [zgroup] (hidden)

I suspect what is missing here is the intermediate labels metadata registering the individual label images

(base) sbesson@Sebastiens-MacBook-Pro ~ % ls -alh ~/Downloads/MMStack_Pos0.ome.zarr/labels 
total 24
drwxr-xr-x@  6 sbesson  staff   192B 15 Mar 16:33 .
drwxr-xr-x@ 11 sbesson  staff   352B 15 Mar 16:33 ..
-rw-r--r--@  1 sbesson  staff   6.0K 15 Mar 16:33 .DS_Store
-rw-r--r--@  1 sbesson  staff    24B 15 Mar 15:20 .zgroup
drwxr-xr-x@  9 sbesson  staff   288B 15 Mar 15:20 cells
drwxr-xr-x@  9 sbesson  staff   288B 15 Mar 15:20 nuclei

At least in my mind, the generation/update of the metadata for this intermediate group should definitely be part of the API discussed in ome/ome-zarr-py#171.

@constantinpape
Copy link
Author

@sbesson yes, that's the issue. The labels are found now.
(Though I will have a lot of follow up issues after dinner ;))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants