Handle multipage TIFF files
Closed this issue · 1 comments
This might require some rearchitecting of loadtiff
. Inside the OME-XML, the TiffData
node has a UUID
node that contains the UUID
of the file in which the IFD that it corresponds to is located. I'll have to build a mapping of dimension indices (e.g. XYZCT indices) to files to offsets instead of the current XYZCT => offsets. It looks as though the Filename
attribute isn't guaranteed to be there so I shouldn't rely on that. That said,
The FileName attribute of the UUID is optional, but strongly recommended—otherwise, the OME-TIFF reader must scan OME-TIFF files in the working directory looking for matching UUID signatures.
https://www-legacy.openmicroscopy.org/site/support/ome-model/ome-tiff/specification.html#multi-file-ome-tiff
So it might be best to use FileName
in the first version and then eventually writing a backup routine in case the filename attributes are missing.
So the process might be as follows:
- Load file, scan magic bytes, and read the first ifd
- Parse OME-XML in ImageDescription and build a ZCT index -> filename -> intrafile offset mapping
- Finish reading IFDs in first file and filling in the offsets into the structure above
- Close first file and load next file and fill out the above mapping further. Repeat as many times as necessary.
- Iterate over the ZCT mapping and open each file in order and read their data using the offset information
- Construct and return the high dimensional array built from data