NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 151 - Opening certain tif files throws exception, while opening via LOCI succeeds
Opening certain tif files throws exception, while opening via LOCI succeeds
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Other
unspecified
Macintosh Mac OS
: P2 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2010-03-10 18:30 CST by Jan Eglinger
Modified: 2010-03-13 20:51 CST
0 users

See Also:


Attachments
16-bit grayscale image written by QuantityOne (BioRad), that fails to open (710.29 KB, image/tiff)
2010-03-10 18:32 CST, Jan Eglinger
JPEG-view of the example file opened after running the Fiji updater (20.34 KB, image/jpeg)
2010-03-11 14:10 CST, Jan Eglinger
Another non-working TIFF. (2.52 MB, application/octet-stream)
2010-03-12 13:56 CST, Johannes Schindelin

Description Jan Eglinger 2010-03-10 18:30:41 CST
Some tif files (written by BioRad Quantity One) throw the following exception when opened via "File>Open" or by drag&drop:

java.lang.ArrayIndexOutOfBoundsException: -2105507200
	at ij.io.ImageReader.readCompressed16bitImage(ImageReader.java:175)
	at ij.io.ImageReader.read16bitImage(ImageReader.java:100)
	at ij.io.ImageReader.readPixels(ImageReader.java:700)
	at ij.io.FileOpener.readPixels(FileOpener.java:525)
	at ij.io.FileOpener.open(FileOpener.java:76)
	at ij.io.Opener.openTiff2(Opener.java:814)
	at ij.io.Opener.openTiff(Opener.java:690)
	at ij.io.Opener.openImage(Opener.java:249)
	at ij.io.Opener.openImage(Opener.java:308)
	at ij.io.Opener.open(Opener.java:142)
	at ij.io.Opener.openAndAddToRecent(Opener.java:228)
	at ij.plugin.DragAndDrop.openFile(DragAndDrop.java:178)
	at ij.plugin.DragAndDrop.run(DragAndDrop.java:154)
	at java.lang.Thread.run(Thread.java:637)

Opening via "Plugins>LOCI>Bio-Formats Importer" succeeds.
Please try with the file I'll attach...

jan
Comment 1 Jan Eglinger 2010-03-10 18:32:01 CST
Created attachment 12
16-bit grayscale image written by QuantityOne (BioRad), that fails to open
Comment 2 Wayne Rasband 2010-03-11 06:02:26 CST
The sample tiff has invalid StripByteCount values of 91227504, which cause the exception. ImageJ 1.43s4 works around this by using RowsPerStrip*ImageWidth*BytesPerPixel instead of StripByteCount if StripByteCount is larger than the number of bytes in the image.

-wayne
Comment 3 Johannes Schindelin 2010-03-11 13:47:50 CST
I backported the fix, and uploaded jars/ij.jar. Thank you, Wayne!
Comment 4 Jan Eglinger 2010-03-11 14:10:39 CST
Created attachment 13
JPEG-view of the example file opened after running the Fiji updater

Thank you Wayne and Johannes.
However, now I noticed that the image is corrupted when opened via drag and drop: pixel rows y = 308 to 342 are somehow shifted by 256 pixels to the right, lower rows are shifted as well. See attached JPEG for a view how it looks (after auto-contrast).
(Opening via Bio-Formats Importer still works as expected.)

jan
Comment 5 Wayne Rasband 2010-03-11 16:25:48 CST
This is fixed in ImageJ 1.43s5. It was a bug in ImageJ's TiffDecoder. It was reading the StripByteCount values as ints but they are shorts in the sample BioRad Quantity One TIFF.
Comment 6 Johannes Schindelin 2010-03-12 13:54:47 CST
I backported that patch, too, and uploaded ij.jar (actually already yesterday). However, I have another test image which I will attach in a minute, which does not open correctly with ImageJ's TIFF reader, but with Bio-Formats.
Comment 7 Johannes Schindelin 2010-03-12 13:56:46 CST
Created attachment 14
Another non-working TIFF.
Comment 8 Wayne Rasband 2010-03-13 04:36:43 CST
The ImageJ 1.43s7 daily build correctly opens Johannes' non-working TIFF, which is a 16-bit image compressed using PackBits.
Comment 9 Johannes Schindelin 2010-03-13 20:51:38 CST
Thanks Wayne! It works perfectly, so I uploaded new version of jars/ij.jar including your fix.