Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_image assumes particular axisorder #122

Closed
k-dominik opened this issue Oct 21, 2021 · 2 comments · Fixed by #123
Closed

write_image assumes particular axisorder #122

k-dominik opened this issue Oct 21, 2021 · 2 comments · Fixed by #123

Comments

@k-dominik
Copy link
Contributor

Heyo, I just tried to naively write an ndarray to a an ome.zarr file, but didn't manage. My array was something like numpy.zeros((100, 200, 1), dtype='uint8') where I considered axes to be yxc.

of course when calling write_image I specified the axes argument. The scaler, however, will assume a certain axisorder. This leads to weird errors that are not super obvious.

I'd say this should be documented, or circumvented (e.g. making Scaler aware of axes, using a temporary adding the appropriate axes, etc...)

@will-moore
Copy link
Member

Hi @k-dominik thanks for the feedback.
write_image should be doing a better job of validating the axes since the NGFF spec at https://ngff.openmicroscopy.org/latest/#image-layout says
All image arrays must be up to 5-dimensional with dimension order (t, c, z, y, x).
The scaler currently only downsamples in y and x dimensions, so it will certainly give strange behaviour if either of those are 1.

@k-dominik
Copy link
Contributor Author

k-dominik commented Oct 21, 2021

Hi @will-moore,

thx for the quick reply. I'd argue that this should be part of the documentation of the function - users might not necessarily the spec, whereas it's natural to read a docstring. Also, I'd argue it could also be totally natural to expect write_image to do all necessary conversions. Or at least, a meaningful exception should be thrown, as you suggest.

Cheers
Dominik

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 a pull request may close this issue.

2 participants