How to convert 2d images to a 3d image (MRI)?
Afficher commentaires plus anciens
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 commentaires
Oliver Woodford
le 27 Oct 2015
What kind of 3D plot do you want? E.g. an isocontour, or a voxel array?
Ivan Shorokhov
le 30 Oct 2015
Image Analyst
le 30 Oct 2015
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
le 2 Nov 2015
Modifié(e) : Ivan Shorokhov
le 2 Nov 2015
Ivan Shorokhov
le 2 Nov 2015
Modifié(e) : Ivan Shorokhov
le 2 Nov 2015
Réponses (1)
kian ghotbi
le 12 Oct 2018
0 votes
hi, what is version of your matlab?
Catégories
En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!