See also http://dylan-muir.com/articles/tiffstack/
Usage: tsStack = TIFFStack(strFilename <, bInvert>)
A TIFFStack object behaves like a read-only memory mapped TIF file. The entire image stack is treated as a matlab tensor. Each frame of the file must have the same dimensions. Reading the image data is optimised to the extent possible; the header information is only read once.
This class attempts to use the version of tifflib built-in to recent versions of Matlab, if available. Otherwise this class uses a modified version of tiffread [1, 2] to read data. Code is included (but disabled) to use the matlab imread function, but imread returns invalid data for some TIFF formats.
permute, ipermute and transpose are now transparantly supported. Note that to read a pixel, the entire frame containing that pixel is read. So reading a Z-slice of the stack will read in the entire stack.
>> tsStack = TIFFStack('test.tiff'); % Construct a TIFF stack associated with a file
>> tsStack = TIFFStack('test.tiff', true); % Indicate that the image data should be inverted
strFilename: [1x9 char]
sImageInfo: [5x1 struct]
>> tsStack(:, :, 3); % Retrieve the 3rd frame of the stack, all planes
>> tsStack(:, :, 1, 3); % Retrieve the 3rd plane of the 1st frame
>> size(tsStack) % Find the size of the stack (rows, cols, frames, planes per pixel)
128 128 5 1
>> tsStack(4); % Linear indexing is supported
>> tsStack.bInvert = true; % Turn on data inversion
 Francois Nedelec, Thomas Surrey and A.C. Maggs. Physical Review Letters 86: 3192-3195; 2001. DOI: 10.1103/PhysRevLett.86.3192