How to import TIFF stack into a 4D matrix? (2021)
Show older comments
I currently use the following for loop, which is inefficient. In Python, I could use skimage.imread(fname) to load the data. Is there an equivalent in Matlab?
tstack = Tiff(fname);
[I, J, C] = size(tstack.read());
K = length(imfinfo(path));
data = zeros(K,I,J,C);
data(1,:,:,:) = tstack.read();
for n=2:K
tstack.nextDirectory();
data(n,:,:,:) = tstack.read();
end
Answers (1)
sir,may be consider tiff function to get data,such as
t = Tiff('peppers_RGB_tiled.tif','r');
imageData = read(t);
imshow(imageData);
title('Peppers Image (RGB)')
Categories
Find more on Image Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!