-
Notifications
You must be signed in to change notification settings - Fork 43
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
TIFF with multiple image frames being read as having 1 frame #1606
Comments
large_image has several tile source readers that read tiff files. tiff files have huge variations, and some writers (such as ImageJ) claim to write tiff files that are not actually compliant with the specification. From python, you can see which reader was used by doing something like For any tiff file, we can see its internal structure using the |
Thank you @manthey! Below is the output of Header: 0x4d4d StripOffsets 273 (0x111) LONG: 291698 |
This file is "not-quite-a-tiff" file written by ImageJ. These are a valid 1-frame tiff file with all the extra frames appended afterwards without proper tiff references to them. Normally large_image asks the tifffile source to read these, since it has specific code to handle this. There, I wonder if large_image picked the tifffile source module if it would read correctly. Does the following show the correct number of frames?
If so, then I need to dig into why the tifffile source wasn't chosen by default. If not, then I'll need to look a little deeper. |
Running the code above on the "not-quite-a-tiff" file throws the following error: Is there a way to convince ImageJ to write the tiff file "properly"? |
I don't see anything in ImageJ's user guide to vary how it saves tiff files. Can you check if you have a very recent version of the |
I have tifffile version 2024.8.10. If that's meant to be the date of its release, then it is very recent. |
The linux command |
I've attached the first ~300kb as a .txt file here (neither .tif nor .dat files are not supported for attachment): |
With this and the file extended with random data to a total of 13827084458 bytes, my instance of large_image uses tifffile and properly reports 3337 frames. This worked on several versions of python and on linux and osx. This means either your actual file is a different length then I'd expect from the headers or your environment is somehow significantly different than mine. Can you confirm your file's length? And, if that matches, can you give details on your OS/Python versions and which version of large_image you have installed. |
File length is confirmed as 13827084458 bytes. I tried using
Could the file path be the issue? I had to add an escape character ('\') behind each backward slash in the file path since I'm in a Windows environment. |
For what it's worth, when I try opening the file without specifying the source, this is the result (reading as a JPEG?) Command: Result: |
I had only tried on linux and OSX. I get exactly your result on Windows. The culprit is a line to check sanity of the image and find the largest image series that reads Thanks for working through this. |
That `'JPEG'`` term indicates that if you ask for part of the image as an image tile it will default to returning a JPEG. You can override and ask for any output format PIL supports, but this is the default since as a tile server for the web jpeg is often an acceptable choice. |
@dodewall You can try this out by installing the development release ( |
Amazing - this works; thank you! |
Thanks for the confirmation, and I'm glad we could hunt down what was going on. |
Hello! I'm trying to use large-image to view & manipulate large (~12GB) timelapse acquisitions (~1300 16-bit grayscale frames saved as a .tif file). When I use source = large_image.open(file_path), the source object shows the correct sizeX and sizeY, but source.frames returns "1". The tileIterator also only returns a single tile. Is there any advice for troubleshooting available?
The text was updated successfully, but these errors were encountered: