File Exchange

image thumbnail

imread_big -- read in TIFF stacks larger than 4GB

version 1.2.1 (1.83 KB) by Tristan Ursell
Load any size TIFF stack, even those larger than 4GB.

11 Downloads

Updated 23 May 2019

View License

Tristan Ursell
Read large image stack (TIFF)
May 2019

This function can load image stacks larger than 4GB which is the typical limitation on image files. Designed to work with single-channel uncompressed TIFF stacks. Also works for files smaller than 4GB.

[stack_out,Nframes]= imread_big(stack_name);
[stack_out,Nframes]= imread_big(stack_name,[i j]);

stack_name = the path and file name to the image stack

[i j] = optional frame number range to load (i = j is allowed)

Nframes = number of frames as determined by total file size divided by estimated size of each frame data block

stack_out = the output image stack of size [M x N x Nframes], where M x N is the size of each image.

Cite As

Tristan Ursell (2019). imread_big -- read in TIFF stacks larger than 4GB (https://www.mathworks.com/matlabcentral/fileexchange/61376-imread_big-read-in-tiff-stacks-larger-than-4gb), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Hi Nicolas -- sorry it's not working ... I would first try the uint16 solution, it's essentially guaranteed to work, but you can also try the very latest change I made (today) ... again, it's hard to de-bug at a distance like this, but if you're game, try it out. I was a bad experimentalist, and I changed two things about the code in the penultimate update, and now changed one thing back, which I think should fix the issue that threw an error most recently.

fingers crossed.

Hi Tristan, thank you for your update, unfortunately it is still not functionning and gives the following error :

Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first
matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use
'.*'.

I tried using '.*' without more success.

I will try to work on it and let you know if I find a solution with your code.

Also, I will consider generating uint16 instead of uint32 as you suggested.

Thank you again,

Nicolas

Re Nicolas: I just updated it to handle uint32 ... let me know if that works. Also, very rarely is there a benefit to using uint32 over uint16 for images ... so you could also just use FIJI to downsample to uint16 with very little loss of information (and then the file size would be small enough to process normally, i.e. with 'imread').

Hello Tristan, first of all, thank you for this very useful tool !

I am actually facing an issue with a 6.26Go (1080 x1080x1440) uint32 Tiff file.

I get the following error message when running imread_big :

Matrix dimensions must agree.
Error in imread_big (line 44)
start_point = stripOffset(1) + (0:1:(Nframes-1)).*stripByteCounts;

When I check the "info1" structure both "stripOffsets" and "stripByteCounts" are 1x540 double for the 1440 entries
ByteOrder is 'little-endian'.

Do you have a clue of what I am doing wrong or what is wrong with my files ?
Thank you for your help,
Nicolas.

hamutoro

NCramer

Updates

1.2.1

bug fix

1.2

none

1.1

includes support for uint32 images

1.0.0.0

fixed minor bug

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux