Beruflich Dokumente
Kultur Dokumente
2017 dcom(MATLAB)3DCTmagereconstructonby2DslcesStackOverflow
xDsmss
JontheStackOverflowCommunty
Sgnup
(MATLAB)3DCTmagereconstructonby2Dslces
IamusngMATLABR2010bonmyUbuntusystem.
Images'locatons: /home/amadeus/Desktop/images
Imagesarenamed:
IM00010001.dcm
IM00010002.dcm
IM00010003.dcm
...
IM00010250.dcm
matlab dcom
edtedOct9'12at14:11 askedOct9'12at12:44
GuntherStruyf Xentus
10.2k 2 21 47 249 1 7 18
1Answer
ApparantlytheresafunctonjustforreadngDICOMfles:dcomread,Isuggestusngthatto
loadthemagesandthenstorethemna3Dmatrx.sprntfcanbeusedtoconstructthe
flenamesofthemages(use %04d togeneratefourdgtnumberwthleadngzeros).
Assumngallmagesarealgnedandhavesamesze:
N=250;
img_dir='/home/amadeus/Desktop/images'
%readthefirstimageseparatelyjusttogetthesize
strfile='IM00010001.dcm';
img=dicomread(fullfile(img_dir,strfile));
siz_img=size(img);
%createresultmatrix:
ct3d=NaN([siz_imgN]);
ct3d(:,:,1)=img;
%loadalltheremainingimagesandputtheminthematrix
forii=2:N
strfile=sprintf('IM0001%04d.dcm',ii);
ct3d(:,:,ii)=dicomread(fullfile(img_dir,strfile));
end
edt:Thsassumesmagearegrayscale(2d).Incasethey'refullcolour(wdthxheghtx3),you
shouldaddanothercolonoperatorntheassgnmentto ct3d .
edtedOct9'12at14:49 answeredOct9'12at13:55
GuntherStruyf
10.2k 2 21 47
FrstofallIwouldlketothankyousomuchforyourhelp.IthasbeenonlyadayIstartedusngMATLAB
andfornoweverythngseemssocomplcatedtome.Igotsomeerrorswththecode:frstonewas:ct3d=
NaN([szN])???Undefnedfunctonorvarable'sz'.BecauseofthereasonthatIdonotknowhowtofxt,
Idrectlyusedct3d=NaN([250])Butthen:ct3d(:,:,1)=mg???Subscrptedassgnmentdmenson
msmatch.HowshouldIfxthserror?Agan,Iamsomuchthankfulforyourhelp. Xentus Oct9'12at
https://stackoverflow.com/questons/12800333/matlab3dctmagereconstructonby2dslces 1/2
16.07.2017 dcom(MATLAB)3DCTmagereconstructonby2DslcesStackOverflow
msmatch.HowshouldIfxthserror?Agan,Iamsomuchthankfulforyourhelp. Xentus Oct9'12at
14:46
youarethebest!!onelastqueston:howcanIvewmyct3dflenow?=)mshowdoesnotwork.
Xentus Oct9'12at15:14
1 t s 3ddata,sovsualzngtona2dscreensnotstraghtforward+evenn3d,someparts/voxelsmay
obstructotherparts/voxels..Irecentlyhadatourofthectdepartmentatalocalhosptalandtheguythere
sadthattheyusuallyvsualzea3dscanbyslcngthe3ddata(underanglenotnecessarlyequalto
scannngangle)andscrollngthroughtheslces.Othermethodmaybe:extractthefeaturetovsualzeand
showthatasasurfaceorsomethngsmlar(example:stackoverflow.com/questons/10101701/)
GuntherStruyfOct9'12at16:11
Ifyouwanttovsualzeslcesofyour3Dmagewherethentenstycrossessomethreshold,takealookat
MATLABfunctonsosurfacemathworks.com/help/matlab/ref/sosurface.htmlClark Oct9'12at17:14
https://stackoverflow.com/questons/12800333/matlab3dctmagereconstructonby2dslces 2/2