DylanMuir/TIFFStack
See also http://dylan-muir.com/articles/tiffstack/
If this code is useful to your academic work, please cite the publication in lieu of thanks:
Muir and Kampa, "FocusStack and StimServer: A new open source MATLAB toolchain for visual stimulation and analysis of two-photon calcium neuronal imaging data". Frontiers in Neuroinformatics 2015.
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.
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
Support for de-interleaving of channels and slices into the frame axis is also supported (see help text for TIFFStack).
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/
引用格式
Dylan Muir (2024). DylanMuir/TIFFStack (https://github.com/DylanMuir/TIFFStack), GitHub. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!private
无法下载基于 GitHub 默认分支的版本
版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.23.0.0 | TIFFStack now supports opening very long stacks with more than 2^16 frames
|
|
|
1.22.0.0 | Updated description
|
|
|
1.21.0.0 | Reinstated description
|
|
|
1.20.0.0 | Moved TIFFStack to github hosting |
|
|
1.19.0.0 | Fixed a regression when referencing object properties |
|
|
1.18.0.0 | Improved referencing for edge cases. |
|
|
1.17.0.0 | Improved referencing to make it more similar to matlab tensors. Fixed a referencing bug involving a confusion between "58" and ":". |
|
|
1.16.0.0 | Fixed a bug when using TIFFStack to load an entire stack, with ts(:); |
|
|
1.15.0.0 | Updated usage notes |
||
1.14.0.0 | Improved efficiency of linear indexing. Removed code to call imread, which was unused in any case. |
|
|
1.13.0.0 | Added paper reference. |
|
|
1.12.0.0 | Fixed a bug where tiffflib would fail to read tiled images correctly. |
|
|
1.11.0.0 | Fixed bugs where tifflib would cause a crash when TIFFStack was not called with a valid filename. |
|
|
1.10.0.0 | Fixed a bug in indexing into an image file |
|
|
1.9.0.0 | Updated description |
||
1.8.0.0 | Updated description |
||
1.7.0.0 | Updated description |
||
1.6.0.0 | Dramatic acceleration by using tifflib when possible. Added support for permute and transpose. |
||
1.5.0.0 | Updated description |
||
1.4.0.0 | Updated link to Francois Nedelec |
||
1.3.0.0 | Updated screenshot |
||
1.2.0.0 | Fixed a bug when referencing slice 58 of a stack. |
||
1.1.0.0 | Fixed a bug when indexing non-square TIFF files. |
||
1.0.0.0 |