Large size tiff does not open using bio-formats

Hello. I’ve been wanting to apply the plugin Trainable Weka Segmentation. I have a satellite image WorldView-2 of 150 gb with 8 spectral bands. I did a subset of that image and I add 30 more bands with spatial metrics data this new image is only 4.3gb. If I try to open the image normally I get simply an error opening the file. When I try to open it via the bio-format plug in, I get the same: Sorry there was a problem during import. In the log shows nothing. Sometimes i get the opener error: File is not in a supported format, a reader plugin is not available, or it was not found. When I was trying yesterday I got this in the log window:

loci.formats.FormatException: loci.common.ReflectException: Cannot execute method: getNumPages
at loci.formats.in.TiffJAIReader.initFile(TiffJAIReader.java:149)
at loci.formats.FormatReader.setId(FormatReader.java:1426)
at loci.formats.DelegateReader.setId(DelegateReader.java:298)
at loci.plugins.in.ImportProcess.initializeFile(ImportProcess.java:505)
at loci.plugins.in.ImportProcess.execute(ImportProcess.java:143)
at loci.plugins.in.Importer.showDialogs(Importer.java:140)
at loci.plugins.in.Importer.run(Importer.java:76)
at loci.plugins.LociImporter.run(LociImporter.java:78)
at ij.IJ.runUserPlugIn(IJ.java:216)
at ij.IJ.runPlugIn(IJ.java:180)
at ij.Executer.runCommand(Executer.java:137)
at ij.Executer.run(Executer.java:66)
at java.lang.Thread.run(Thread.java:745)
Caused by: loci.common.ReflectException: Cannot execute method: getNumPages
at loci.common.ReflectedUniverse.exec(ReflectedUniverse.java:316)
at loci.formats.in.TiffJAIReader.initFile(TiffJAIReader.java:146)
... 12 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at loci.common.ReflectedUniverse.exec(ReflectedUniverse.java:311)
... 13 more
Caused by: java.io.IOException: Bad magic number, should be 42.
at com.sun.media.jai.codecimpl.CodecUtils.toIOException(CodecUtils.java:76)
at com.sun.media.jai.codecimpl.TIFFImageDecoder.getNumPages(TIFFImageDecoder.java:98)
... 18 more
Caused by: java.lang.IllegalArgumentException: Bad magic number, should be 42.
at com.sun.media.jai.codec.TIFFDirectory.getNumDirectories(TIFFDirectory.java:601)
at com.sun.media.jai.codecimpl.TIFFImageDecoder.getNumPages(TIFFImageDecoder.java:96)
... 18 more

But I’m not getting that today. I try with different tiff files and I don’t have any trouble.

I hope you can help me. Thanks in advance.

This indicates the TIFF file is invalid.

There was a related thread on the ome-users mailing list a while back. I do not know whether @melissa’s exact instructions will fix your particular TIFF file, but might be worth a try (save a backup copy first!).

If you still have trouble, and you can post the broken TIFF file somewhere, perhaps someone in the community here can recommend how to fix your specific file.

Ok, I did it but now I get different errors.
File is not in a supported format, a reader plugin is not available, or it was not found. at ij.Executer.run(Executer.java:66)
and another one at java.lang.Thread.run(Thread.java:745).

    java.lang.IllegalArgumentException: Negative position
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:717)
at loci.common.NIOByteBufferProvider.allocateDirect(NIOByteBufferProvider.java:127)
at loci.common.NIOByteBufferProvider.allocate(NIOByteBufferProvider.java:112)
at loci.common.NIOFileHandle.buffer(NIOFileHandle.java:602)
at loci.common.NIOFileHandle.seek(NIOFileHandle.java:293)
at loci.common.RandomAccessInputStream.seek(RandomAccessInputStream.java:174)
at loci.formats.tiff.TiffParser.getIFD(TiffParser.java:437)
at loci.formats.tiff.TiffParser.getFirstIFD(TiffParser.java:324)
at loci.formats.in.SEQReader.isThisType(SEQReader.java:73)
at loci.formats.FormatReader.isThisType(FormatReader.java:649)
at loci.formats.ImageReader.getReader(ImageReader.java:181)
at loci.plugins.in.ImportProcess.createBaseReader(ImportProcess.java:630)
at loci.plugins.in.ImportProcess.initializeReader(ImportProcess.java:486)
at loci.plugins.in.ImportProcess.execute(ImportProcess.java:139)
at loci.plugins.in.Importer.showDialogs(Importer.java:140)
at loci.plugins.in.Importer.run(Importer.java:76)
at loci.plugins.LociImporter.run(LociImporter.java:78)
at ij.IJ.runUserPlugIn(IJ.java:216)
at ij.IJ.runPlugIn(IJ.java:180)
at ij.Executer.runCommand(Executer.java:137)
at ij.Executer.run(Executer.java:66)
at java.lang.Thread.run(Thread.java:745)

I used 010 editor for the hex thingy.

What I found out it’s that if I open the tiff with only the spatial metrics (27 bands) it works, also if I only open the worldview image (8 bands) it works too. But when I do a layer stack of both then I can’t open it.

It really sounds like your TIFF is corrupt. You could try analyzing it with the TIFF command line tools tiffdump and tiffinfo. If you want an expert to analyze your TIFF file for you, you would have to post it somewhere. And just a warning in advance: I personally do not have time to dig into it right now. But maybe someone on the OME team does if you email them and ask nicely. :slight_smile: