Code covered by the BSD License  

Highlights from
TIFFStack

5.0

5.0 | 1 rating Rate this file 27 Downloads (last 30 days) File Size: 13 KB File ID: #32025
image thumbnail

TIFFStack

by Dylan Muir

 

01 Jul 2011 (Updated 07 Nov 2011)

Access a TIFF stack as a memory-mapped tensor. Handles a large range of internal TIFF formats.

| Watch this File

File Information
Description

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 uses a modified version of tiffread [1, 2] to read data. Code is included (but disabled) to use the matlab imread function, but this function returns invalid data for some TIFF formats.

Construction:
>> 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
tsStack =
  TIFFStack handle
  Properties:
         bInvert: 0
     strFilename: [1x9 char]
      sImageInfo: [5x1 struct]
    strDataClass: 'uint16'

Usage:
>> 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)

ans =
   128 128 5 1

>> tsStack(4); % Linear indexing is supported
>> tsStack.bInvert = true; % Turn on data inversion

References:
[1] Francois Nedelec, Thomas Surrey and A.C. Maggs. Physical Review Letters 86: 3192-3195; 2001. DOI: 10.1103/PhysRevLett.86.3192
[2] http://www.cytosim.org/misc/
 

Acknowledgements

Tiffread2.M inspired this file.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
class, data import, image manipulation, image processing, images, large tensor, object oriented, oop, tif, tiff
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
24 Jul 2011 Federico

Best way, to my knowledge, to work with TIFF stacks on Matlab. Recommended.

Updates
24 Jul 2011

Fixed a bug when indexing non-square TIFF files.

27 Jul 2011

Fixed a bug when referencing slice 58 of a stack.

16 Aug 2011

Updated screenshot

30 Sep 2011

Updated link to Francois Nedelec

07 Nov 2011

Updated description

Contact us