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!