How to convert 2D images to 1 3D image

11 次查看(过去 30 天)
I have about 170 2D image slices of a brain. These are all saved in a .tif file. I want to take all these slices and put them all together to form a 3D image of the brain. I'm not sure where to even start, can anyone help?
Thanks
Update: This is what I have tried so far
FileTif='C:\Users\Taylor\Desktop\P_TH1_S_2237_29-Nov-2016_13.52.30_OCT.tif';
InfoImage=imfinfo(FileTif);
mImage=InfoImage(1).Width;
nImage=InfoImage(1).Height;
NumberImages=length(InfoImage);
FinalImage=zeros(nImage,mImage,NumberImages,'uint16');
for i=1:NumberImages
FinalImage(:,:,i)=imread(FileTif,'Index',i);
end
imshow(FinalImage)
Here are the errors I receive:
Error using images.internal.imageDisplayValidateParams>validateCData (line 115)
Multi-plane image inputs must be RGB images of size MxNx3.
Error in images.internal.imageDisplayValidateParams (line 27)
common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 78)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 222)
images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});
Error in SignalsProject2 (line 18)
  7 个评论
zahra ghadery
zahra ghadery 2021-8-30
hello
i have the same problem. Did you solve it? Would you please help me?
Image Analyst
Image Analyst 2021-8-30
@zahra ghadery if your images are color, then you'll have to convert them to gray scale to use this:
grayImage = imread(FileTif, 'Index', i);
FinalImage(:, :, i) = grayImage; % Gray scale
Otherwise you can try inserting the color image into a 4-D matrix:
FinalImage(:, : , :, i) = imread(FileTif, 'Index', i); % Color

请先登录,再进行评论。

回答(2 个)

Jan
Jan 2016-11-30
编辑:Jan 2016-11-30
You find some solutions in the FileExchange, when you search for "Slice 3D":
Hint: Even asking Google for "Matlab slice 3D" might help in such cases.

Image Analyst
Image Analyst 2016-11-30
MATLAB's 3-D volume visualization capabilities are pretty primitive. They're pretty much limited to cutaway views (slices) and isosurfaces, as you can see from Adam's links. If you need anything more advanced you'll have to use a program like Avizo: https://www.fei.com/software/avizo-3d/ which can do virtually anything you can possibly think of.

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by