DylanMuir/TIFFStack

Resolved: Issue reading non-square ImageJ BigStacks

DylanMuir opened this issue · 6 comments

(Copied from file exchange)

Hi,

I am running into a problem with TiffStack specifically when I try to load >4GB uint16 tiff stacks that have been saved in imageJ (ie 'big stacks' dealt with by the 'OpenImageJBigStack' functionality).

After TiffStack is done running on these faulty-headed tiff files (successfully calling MappedTensor), when I plot frames from the resultant tsStack object, for example using imagesc(tsStack(:,:,1)), the image appears circularly shifted along the 1st dimension, as Avinash mentioned in the comments section of your MappedTensor function on FileExchange. Unfortunately, the fix mentioned in your response doesn't work for me (I'm assuming the output of >4GB ImageJ tiff stacks that display the error re: headers are binarized, as mentioned elsewhere).

All is working for tiff stacks saved in imageJ that are smaller than this limit.

Any help re: how to trouble shoot would be fantastic - as this function for my smaller files is a life-savor for setting up efficient parallel processing.

Thanks!
Rachel

Please let me know the exact dimensions of your stack, if possible. Also let me know what version of ImageJ you have, and please check you are using the latest versions of TIFFStack and MappedTensor.

I have just fixed a bug in TIFFStack where the number of frames, channels, slices would be set incorrectly, since ImageJ doesn't write these values out if they are equal to 1. Please check to see if that fixes your issue.

Hi Dylan,

Thanks so much for the speedy reply. The stack has dimensions 512 x 672 x 9000 (rows,col,time).; ImageJ v1.49 ; just updated to latest version of TIFFStack and MappedTensor. Unfortunately, still running into the same problem. When I save the file in imageJ, I get the following info if I want to open the file as 'raw':
name=Untitled, dir=, width=672, height=512, nImages=9000, offset=304092, type=ushort, byteOrder=big, format=0, url=, whiteIsZero=f, lutSize=0, comp=1, ranges=null, samples=1

I've attached two .png files - the first is what the first frame should look like (:,:,1), the second is what the first frame of the TIFFobject in MATLAB looks like:

image

image

@raswanson Thanks for getting back to me. The issue was in constructing the MappedTensor to read the stack — the first two dimensions were incorrectly assigned, leading the image to be incorrectly shaped. I've just committed a fix; please check that everything looks good for you now, and reopen this issue if there are still problems.

Thanks for your help in fixing the bug!

Hi Dylan,

Your TiffStack function is working almost perfectly post the fix above - just one final problem I'd hugely appreciate help with!

TiffStack successfully loads tiff stacks > 4 GB and I can access this data via indexing into the created object, however when I access a single slice of the data (tiffstack(:,:,1)), the following warning prints 5 times:

Warning: TIFF library warning - 'TIFFReadDirectory: Unknown field with tag 65329 (0xff31) encountered.'

In TIFFStack>TS_set_directory (line 1550)
In TIFFStack>TS_read_data_Tiff (line 1245)
In TIFFStack/subsref (line 679)
In GridSmooth (line 57)


Because this prints for every slice along the z dimension (regardless of the number of pixels accessed within that frame), when I try to access large portions of the data it takes an unworkably long amount of time.

Again, any help is much appreciated!