[ome-users] Bio-formats - Bug when recycling TiffDelegateReader
Sebastien Besson (Staff)
s.besson at dundee.ac.uk
Wed Apr 12 10:54:55 BST 2017
Hi Stephane,
> On 11 Apr 2017, at 16:57, Stephane Dallongeville <stephane.dallongeville at pasteur.fr> wrote:
>
> Hi,
>
> I observed a weird behavior when i try to re-use a reader, specifically the TiffDelegateReader here.
> If i try to open the attached "rotated.tif" file with a brand new TiffDelegateReader it open correctly (metadata are properly populated, with correct number of Z plane) but if i "recycle" the reader to open it, the metadata are not correctly populated (Z planes are set in T dimension).
Many thanks for sharing images and code allowing to reproduce your issue. I can confirm the
behavior you are reporting.
> We can reproduce the issue with this code :
>
> <<
> ImageReader mainReader = new ImageReader();
> mainReader.setAllowOpenFiles(true);
>
> // get appropriate reader for first image (TiffDelegateReader normally)
> IFormatReader reader = new mainReader.getReader("3dtestbigger.tif");
>
> // prepare meta data store structure & open '3dtestbigger.tif' file
> reader.setMetadataStore(new OMEXMLMetadataImpl());
> reader.setId("3dtestbigger.tif");
>
> // do whatever you need to
> ...
>
> // close reader as we are done with '3dtestbigger.tif'
> reader.close();
>
> // prepare meta data store structure & open 'rotated.tif' file
> reader.setMetadataStore(new OMEXMLMetadataImpl());
> reader.setId("rotated.tif");
>
> // metadata are not properly populated !
> >>
Looking at the data, I think the issue is a related to the unwrapping of the ImageReader using the
getReader() 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.
> In Icy we try to avoid creating a new reader each time and recycle them when possible to speed up the loading processing so this issue can be problematic.
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.
Best,
Sebastien
>
> 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/
>
> <rotated.tif><3dtestbigger.tif>_______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
The University of Dundee is a registered Scottish Charity, No: SC015096
More information about the ome-users
mailing list