[ome-users] Bio-formats - Bug when recycling TiffDelegateReader
Stephane Dallongeville
stephane.dallongeville at pasteur.fr
Wed Apr 12 11:17:01 BST 2017
Hi Sebastien,
Thanks for taking the time to investigate the question !
> Looking at the data, I think the issue is a related to the unwrapping
of the ImageReader using thegetReader() API
> while the two files are actually different formats from the
Bio-Formats standpoint:
> - 3dtestbigger.tif is a TIFF file generated by ImageJ. As you
mentioned, the ImageReader will delegate to
> the TiffDelegateReader and parse the image dimensions from the
content of the ImageDescription tag (`slices=40`)
> - rotated.tif is a TIFF file with an OME-XML string in its
ImageDescription tag. An ImageReader will detect
> such a file as an OME-TIFF and read its dimensions using the OME
metadata.
> The TiffReader will also read this file but detect it a regular
multi-page TIFF and aggregate all the planes alongside the T dimension.
> ....
> All understood. As mentioned above, the code snippet above also
includes the assumption that the initial format
> reader can be used for all the files. I assume this might be a
constraint in addition to the reader recycling.
> Otherwise, it should be possible to recycle the generic ImageReader.
Ok, i totally understand, i though file where both generated by ImageJ
so i used that example but in fact my code snippet was incomplete (to
make it simpler), what we really do is we first check if we can re-use
the reader by using this code in between file opening :
if (!reader.isThisType(path, false) && !reader.isThisType(path, true))
reader = mainReader.getReader(path);
As you can see we first want to check without opening the file (again
because it's faster) and i though it was the issue as the reader
probably used the file extension to assume it can open it properly so i
changed the code to
if (!reader.isThisType(path, true))
reader = mainReader.getReader(path);
But the result is the same, the TiffDelegateReader return 'true' for
reader.isThisType('rotated.tif', true).
Looking at the mainReader.getReader(path) implementation it uses the
same method internally to determine which reader to return.
The only difference is that mainReader (ImageReader) is always scanning
readers from its list instead of trying to recycle the last used one...
that means that OME Tiff Reader probably appears before in the list than
TiffDelegateReader ending to that difference.
Best,
--
Stephane Dallongeville
Unité d'Analyse d'Images Biologiques
CNRS UMR 3691
Institut Pasteur
25 rue du Dr. Roux
75724 Paris cedex 15 (FRANCE)
Tel: +33 (0)1 45 68 87 01
Fax: +33 (0)1 40 61 33 30
http://www.bioimageanalysis.org/
More information about the ome-users
mailing list