How to convert 2d images to a 3d image (MRI)?
15 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!