feat: reverse-populate OMEZarrMultiscale class with omero metadata on read - #607
feat: reverse-populate OMEZarrMultiscale class with omero metadata on read#607jo-mueller wants to merge 7 commits into
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
…o-mueller/ome-zarr-py into omero-metadata-in-OMEZarrImage
| contrast_limits.append((start, end)) | ||
| else: | ||
| contrast_limits.append( | ||
| (0, self._images[0].data.dtype.itemsize * 255) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 👍
Small PR to make sure that we can extract OMERO Metadata via the
OMEZarrMultiscaleclasses. For context:In the write direction, we can pass
contrast_limits,channel_names,channel_colorsarguments to theOMEZarrMultiscaleclass, which are translated into appropriateomerometadata entries. On read, this isn't possible, though. This PR adds minimal translation to the reader path of theOMEZarrMultiscaleclass.TODO: