-
Notifications
You must be signed in to change notification settings - Fork 51
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
Impossible to import dimension with multiple indices #435
Comments
Hey @guiwitz sorry you are encountering the issue. Unfortunately I cannot reproduce: conda create --name aicsimageio-bugtest python=3.8.13 -y
conda activate aicsimageio-bugtest
pip install --no-cache-dir --force-reinstall aicsimageio==4.9.2
python python: from aicsimageio import AICSImage, writers
import numpy as np
image = np.random.rand(2, 3, 1024, 2048)
writers.OmeTiffWriter.save(image, "file.ome.tiff", dim_order="TCYX")
im_read = AICSImage("file.ome.tiff")
print(im_read.dims)
print(im_read.get_image_data("CYX", C=[0,1], T=0, Z=0).shape) That all works for me and prints out what I expect. That said, I am wondering if you are trying to read an OME TIFF or just a TIFF? If you are reading a TIFF (or an OME-TIFF with malformed metadata), then we use just the TIFF reader and try to guess the dims. In which case, I think what may be happening is that our guess is incorrect. If you add |
Hi @evamaxfield, you are absolutely right, I mixed things up and the minimal example above does actually work and my error came from a regular tiff, sorry! However there's still a problem with imports, so let me come back to my original problem which lead to this wrong minimal example: what used to work before was passing a list with a single element for one of the dimensions e.g : from aicsimageio.writers import OmeTiffWriter
import numpy as np
image = np.random.rand(2, 3,1024, 2048)
OmeTiffWriter.save(image, "file.ome.tif", dim_order="TCYX")
im_read = AICSImage('file.ome.tif')
im_read.get_image_data('CYX', C=[0] , T=0, Z=0).shape In 4.9.1 this would generate an array of dimensions
I know that I could just pass this single index without the list, but I think it's cleaner to have the possibility to pass list of any size (including 1) and always return arrays with the same number of dimensions, including when one of these dimensions has as size of 1. So the old behaviour seemed more consistent. |
Sorry for the delay. The fix for this should be released in about an hour or so in v4.9.3 |
Great, thank you! |
System and Software
Description
Since the release of 4.9.2 it's apparently impossible to import multiple indices for a given dimension using the
get_image_data
method e.g. inim_aics.get_image_data('CYX', C=[0,1] , T=0, Z=0)
Expected Behavior
In 4.9.1. the example above would have generated an array of dimensions
(2, n_pixX, n_pixY)
Reproduction
This creates an image with 2 time points and 3 channels. The reported dimensions when re-importing the file are correct:
However when trying to read e.g. two of the three channels, one gets:
Environment
Any additional information about your environment
The text was updated successfully, but these errors were encountered: