3D reconstruction from 2D images

I have come across an example of surface2volume function from https://www.mathworks.com/matlabcentral/fileexchange/8772-surface2volume .I had tried the example given and it work! My question is how I gonna to modify the coding so it can be used for my own ultrasound 2D images? Because the example coding is loading the mri mat file.The example coding is as below:
load mri;
D = squeeze(D);
D = padarray(D,[5 5 5],'both');
% Create an isosurface
Ds = smooth3(D);
surface = isosurface(Ds,5);
% Display the surface
figure;
subplot(1,2,1);
hiso = patch('Vertices',surface.vertices,...
'Faces',surface.faces,...
'FaceColor',[1,.75,.65],...
'EdgeColor','none');
view(45,30)
axis tight
daspect([1,1,.4])
lightangle(45,30);
set(gcf,'Renderer','zbuffer'); lighting phong
isonormals(Ds,hiso)
set(hiso,'SpecularColorReflectance',0,'SpecularExponent',50)
% Reconstruct the volume and display it as montage
OV = surface2volume(surface,[],1);
nDims = size(OV);
subplot(1,2,2);
montage(reshape(OV,nDims(1),nDims(2),1,nDims(3)),[0 1]);
Hope you can clear my doubt.I am a newbie to use matlab. If you got any solution to stack 2D images into 3D or can reconstruct 3D from multiple 2D images please feel free to comment here.Thank you very much!

4 commentaires

Tale Saeidi
Tale Saeidi le 16 Avr 2019
Hi guys
I have used this code as well to convert a 2D image to volume. everything is fine until the line 23"nDim=size(OV)". then I am getting this error: 'The logical indices contain a true value outside of the array bounds'.
Any body can help?
Rik
Rik le 16 Avr 2019
That sounds like you might have defined a variable with the name size.
AYYOUB AZNAG
AYYOUB AZNAG le 28 Juin 2021
Hello ,i'm now on thesis period and i need your help for 3D reconstruction from 2D image , Thank you
Rik
Rik le 28 Juin 2021
@AYYOUB AZNAG Have a read here and here. It will greatly improve your chances of getting an answer.

Connectez-vous pour commenter.

Réponses (0)

Catégories

Commenté :

Rik
le 28 Juin 2021

Community Treasure Hunt

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

Start Hunting!

Translated by