ome / bioformats

Bio-Formats is a Java library for reading and writing data in life sciences image file formats. It is developed by the Open Microscopy Environment. Bio-Formats is released under the GNU General Public License (GPL); commercial licenses are available from Glencoe Software.
https://www.openmicroscopy.org/bio-formats
GNU General Public License v2.0
381 stars 241 forks source link

bfconvert: PyramidOMETiffWriter failed to close with no flat and output pattern #3907

Open dgault opened 2 years ago

dgault commented 2 years ago

Issue was raised on forum thread https://forum.image.sc/t/how-to-split-and-recombine-multiple-series-with-bfconvert/73662/2

In the thread the user had a multi resolution file (SCN format) with additional macro and label images and wanted only the image pyramid as an OME-TIFF. One of the attempts to achieve this was to use the noflat option with bfconvert and split the output into separate series using a pattern in the output as below:

bfconvert -noflat <original-file.scn> <output%%s.ome.tiff>

The conversion almost completed but threw an ArrayIndexOutOfBoundsException while closing the PyramidOMETiffWriter:

ImageCollection.scn
LeicaSCNReader initializing ImageCollection.scn
Reading IFDs
Populating metadata
Populating OME metadata
[Leica SCN] -> Series\Image_bigseries%s.ome.tiff [OME-TIFF]
Switching to BigTIFF (by file size)
        Series 0: converted 1/1 planes (100%)
        Series 0: converted 1/1 planes (100%)
        Series 0: converted 1/1 planes (100%)
Tile size = 512 x 512
        Series 1: converted 1/1 planes (100%)
Tile size = 512 x 512
        Series 1: converted 1/1 planes (100%)
Tile size = 512 x 512
        Series 1: converted 1/1 planes (100%)
        Series 1: converted 1/1 planes (100%)
        Series 1: converted 1/1 planes (100%)
        Series 1: converted 1/1 planes (100%)
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 6
        at loci.formats.out.PyramidOMETiffWriter.close(PyramidOMETiffWriter.java:128)
        at loci.formats.ImageWriter.close(ImageWriter.java:469)
        at loci.formats.tools.ImageConverter.testConvert(ImageConverter.java:777)
        at loci.formats.tools.ImageConverter.main(ImageConverter.java:1179)
imagesc-bot commented 2 years ago

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/how-to-split-and-recombine-multiple-series-with-bfconvert/73662/9

melissalinkert commented 2 months ago

https://github.com/ome/bioformats/issues/4204#issuecomment-2339470615 describes another way to reproduce this problem outside of bfconvert.