TIFF file fails to open

Hi,
I tried opening the files using these steps, but it didn’t work. It shows me a script but don’t open an image. Can someone please help me in this?
_Fadeh_Alonzy_OD_Lower__M5_A8_F950nmD_I022_20130424115201.tiff (2.2 MB)

Hi @Fatima123,

thanks for sharing a file allowing to reproduce the issue. I have tested the sample file using various TIFF reading implementations:

  • libtiff’s tiffinfo successfully detects the file a valid TIFF file with a Deflate compression
  • in Fiji, opening with ImageJ TIFF reader or the Bio-Formats importer fails with a java.util.zip.DataFormatExpection: incorrect header check error message
  • the Bio-Formats command-line utility reports the same issue which happens during the decompression of the binary data:
Exception in thread "main" loci.formats.FormatException: java.util.zip.ZipException: incorrect header check
  at ome.codecs.BaseCodec.decompress(BaseCodec.java:199)
  at loci.formats.codec.WrappedCodec.decompress(WrappedCodec.java:86)
  at loci.formats.codec.ZlibCodec.decompress(ZlibCodec.java:48)
  at loci.formats.tiff.TiffCompression.decompress(TiffCompression.java:281)
  at loci.formats.tiff.TiffParser.getTile(TiffParser.java:829)
  at loci.formats.tiff.TiffParser.getSamples(TiffParser.java:1107)
  at loci.formats.tiff.TiffParser.getSamples(TiffParser.java:869)
  at loci.formats.in.MinimalTiffReader.openBytes(MinimalTiffReader.java:312)
  at loci.formats.in.TiffDelegateReader.openBytes(TiffDelegateReader.java:71)
  at loci.formats.FormatReader.openBytes(FormatReader.java:897)
  at loci.formats.ImageReader.openBytes(ImageReader.java:449)
  at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
  at loci.formats.gui.BufferedImageReader.openImage(BufferedImageReader.java:86)
  at loci.formats.tools.ImageInfo.readPixels(ImageInfo.java:821)
  at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1055)
  at loci.formats.tools.ImageInfo.main(ImageInfo.java:1121)
Caused by: java.util.zip.ZipException: incorrect header check
  at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
  at ome.codecs.ZlibCodec.decompress(ZlibCodec.java:81)
  at ome.codecs.BaseCodec.decompress(BaseCodec.java:194)
  ... 15 more
  • tifffile imread() successfully seems to be successful at reading the image

My best suspicion at this stage seems to be an issue while reading a specific case of zlib/Deflate compressed data. More investigation will be required to understand the conditions and at the OME / Bio-Formats level, I will create an issue to track this. @cgohlke might have additional hinsights on

Until this issue is fixed, below are a couple of workarounds to work with your data:

  • if Python is an option for you, tifffile should be able to read and work with your data directly as mentioned above

  • alternatively, if Fiji is part of your workflow, you should also be able to tifffile to convert the original data into a secondary TIFF that can be read by Fiji. As a minimal proof of concept, the following generated a TIFF file of the same size that I could read in Fiji

    >> import tifffile
    >> t = tiffile.imread('xXH2hPU2YFZN6M4w54Xb0kQs6TJ.tiff')
    >> tifffile.imwrite('converted.tiff', t, compression='deflate')
    

The issue is that the data in the file has an uncommon FillOrder of 2 (LSB2MSB), which means the bits in each byte of the strips/tiles have to be ordered in reverse before decompression. Besides that, the DateTime value is in the wrong format.

2 Likes

Thanks @cgohlke for the help with troubleshooting. On the Bio-Formats side, I have opened TiffParser: handle Deflate compressed tiles/strips with lsb2msb order by sbesson · Pull Request #3671 · ome/bioformats · GitHub to try and handle similar TIFF files.

@Fatima123 once fixed, we will add your sample file to our curated QA repository for non-regression testing. Can it be publicly shared under a CC-BY 4.0 license?

Sorry, I couldn’t understand this point. How should I proceed?

Hi,

we just want to know if your file could be shared publicly e.g. alongside the other public TIFF samples at Index of /images/TIFF or whether you would prefer for it to be kept privately.

Thanks. I need to keep it private as this is part of research. Also, I was not able to understand the solution. How can I open this file in image J?

Thanks. I need to keep it private as this is part of research.

That’s not an issue. We’ll keep the file private.

Also, I was not able to understand the solution. How can I open this file in image J?

There is currently no ImageJ solution to the best of my knowledge. We are reviewing a fix in the Bio-Formats plugin (linked above). Once accepted, this fix will be available first in the development Bio-Formats update site and then in the following Bio-Formats release. We can update this thread once it is available.

The other workaround is to convert or re-export your TIFF file in a combination of Compression/FillOrder that is currently read by ImageJ.