Open imagejan opened 5 months ago
A small utility function sounds like a useful start.
I think this would be a great opportunity to explore how we could create and use extensions with the ngff spec.
@tibuch How about extending zarr.Group
with some histogram awareness:
from zarr import Group
class HistogramAwareZarrGroup(Group):
def histogram(self) -> UIntHistogram:
...
def __compute_and_persist_histogram(self):
...
(naming to be debated)
???
Not sure if we want this to be a class
. Maybe a mixin would be better suited?
We should store histograms a zarr
group instead of numpy data.
When this was still named
faim-hcs
, we had this code to compute histograms and add it to the zarrattrs
:https://github.com/fmi-faim/faim-ipa/blob/7594dc679baef9715ec4d193557dae4c617372f2/src/faim_hcs/Zarr.py#L173-L183
@tibuch what do you think, does it make sense to add the list of histogram paths to the metadata somehow, or should we just rely on the presence of those files inside the zarr directory tree?
Maybe we can come up with a small utility function that returns the histogram loaded from file if it's present, and otherwise computes the histogram on the fly and (optionally) saves it into the zarr (for future use).
What do you think?