Skip to content

Conversation

@will-moore
Copy link
Member

@will-moore will-moore commented Apr 1, 2025

As part of investigation into possible deprecation of ome-zarr-py, I wanted to see what it would take to remove the dependency from this repo.

In this PR, I have used 2 different approaches for the writing of images and label-images

  • for OME-Zarr images, I've copied over the required code from ome-zarr-py. This is because we were already doing the writing of Zarr to disk and we just needed ome-zarr-py for adding metadata and generating a pyramid. Most of the write_* methods (write_multiscales_metadata, write_well_metadata, write_plate_metadata) were doing validation which isn't strictly needed in our usage. Also we could replace the validation by using ome-zarr-models-py in in future.
    The only other method we needed for creating image pyramids was resize() for resizing dask arrays.
    This is a relatively small amount of code, copied into this repo for now, but it could make sense to keep it or move it elsewhere if we decide to deprecate ome-zarr-py.

  • for OME-Zarr label-images, I have used ngff-zarr to create the down-sampled pyramids from numpy data, and to write this to disk with multiscales metadata, replacing ome-zarr. write_multiscale_labels(). We now need to manually create the labels group etc and add image-label metadata since ngff-zarr has no support for reading/writing OME-Zarr labels.

ngff-zarr says Scaling is constrained by size of chunks - we do not scale below the chunk size but in practice, ngff-zarr simply uses smaller chunks for smaller resolutions.

@will-moore will-moore changed the title Copy utils.resize and other metadata utils from ome-zarr-py Remove ome-zarr-py dependency Apr 1, 2025
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.

1 participant