Skip to content

Commit 95b726b

Browse files
committed
Squashed '@TIFFStack/' changes from 90dffa4..9e73c53
9e73c53 * Added a flag to force `TIFFStack` to use slower `tiffread` library, if desired * Fixed a bug where linear indexing would not be range checked as early as possible * Fixed a bug in `tiffread` support * Improved unit testing to only require a [3x3x3] stack * Added unit tests for empty subreferences * Added unit tests for slower `tiffread` library support cc5539f Documentation fix. Added `.gitignore` to repository f77a0d4 Merge pull request #3 from jennan/pr/2 4768eea Fixed bug with deinterleaving + permutation + slicing 6ddc0d9 Added documentation regarding the de-interleaving functionality. 2ae0dd5 * Renamed de-interleaving argument * Improved parameter checking for de-interleaving argument * Re-allowed de-interleaving argument to leave off final frames, similar to `reshape` f011b6f Bugfixes and improvements related to de-interleaving e692bef Merge branch 'master' into pr/2 a32b839 Unit test now includes logical indexing 7a8a065 Merge branch 'master' into pr/2 356d33a * Added a unit testing function for `TIFFStack` * Added property accessor methods to `TIFFStack`, since otherwise properties were inaccessible * Fixed a bug when referencing inverted stacks with multiple samples per pixel * Fixed a referencing bug, where out of range subscripts would not raise an error, if fewer dimensions than the total were referenced * Modified an error identifier 36ad2ad Add special case with colon indexing of reinterpreted frame dimension 69e1360 Fix consistency in error style (CamelCase) 3251086 Move deinterleaving in the constructor, fixed for a TIFFStack db994c7 Add deinterleaving method to reinterpret the frame dim as several dims 65c1a85 Fixed a referencing bug in `TIFFStack` 7362e2c Speed improvements to `TIFFStack` 92e4244 Fixed bugs relating to data returned by linear indexing having a different shape to the index vector. 1742646 Fixed a bug in `TIFFStack`, when referencing a stack with trailing dimensions of `1` ce7e820 * `TIFFStack` can now read an entire stack in an accelerated fashion, with any number of referencing dimensions a6abdfe Fixed a bug in `TIFFStack`, which caused a warning "Closing open TIFF file handle..." when clearing variables. 07bd9d5 Fixed a bug in `TIFFStack` on older systems, where referencing frame 1 of the stack would fail. 6504550 Made `fhCastFunction` a private `TIFFStack` property 13fa2f9 Added information to `TIFFStack` about disabling `tifflib` warnings. e940e75 Fixed a bug in `TIFFStack`, where if the stack data class was an integer type, then stack data inversion would fail with an error. ae27a64 `TIFFStack` now supports logical indexing. git-subtree-dir: @tiffstack git-subtree-split: 9e73c533a09782ad7f103157e02a0f5b40120806
1 parent c18f886 commit 95b726b

File tree

5 files changed

+584
-84
lines changed

5 files changed

+584
-84
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
private/mapped_tensor_repsum.mexmaci64
2+
private/tifflib.mexmaci64

README.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ directory — not the *@TIFFStack* directory — to the [Matlab] path.
3232
tsStack = TIFFStack(strFilename <, bInvert>)
3333

3434
A `TIFFStack` object behaves like a read-only memory mapped TIFF file.
35-
The entire image stack is treated as a matlab tensor. Each frame of the
35+
The entire image stack is treated as a Matlab tensor. Each frame of the
3636
file must have the same dimensions. Reading the image data is optimised
3737
to the extent possible; the header information is only read once.
3838

39-
This class attempts to use the Matlab tifflib interface, if available.
39+
This class attempts to use the Matlab libTiff interface, if available.
4040
If not, it uses a modified version of `tiffread` \[1, 2\] to read data.
41-
Code is included (but disabled) to use the matlab imread function, but
41+
Code is included (but disabled) to use the matlab `imread` function, but
4242
this function returns invalid data for some TIFF formats.
4343

4444
## Construction of a `TIFFStack` object
@@ -66,6 +66,55 @@ this function returns invalid data for some TIFF formats.
6666
>> tsStack(4); % Linear indexing is supported
6767
>> tsStack.bInvert = true; % Turn on data inversion
6868

69+
## Stacks with interleaved frame, channel and slice dimensions
70+
71+
Some TIFF generation software stores multiple samples per pixel as
72+
interleaved frames in a TIFF file. Other complex stacks may include
73+
multiple different images per frame of time (e.g. multiple cameras or
74+
different imaged locations per frame). `TIFFStack` allows these files to be
75+
de-interleaved, such that each conceptual data dimension has its own
76+
referencing dimension within Matlab.
77+
78+
This functionality uses the optional `vnInterleavedFrameDims` argument.
79+
This is a vector of dimensions that were interleaved into the single
80+
frame dimension in the stack.
81+
82+
For example, a stack contains 2 channels of data per pixel, and 3 imaged
83+
locations per frame, all interleaved into the TIFF frame dimension. The
84+
stack contains 10 conceptual frames, and each frame contains 5x5 pixels.
85+
86+
The stack is therefore conceptually of dimensions [5 5 2 3 10 1], but
87+
appears on disk with dimensions [5 5 60 1]. (The final dimension
88+
corresponds to the samples-per-pixel dimension of the TIFF file).
89+
90+
```
91+
>> tsStack = TIFFStack('file.tif', [], [2 3 10]);
92+
>> size(tsStack)
93+
94+
ans =
95+
5 5 2 3 10
96+
```
97+
98+
99+
Permutation and indexing now works seamlessly on this stack, with each
100+
conceptual dimension de-interleaved.
101+
102+
If desired, the final number of frames can be left off
103+
`vnInterleavedFrameDims`; for example
104+
105+
```
106+
>> tsStack = TIFFStack('file.tif', [], [2 3]);
107+
>> size(tsStack)
108+
109+
ans =
110+
5 5 2 3 10
111+
```
112+
113+
*Note*: You must be careful that you specify the dimensions in the
114+
appropriate order, exactly as interleaved in the stack. Also, if the stack
115+
contains multiple samples per pixel in native TIFF format, the
116+
samples-per-pixel dimension will always be pushed to the final dimension.
117+
69118
## Publications
70119

71120
This work was published in [Frontiers in Neuroinformatics]: DR Muir and

0 commit comments

Comments
 (0)