Opened 7 years ago
Last modified 7 years ago
#1696 assigned enhancement
Large multi-image ImageJ tiff file is incorrectly read in as a single plane
| Reported by: | Owned by: | Tom Goddard | |
|---|---|---|---|
| Priority: | moderate | Milestone: | |
| Component: | Volume Data | Version: | |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description (last modified by )
Begin forwarded message:
From: Matthew Akamatsu
Subject: Re: [chimerax-users] Bio-Formats with ChimeraX?
Date: February 7, 2019 at 4:57:24 PM PST
To: Tom Goddard
Cc: chimerax-users@…
Hi Tom,
Thanks very much for your reply. I am interested in helping out however I can (probably with test use cases) as ChimeraX seems like the best hope to handle and render large 4D-5D optical microscopy data (e.g. the flood of data coming from lattice light sheet microscopes). So far I have noticed that if I try to open a TIFF hyperstack larger than ~3GB it opens as a single plane instead, even if I increase the dataCacheSize to 15000-25000 MB on my 32GB RAM machine with a fast SSD drive (reads at 2.5 GB/s). I tried saving the file in other TIF based formats like ome TIFF and have not had any luck. I am happy to try to share an example file, or take any other suggestions you have for other formats I should try to save the movies as before loading them into ChimeraX.
Matt
Change History (4)
comment:1 by , 7 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 7 years ago
Here is the ImageDescription tag of the 5 Gbyte ImageJ TIFF file you gave me
ImageJ header {'ImageJ': '1.52i', 'images': '8400', 'channels': '2', 'slices': '21', 'frames': '200', 'hyperstack': 'true', 'mode': 'composite', 'unit': 'micron', 'finterval': '7.161748886108398', 'spacing': '0.296875', 'loop': 'false', 'min': '98.0', 'max': '137.0'}
It does not have any indication that the data is packed into a single TIFF plane. I couldn't find any clear description online but I am guessing that if the TIFF has one plane, but the ImageDescription says it has multiple planes, then it is assumed the data is packed into a single plane.
comment:3 by , 7 years ago
I made ChimeraX give an error when attempting to open ImageJ TIFF files that have all the 2d planes packed into a single TIFF plane, for the 5 GB example files it says.
ImageJ TIFF has 8400 slices (z = 21, nc = 2, nt = 200) but file as only 1 image. Reader does not currently handle ImageJ packing of large data (> 4 Gbytes) as single plane.
comment:4 by , 7 years ago
| Type: | defect → enhancement |
|---|
Would be nice to read this ImageJ hacked TIFF format but it does not appear to be documented anywhere. The Bioformats documentation description and reading the ImageJ source code could be used to figure it out.
I looked at the 5 Gbyte TIFF file you gave me and it indeed contains a single TIFF plane. It turns out that ImageJ hacks the TIFF format to handle data larger than 4 Gbytes. Instead of a single TIFF plane for each 2D plane of data, it puts all the data into one plane, with custom ImageJ TIFF header tags to tell a custom ImageJ reader how to extract all the actual planes from that single TIFF plane.
Here is an explanation of this hack from the Bioformats documentation
https://docs.openmicroscopy.org/bio-formats/5.9.2/formats/tiff.html
"TIFF files written by ImageJ are also supported, including ImageJ TIFFs larger than 4GB. ImageJ TIFFs are detected based upon the text in the first IFD’s “ImageDescription” tag; this tag’s value is then used to determine Z, C, and T sizes as well as physical sizes and timestamps. For ImageJ TIFFs larger than 4GB, a single IFD is expected (instead of one IFD per image plane). The “ImageDescription” is used to determine the number of images, the pixel data for which are expected to be stored contiguously at the offset indicated in the sole IFD. This differs from standard TIFF and BigTIFF; if the “ImageDescription” tag is missing or invalid, only the first image will be read."
ChimeraX uses the Python Image Library TIFF reader that of course does not have the custom code to extract the data that ImageJ crammed into a single plane. ChimeraX does read some custom ImageJ TIFF headers to know the number of z slices, channels and time points. But it does not have the special code to handle the > 4 Gbyte case where all the data is packed into a single plane.
ChimeraX could be enhanced to read this custom ImageJ use of TIFF.