Hi, i have 20 of 2D images in dicom format and i want to reconstruct the 3D image. How can i do this in MATLAB? here i attached my code and i hope anyone could help me to fix it. Many thanks
a = dicomread ('brain_001.dcm')
mask = zeros(size(a));
mask(100:end-50,100:end-50) = 1;
bw = activecontour(a,mask,1000);
% for p=1:20
% filename = sprintf('brain_%03d.dcm', p);
% a(:,:,1,p) =double(dicomread(filename));
% end
c = im2double(bw);
shading flat
d = imgaussfilt3 (c,2);
for p=1:20
filename = sprintf('brain_%03d.dcm', p);
a(:,:,1,p) =double(dicomread(filename));
end
colormap(copper)
e = mesh(d.*100)

댓글 수: 3

Image Analyst
Image Analyst 2016년 11월 7일
What do you mean by "reconstruct"? And why are you putting the 2D images into a 4D array? And why are you computing "c" and "d" but not doing anything with them?
Walter Roberson
Walter Roberson 2016년 11월 7일
implay looks for M-by-N-by-1-by-K for grayscale.
Zaitul
Zaitul 2016년 11월 10일
편집: Zaitul 2016년 11월 10일
i want to make the 3D image from those 2D images. what should i do for c and d? i'm a bit confused when i'm doing the loop for p. i'm sorry as i'm just realized there's only 20 slices of image actually.

댓글을 달려면 로그인하십시오.

답변 (1개)

Ahmet Cecen
Ahmet Cecen 2016년 11월 10일
편집: Ahmet Cecen 2016년 11월 10일

0 개 추천

Too vague to answer directly, but here are two helpful tips:
1) Whatever you are doing, in the end you need to stack the images on the 3rd dimension not 4th.
NOT
a(:,:,1,p) =double(dicomread(filename));
BUT
a(:,:,p) =double(dicomread(filename));
2) Do not try to visualize 3D data in MATLAB, unless it is a surface. MATLAB figures (as far as I know) do not support pixel shading, so your figures will look very flat. Instead use Paraview. You can use this function to export your 3D matrix once you have that in MATLAB. Below is an example of a 3D reconstruction I visualized following the same procedure.Notice the depth/shading.

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

질문:

2016년 11월 7일

편집:

2016년 11월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by