java.lang.ArrayIndexOutOfBoundsException: 4096 when opening TIFF file (imagej beginner)

Hello!
For my dissertation I’m doing confocal fluorescence imaging and have lots of TIFF files by now.

The problem: All images I have are made out of 9 tiles stitched to 1 large image (I have both the single tiles and the large image saved). When I try to open the images, ImageJ gives the “java.lang.ArrayIndexOutOfBoundsException: 4096” error. Weirdly, this is only true for around half of my TIFF files, the other half is opened without a problem. All the images were made with the exact same settings, and sometimes there are images that can and cannot be opened that were made in the same session. I don’t think the files are corrupted: I can view them in NIS-Elements Viewer.

Sorry if this is a very basic question. I’m pretty new to this and was also looking in the old questions asked: Many had OutOfBounds exceptions, but none of them had the exception when opening a file.

I would appreciate any help I can get! Thanks :slight_smile:

Please post an example TIFF file that causes this exception.

1 Like

tile_x002_y002.tif (8.1 MB)
tile_x002_y002_3channels.tif (12.0 MB)

Here I uploaded the single tiles of a 3-channel and a 2-channel TIFF respectively. The large images are too large, so I uploaded them on my Google-Drive if that is okay.

Here is the link to those:

Thank you for the quick response!

1 Like

The ImageJ 1.53h2 daily build opens the two files you posted. I was not able to download the large images on Google-Drive.

1 Like

I just upgraded to the daily build - It does seem to fix the issue with the small tiles! Thanks a lot for this.

The 3channel large image is still a problem though. Does this link work?

Alternatively, is there another platform where I can provide the large image?

All the files contain invalid LZW encoded strips. Many software ignore/zero bad strips, but it’s probably better for scientific software to raise errors.

$ tiffinfo -D confocal_exampleimage_2channels.tif
<snip>
LZWDecode: Warning, LZWDecode: Strip 409 not terminated with EOI code.
LZWDecode: Not enough data at scanline 409 (short 691 bytes).

$ tiffinfo -D confocal_exampleimage_3channels.tif
<snip>
LZWDecode: Warning, LZWDecode: Strip 293 not terminated with EOI code.
LZWDecode: Not enough data at scanline 293 (short 3360 bytes).

$ tiffinfo -D tile_x002_y002.tif
<snip>
LZWDecode: Warning, LZWDecode: Strip 742 not terminated with EOI code.
LZWDecode: Not enough data at scanline 1484 (short 322 bytes).

$ tiffinfo -D tile_x002_y002_3channels.tif
<snip>
LZWDecode: Warning, LZWDecode: Strip 772 not terminated with EOI code.
LZWDecode: Not enough data at scanline 1544 (short 2443 bytes).
2 Likes

I understand.

Is there a way to make ImageJ bypass the exception and still open the large files?

I analyse my pictures with the Coloc2 Plugin - Does the plugin ignore the strips or does it produce “false data”?

The ImageJ 1.5h3 daily build opens confocal_exampleimage_3channels.tif.

2 Likes