How to read a multiframe tiff in MATLAB?

Hello,
I am trying to read a multiframe tiff of dimension 610 x 610 x 1200
Using imread('file.tiff') reads only the first image as mentioned in the documentation.
I would like to know how to read all frames.
ip = imread('file.tiff')
i.e
size(ip) = 610 610
but I want it to return
size(ip) = 610 610 1200

8 comentarios

Deepa Maheshvare
Deepa Maheshvare el 4 de Jul. de 2020
Any suggestions?
ip = imread('file.tiff', 'all');
Deepa Maheshvare
Deepa Maheshvare el 4 de Jul. de 2020
Thank you, I missed this.
May I know if a similar option exists for imwrite? I could only find 'Append'.
Deepa Maheshvare
Deepa Maheshvare el 4 de Jul. de 2020
Editada: Deepa Maheshvare el 4 de Jul. de 2020
ip = imread('file.tiff', 'all');
Unrecognized parameter name 'all'
in version 2019b.
Walter Roberson
Walter Roberson el 4 de Jul. de 2020
Editada: Walter Roberson el 4 de Jul. de 2020
ip = imread('file.tiff', 'Frames', 'all');
May I know if a similar option exists for imwrite? I could only find 'Append'.
No there is not.
For multiframe Tiff, it is typically better to use the Tiff() class
ip = imread('file.tiff', 'Frames', 'all');
Unrecognized parameter name 'Frames'.
Walter Roberson
Walter Roberson el 4 de Jul. de 2020
Editada: Walter Roberson el 4 de Jul. de 2020
Your release should recognize Frames as an option. On the other hand, it appears that your release does not recognize Frames for TIFF files. It appears that you will need to loop specifying the index to read each time. You should be able to work out the number of frames by examining the imfinfo() structure.
for frame = 1 : 1200
ip(:,:,frame) = imread('file.tiff', frame);
end
... or use the Tiff() class.
Deepa Maheshvare
Deepa Maheshvare el 4 de Jul. de 2020
Thank you

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 4 de Jul. de 2020
This is what I do in my app having multipage tiffs
info = imfinfo(imageFullFileName);
numberOfPages = length(info);
for k = 1 : numberOfPages
% Read the kth image in this multipage tiff file.
thisPage = imread(imageFullFileName, k);
% Now process thisPage somehow...
end

Categorías

Más información sobre Data Import and Analysis en Centro de ayuda y File Exchange.

Productos

Versión

R2019b

Preguntada:

el 3 de Jul. de 2020

Respondida:

el 4 de Jul. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by