gerlichlab / looptrace

Fork (from EMBL Gitlab) of the looptrace project: https://git.embl.de/grp-ellenberg/looptrace
MIT License
2 stars 1 forks source link

Generation of nuclei images can result in zarr with incorrect `chunks` and `shape` metadata #245

Closed vreuter closed 5 months ago

vreuter commented 5 months ago

image_io.single_position_to_zarr sets the chunk and shape value for any of the default axes (time, channel, z, y, x) that's not present in the structure of the shape attribute of the given image to 1. But this means that the value of the chunks and of the shape key in the zarr metadata can be incorrect, alleging that the underlying data array has dimensions which aren't really there.

Requirement for chunks and shape: https://zarr.readthedocs.io/en/stable/spec/v2.html

This can be hacked around by doing single-value slice indexing into the underlying numpy array so that any singleton dimension is preserved, but we should have a cleaner solution, in which we don't meddle with the actual structure of the data in order to have it conform to our metadata specification.

vreuter commented 5 months ago

Closing in favor of #247