How to convert 2d images to a 3d image (MRI)?
이전 댓글 표시
Hello everybody,
I have MRI scan file with 9 slices...how can I make a 3d image with this 9 slices?
Here the data I have (Aspect,ImageOrientation,ImagePosition):

I have used the following code and I got an error:
load data.mat
im = data(1).Img;
for i = 1 : size(im,2)
for j = 1 : size(im,1)
di = data(1).Aspect(1);
dj = data(1).Aspect(2);
Xxyz = data(1).ImageOrientation(1:3);
Yxyz = data(1).ImageOrientation(4:6);
Sxyz = data(1).ImagePosition;
X(i,j) = Xxyz(1)*di*(i-1) + Yxyz(1)*dj*(j-1) + Sxyz(1);
Y(i,j) = Xxyz(2)*di*(i-1) + Yxyz(2)*dj*(j-1) + Sxyz(2);
Z(i,j) = Xxyz(3)*di*(i-1) + Yxyz(3)*dj*(j-1) + Sxyz(3);
end
end
figure(1);
imReal.X = X;
imReal.Y = Y;
imReal.Z = Z;
figure(1);
surf(imReal.X', imReal.Y', imReal.Z', double(im), 'EdgeColor', 'none'); hold on;
error:
Error using surf (line 69)
Data dimensions must agree.
Error in TestTwoDtoThreeD (line 24)
surf(imReal.X', imReal.Y', imReal.Z', double(im), 'EdgeColor', 'none'); hold on;
Thanks in advance and I greatly appreciate your help, the data is attached!
Ivan
@Walter Roberson and @Image Analyst
댓글 수: 5
Oliver Woodford
2015년 10월 27일
What kind of 3D plot do you want? E.g. an isocontour, or a voxel array?
Ivan Shorokhov
2015년 10월 30일
Image Analyst
2015년 10월 30일
What do you have? It doesn't look like parallel slices, but a random collection of slices (cutaway views) taken at a bunch of oddball locations and orientations. If that's what you have, I don't think you can reconstruct all the "missing" data into a nice 3D rectangular volumetric image, at least not easily and without some guessing. For a simple example, let's say you have 4 slices like this:

and you want to fill in the missing voxels so that you have voxel data at every point in the rectangular block. I just would not trust data there even if you could get it.
Ivan Shorokhov
2015년 11월 2일
편집: Ivan Shorokhov
2015년 11월 2일
Ivan Shorokhov
2015년 11월 2일
편집: Ivan Shorokhov
2015년 11월 2일
답변 (1개)
kian ghotbi
2018년 10월 12일
0 개 추천
hi, what is version of your matlab?
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!