ome-zarr-py icon indicating copy to clipboard operation
ome-zarr-py copied to clipboard

General feedback about convenience functions

Open constantinpape opened this issue 2 years ago • 0 comments

Some general feedback about using the convenience functions from creating an example for converting ome.tiff data to ome.zarr (https://github.com/ome/ome-ngff-prototypes/tree/main/workflows/spatial-transcriptomics-example):

  • write_image is currently very inflexible w.r.t. downsampling functionality: it only supports passing a Scaler and then uses nearest, see https://github.com/ome/ome-zarr-py/blob/master/ome_zarr/writer.py#L432.
  • write_multiscales is more flexible in this regard, but doesn't support all metadata, see #176

My suggestion here would be to update write_image s.t. it uses scaler(image) instead of scaler.nearest(image). Then I would change the implementation of scaler, s.t. it implements __call__ to be compatible. This should default to nearest, but it should also have an __init__ that exposes this as a parameter (default_method or so).

This would make the whole approach more flexible, without changing any of the default behavior. Note that users could even implement fully custom downsampling this way. Maybe the checks when writing the data to disc in write_multiscales should be extended though that the data has the right format (e.g. same number of dimensions) here.

constantinpape avatar Mar 16 '22 10:03 constantinpape