MATLAB Answers

Problem of increased 3D volume after reconstruction from 2D CT slides

4 views (last 30 days)
Ringo Cheung
Ringo Cheung on 2 May 2018
Edited: Ringo Cheung on 20 Aug 2018
Dear Everyone,
I have a problem of accuracy after reconstructing CT slides to 3D volume.
In this example, the width of the patient's head is about 140mm as seen from the CT slide. After reconstructing to 3D volume, it was found that the width has increased to about 300mm after outputting to STL file.
Here is the sample of 2D slide and an image of the 3D volume after reconstruction :
Here is the code :
for i = 30 : 160
info = dicominfo(dirOutput(i).name,'UseDictionaryVR',true);
imgTemp = dicomread(info);
imgCropped = imcrop(imgTemp,croppedArea);
imgCroppedBin = imbinarize(imgCropped,0.51728); %Binarize the image
I(:,:,i) = imgCroppedBin;
end
Is = smooth3(I,'gaussian');
fv2 = isosurface(Is,0.5);
fv2 = smoothpatch(fv2,0,3,1,1); %"Smooth Triangulated Mesh" by Dirk-Jan Kroon
patch(fv2,...
'FaceColor',[1,.75,.65],...
'EdgeColor','none');view(35,30); axis off, daspect([1,1,1]);lightangle(45,30);lighting gouraud;
%Create filename according to current timestamp and output 3D model to .STL file
t = datetime('now');
timestamp = datestr(t,30);
fname = '../Desktop/MatLab Demo/TestResult/3Dreconst_';
fext = '.stl';
outfname = strcat(fname,timestamp,fext);
stlwrite(outfname,fv2);
Grateful if anyone can help. Thanks, Ringo

  2 Comments

Ringo Cheung
Ringo Cheung on 20 Aug 2018
Hi Robert, Thanks for your comment and finally I used affine3D and imwarp to resolve this issue: First dig out two pieces of information “PixelSpacing” and “SliceThickness” from the DICOM file, then use this information to create an affine3d object. Then define a transform “tform” using this object:
Sx = info.PixelSpacing(1);
Sy = info.PixelSpacing(1);
Sz = info.SliceThickness;
tform = affine3d([Sx 0 0 0; 0 Sy 0 0; 0 0 Sz 0; 0 0 0 1]);
Finally, we complete the transform by applying MATLAB® imwarp function:
I = imwarp(I,tform);
where I is the 3D volume data previously obtained from the 2D slices.
The problem is resolved.
Thanks, Ringo

Sign in to comment.

Answers (0)

Sign in to answer this question.