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

Fix failure to create Colormap for single-channel data #15

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

will-moore
Copy link
Member

@will-moore will-moore commented Sep 24, 2021

This fixes the opening of images without a channel dimension that have color info in an omero metadata.

For images without a channel dimension, we convert

colormaps = [
   [[r,g,b], [r2,g2,b2]]
]

into

colormaps = [[r,g,b], [r2,g2,b2]]

but this is not handled by the subsequent code that tries to create ColorMaps. So it tries to create a ColorMap from [r,g,b] instead of [[r,g,b], [r2,g2,b2]].
To fix this, simply move the ColorMap creation code before the unwrapping of the list for single-channel images.

Since we only find this bug with v0.3 data that don't have a c dimension, it is not found on any public data.

To test, NB: needs ome/ome-zarr-py#114 to create 2D sample image:

$ ome_zarr create coinsimg
$ napari coinsimg

Screenshot 2021-09-29 at 09 12 05

For single-channel data we remove 1 level of nesting of lists, so the enumeration breaks.
Need to handle the colormap conversion before different handling for single-channel images
@will-moore will-moore force-pushed the fix_colormap_single_channel_images branch from 55ba094 to 16a7a2e Compare September 24, 2021 21:47
@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2021

Codecov Report

Merging #15 (16a7a2e) into main (be5ff0d) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #15   +/-   ##
=======================================
  Coverage   90.74%   90.74%           
=======================================
  Files           3        3           
  Lines         162      162           
=======================================
  Hits          147      147           
  Misses         15       15           
Impacted Files Coverage Δ
napari_ome_zarr/_reader.py 85.88% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be5ff0d...16a7a2e. Read the comment docs.

@sbesson sbesson requested a review from khaledk2 October 1, 2021 14:30
@sbesson sbesson merged commit 174e3cd into ome:main Oct 12, 2021
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

Successfully merging this pull request may close these issues.

3 participants