How to read a tiff image (3D) that includes 2D images ? (imread gives only the first image)
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I used the following codes to reconstruct a 3D image that includes 2D slices
for slice = 1 : numberOfSlices filename = sprintf('image #%d', slice);
fullFileName = fullfile(folder, filename);
if exist(fullFileName, 'file)
thisSlice = imread(fullFileName);
array3d(:,:,slice) = thisSlice;
end
end
Then, I use imwrite and to obtain a tiff file that includes all 2D slices.
Now, I want to find connected components in the 3D tiff file. But, if I use
imread() function gives only the first slice in the tiff image.
Can you help me to solve this problem ?
0 comentarios
Respuestas (2)
Walter Roberson
el 9 de En. de 2016
Please show your code that does the writing with imwrite(), because when I try it it tells me clearly that you cannot use imwrite() with that many components and that the Tiff class needs to be used instead.
imread() documents an Index parameter for TIFF files to read a particular indexed file.
More control for TIFF files can be obtained using the TIFF class. However, there is no one call to return all of the images at once: you need to loop and read the "next" image each time. See http://www.mathworks.com/help/matlab/import_export/importing-images.html#br_c8to-1
2 comentarios
Walter Roberson
el 10 de En. de 2016
Look at the Index parameter that is documented in imread() for reading TIFF files. You need to loop reading by index until you get them all.
Image Analyst
el 10 de En. de 2016
Why are you saving that 3D file that you built up from the 2D slices? You've got the 3D array, so just start using it. Why try to save it out incorrectly and then read it back in and be surprised when it doesn't read in correctly? Like Walter said, you'd have to use the TIFF class, but I don't think you even need to save it. Or if you do, why not save it in a mat file?
0 comentarios
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!