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
Preserving singlet dimensions when loading ImageJ hyperstack tifs #19
Comments
That is intended. AFAIK ImageJ does not write Lines 12547 to 12570 in 9870837
|
Thank you for the clarification. I tend to read/write 5D tifs with Tifffile, and keeping the same dimensions when saving/loading is important to me. I know this can be achieved by omitting the I had been using the Do you have any suggestion on how this can be achieved now - creating a tif that would load with the "correct dimensions" with only Also, feel free to close the issue, as maybe this is getting beyond the scope of your project. |
Using def imread(filename):
with TiffFile(filename) as tif:
axes = tif.series[0].axes
hyperstack = tif.series[0].asarray()
return transpose_axes(hyperstack, axes, 'TZCYXS') |
That would definitely work for me, but I think I will opt for preserving the singlet dimensions by giving up the I was hoping for a Thank you for your help and the time that you put into this! |
I have the same problem as nhthayer; I want to save and load 5d numpy arrays that open as hyperstacks in imagej, and don't drop singlet dimensions. I guess I can redefine imread in every script I have that uses tifffile, but it seems like the old behavior was strictly superior. What am I missing? (Disclaimer: I deeply appreciate the work you put into tifffile, and I know you don't owe me your valuable labor for free. I hope my question isn't annoying, and I hope my appreciation and respect for your work is clear.) |
IIUC you want an option to include e.g. |
This was the old behavior, right? Load(save(x)).shape == x.shape, and if you open the file in imagej, it opens as a hyperstack. I think this use case is fairly common: tif as basically numpy arrays on disk, with easy casual inspection via imagej, but for any serious work you load back to python. |
I am -1 on extending the ImageJ format for tifffile. Maybe an option |
Noticed a change in behavior between 2019.5.30 -> 2019.6.18 and wanted to make sure it was intended. Hopefully I'm just missing a new way of preserving dimensions of size 1 when loading ImageJ hyperstack tifs.
In the new version, it appears that dimensions of size 1 are not included in the final stack shape, even if they are specified in the imagej metadata:
tifffile/tifffile/tifffile.py
Lines 2630 to 2648 in 6991c4b
In the older version, the channel dim would be included if it was specified in the metadata:
tifffile/tifffile/tifffile.py
Lines 2526 to 2529 in ffbdf61
The text was updated successfully, but these errors were encountered: