Skip to content

feat: reverse-populate OMEZarrMultiscale class with omero metadata on read - #607

Open
jo-mueller wants to merge 7 commits into
ome:masterfrom
jo-mueller:omero-metadata-in-OMEZarrImage
Open

feat: reverse-populate OMEZarrMultiscale class with omero metadata on read#607
jo-mueller wants to merge 7 commits into
ome:masterfrom
jo-mueller:omero-metadata-in-OMEZarrImage

Conversation

@jo-mueller

@jo-mueller jo-mueller commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Small PR to make sure that we can extract OMERO Metadata via the OMEZarrMultiscale classes. For context:

In the write direction, we can pass contrast_limits, channel_names, channel_colors arguments to the OMEZarrMultiscale class, which are translated into appropriate omero metadata entries. On read, this isn't possible, though. This PR adds minimal translation to the reader path of the OMEZarrMultiscale class.

TODO:

  • testing

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.49%. Comparing base (e65666e) to head (56d484e).

Files with missing lines Patch % Lines
ome_zarr/classes/image.py 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #607      +/-   ##
==========================================
+ Coverage   86.46%   86.49%   +0.02%     
==========================================
  Files          16       16              
  Lines        2365     2384      +19     
==========================================
+ Hits         2045     2062      +17     
- Misses        320      322       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jo-mueller jo-mueller changed the title feat: reverse-populate OMEZarrImage class with omero metadata on read feat: reverse-populate OMEZarrMultiscale class with omero metadata on read Jul 30, 2026
@jo-mueller
jo-mueller marked this pull request as ready for review July 30, 2026 11:14
@jo-mueller
jo-mueller requested a review from will-moore July 30, 2026 11:15
Comment thread ome_zarr/classes/image.py
contrast_limits.append((start, end))
else:
contrast_limits.append(
(0, self._images[0].data.dtype.itemsize * 255)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nicer to use np.iinfo to get the min/max as these will distinguish e.g. unit8 from int8 etc:

>>> a = np.array([1,2,3], dtype="int8")
>>> np.iinfo(a.dtype).min
-128
>>> np.iinfo(a.dtype).max
127
>>> a.dtype.itemsize * 255
255

But we need different handling for floats, using np.finfo and cast np value to float:

>>> a = np.array([1,2,3], dtype="float64")
>>> np.finfo(a.dtype).min
np.float64(-1.7976931348623157e+308)
>>> float(np.finfo(a.dtype).min)
-1.7976931348623157e+308
>>> float(np.finfo(a.dtype).max)
1.7976931348623157e+308

The other possibility here, which is used in e.g. vizarr and ome-zarr.js is to use the actual min and max values of the smallest resolution array to provide the start and end values if they're missing.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other possibility here, which is used in e.g. vizarr and ome-zarr.js is to use the actual min and max values of the smallest resolution array to provide the start and end values if they're missing.

That's a neat idea 👍

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.

2 participants