How to show Tiff stacks
Show older comments
Hi everyone;
I'm trying to show a tiff stack '57 images as one file' but I faced this problem:
Warning: Can only display one frame from this multiframe file:
"Stack.tif".
> In imuitools\private\getImageFromFile at 20
In imuitools\private\imageDisplayParseInputs at 74
In imshow at 198
In Prg at 4
how can I display a tiff stack image? and after I applied some processes how can I collect them again 'refile them'
Accepted Answer
More Answers (2)
Shep Bryan
on 16 Apr 2020
In my case it ends up being a couple orders of magnitude faster to avoid using imread. Try:
function data = FastTiff(filename)
warning('off','all') % Suppress all the tiff warnings
tstack = Tiff(filename);
[I,J] = size(tstack.read());
K = length(imfinfo(filename));
data = zeros(I,J,K);
data(:,:,1) = tstack.read();
for n = 2:K
tstack.nextDirectory()
data(:,:,n) = tstack.read();
end
warning('on','all')
end
Notice that I suppress the warnings in my code because the format of my data is strange.
Ashish Uthama
on 2 Mar 2022
0 votes
It would help to clarify the nature of your input files (Folder of tiffs? One tiff file with multiple IFD/s? Or one tiff file with ImageJ style stack?)
You could look at tiffreadvolume to read in the latter two types. And explore volshow and volumeViewer if its 3D data, or just implay if its a time series.
For stream processing, you could also explore blockedImage to read+process+write large 3D data from tiff files.
Categories
Find more on Image Sequences and Batch Processing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!