bigdataprocessor / bigdataprocessor2

BSD 2-Clause "Simplified" License
20 stars 4 forks source link

Trouble reading LZW compressed TIFF #31

Open ASHISRAVINDRAN opened 5 years ago

ASHISRAVINDRAN commented 5 years ago

Hi Tischi, BigDataProcessor is unable to properly read LZW compressed tiff files.

  1. I was trying to push our plugin at my lab here, in order to deal with tiff datasets only to find that it fails to open LZW compressed tiffs. Here is the calibrated tiff file which I tried to open using BDP: https://drive.google.com/file/d/1kN_TMJHcyAyQOCegBWVAzJclo2aGZEOv/view?usp=sharing (This tiff opens fine in ImageJ) Initial debugging shows that error is in OpenerExtension.java at https://github.com/tischi/fiji-plugin-bigDataProcessor2/blob/cc0e87c13238adbdbc6e2207a79d48b138e9972e/src/main/java/de/embl/cba/bdp2/OpenerExtension.java#L1066 where the readStart+ readLength value becomes more than the RandomAccessFile length for some z and file data is not read anymore.

  2. I also tried to re-save a normal tiff using LZW compression and attemped to load it back. It seems the z slices are not read at all. But there is no error at the above mention line of code.

I am on it but OpenerExtension and related TIFF reading logics are mostly a black box for me. Can you too dig in for a faster fix?

ASHISRAVINDRAN commented 5 years ago

Detailed analysis of the issue(s) revealed 3 hidden issues within the TIFF save code.

Luckily the fix for all these are the same: call Utils.wrapToCalibratedImagePlus method. :) So, these bugs are fixed now.

Note that the real issue of LZW Tiff (from my lab/working group) loading error is still open. This tiff opens fine in ImageJ(FIJI) directly but not in BDP.