How to convert 2D images to 1 3D image

12 Ansichten (letzte 30 Tage)
Taylor Heilig
Taylor Heilig am 30 Nov. 2016
Kommentiert: Image Analyst am 30 Aug. 2021
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 Kommentare
zahra ghadery
zahra ghadery am 30 Aug. 2021
hello
i have the same problem. Did you solve it? Would you please help me?
Image Analyst
Image Analyst am 30 Aug. 2021
@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

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Jan
Jan am 30 Nov. 2016
Bearbeitet: Jan am 30 Nov. 2016
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 am 30 Nov. 2016
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.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by