CT圖像三維重建(附源碼)_第1頁
CT圖像三維重建(附源碼)_第2頁
CT圖像三維重建(附源碼)_第3頁
CT圖像三維重建(附源碼)_第4頁
CT圖像三維重建(附源碼)_第5頁
已閱讀5頁,還剩3頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

結(jié)束計(jì)算重建圖像和原圖的性噪比,并進(jìn)行輸出用函數(shù)ifanbeam根據(jù)扇束投影數(shù)據(jù)重建圖像,并展示用函數(shù)fanbeam進(jìn)行映射,得到扇束的數(shù)據(jù),并展示對(duì)圖片信息進(jìn)行預(yù)處理,并進(jìn)行展示輸入圖片數(shù)字選擇生成128的圖片信息程序流圖:結(jié)束計(jì)算重建圖像和原圖的性噪比,并進(jìn)行輸出用函數(shù)ifanbeam根據(jù)扇束投影數(shù)據(jù)重建圖像,并展示用函數(shù)fanbeam進(jìn)行映射,得到扇束的數(shù)據(jù),并展示對(duì)圖片信息進(jìn)行預(yù)處理,并進(jìn)行展示輸入圖片數(shù)字選擇生成128的圖片信息MATLAB源碼:clc;clearall;closeall;%loadmri%載入mri數(shù)據(jù),是matlab自帶庫%ph=squeeze(D);%壓縮載入的數(shù)據(jù)D,并賦值給phph=phantom3d(128);prompt={'EnterthePiecenum(1to128):'};%提示信息“輸入1到27的片的數(shù)字”name='Inputnumber';%彈出框名稱defaultanswer={'1'};%默認(rèn)數(shù)字numInput=inputdlg(prompt,name,1,defaultanswer)%彈出框,并得到用戶的輸入信息P=squeeze(ph(:,:,str2num(cell2mat(numInput))));%將用戶的輸入信息轉(zhuǎn)換成數(shù)字,并從ph中得到相應(yīng)的片信息Pimshow(P)%展示圖片PD=250;%將D賦值為250,是從扇束頂點(diǎn)到旋轉(zhuǎn)中心的像素距離。dsensor1=2;%正實(shí)數(shù)指定扇束傳感器的間距2F1=fanbeam(P,D,'FanSensorSpacing',dsensor1);%通過P,D等計(jì)算扇束的數(shù)據(jù)值dsensor2=1;%正實(shí)數(shù)指定扇束傳感器的間距1F2=fanbeam(P,D,'FanSensorSpacing',dsensor2);%通過P,D等計(jì)算扇束的數(shù)據(jù)值dsensor3=0.25%正實(shí)數(shù)指定扇束傳感器的間距0.25[F3,sensor_pos3,fan_rot_angles3]=fanbeam(P,D,...'FanSensorSpacing',dsensor3);%通過P,D等計(jì)算扇束的數(shù)據(jù)值,并得到扇束傳感器的位置sensor_pos3和旋轉(zhuǎn)角度fan_rot_angles3figure,%創(chuàng)建窗口imagesc(fan_rot_angles3,sensor_pos3,F3)%根據(jù)計(jì)算出的位置和角度展示F3的圖片colormap(hot);%設(shè)置色圖為hotcolorbar;%顯示色欄xlabel('FanRotationAngle(degrees)')%定義x坐標(biāo)軸ylabel('FanSensorPosition(degrees)')%定義y坐標(biāo)軸output_size=max(size(P));%得到P維數(shù)的最大值,并賦值給output_sizeIfan1=ifanbeam(F1,D,...'FanSensorSpacing',dsensor1,'OutputSize',output_size);%根據(jù)扇束投影數(shù)據(jù)F1及D等數(shù)據(jù)重建圖像figure,imshow(Ifan1)%創(chuàng)建窗口,并展示圖片Ifan1title('圖一');disp('圖一和原圖的性噪比為:');result=psnr1(Ifan1,P);Ifan2=ifanbeam(F2,D,...'FanSensorSpacing',dsensor2,'OutputSize',output_size);%根據(jù)扇束投影數(shù)據(jù)F2及D等數(shù)據(jù)重建圖像figure,imshow(Ifan2)%創(chuàng)建窗口,并展示圖片Ifan2disp('圖二和原圖的性噪比為:');result=psnr1(Ifan2,P);title('圖二');Ifan3=ifanbeam(F3,D,...'FanSensorSpacing',dsensor3,'OutputSize',output_size);%根據(jù)扇束投影數(shù)據(jù)F3及D等數(shù)據(jù)重建圖像figure,imshow(Ifan3)%創(chuàng)建窗口,并展示圖片Ifan3title('圖三');disp('圖三和原圖的性噪比為:');result=psnr1(Ifan3,P);function[p,ellipse]=phantom3d(varargin)%PHANTOM3DThree-dimensionalanalogueofMATLABShepp-Loganphantom%P=PHANTOM3D(DEF,N)generatesa3Dheadphantomthatcan%beusedtotest3-Dreconstructionalgorithms.%%DEFisastringthatspecifiesthetypeofheadphantomtogenerate.%Validvaluesare:%%'Shepp-Logan'Atestimageusedwidelybyresearchersin%tomography%'ModifiedShepp-Logan'(default)AvariantoftheShepp-Loganphantom%inwhichthecontrastisimprovedforbetter%visualperception.%%NisascalarthatspecifiesthegridsizeofP.%Ifyouomittheargument,Ndefaultsto64.%%P=PHANTOM3D(E,N)generatesauser-definedphantom,whereeachrow%ofthematrixEspecifiesanellipsoidintheimage.Ehastencolumns,%witheachcolumncontainingadifferentparameterfortheellipsoids:%%Column1:Atheadditiveintensityvalueoftheellipsoid%Column2:athelengthofthexsemi-axisoftheellipsoid%Column3:bthelengthoftheysemi-axisoftheellipsoid%Column4:cthelengthofthezsemi-axisoftheellipsoid%Column5:x0thex-coordinateofthecenteroftheellipsoid%Column6:y0they-coordinateofthecenteroftheellipsoid%Column7:z0thez-coordinateofthecenteroftheellipsoid%Column8:phiphiEulerangle(indegrees)(rotationaboutz-axis)%Column9:thetathetaEulerangle(indegrees)(rotationaboutx-axis)%Column10:psipsiEulerangle(indegrees)(rotationaboutz-axis)%%Forpurposesofgeneratingthephantom,thedomainsforthex-,y-,and%z-axesspan[-1,1].Columns2through7mustbespecifiedinterms%ofthisrange.%%[P,E]=PHANTOM3D(...)returnsthematrixEusedtogeneratethephantom.%%ClassSupport%-------------%Allinputsmustbeofclassdouble.Alloutputsareofclassdouble.%%Remarks%-------%Foranygivenvoxelintheoutputimage,thevoxel'svalueisequaltothe%sumoftheadditiveintensityvaluesofallellipsoidsthatthevoxelisa%partof.Ifavoxelisnotpartofanyellipsoid,itsvalueis0.%%TheadditiveintensityvalueAforanellipsoidcanbepositiveornegative;%ifitisnegative,theellipsoidwillbedarkerthanthesurroundingpixels.%Notethat,dependingonthevaluesofA,somevoxelsmayhavevaluesoutside%therange[0,1].%%Example%-------%ph=phantom3d(128);%figure,imshow(squeeze(ph(64,:,:)))%%Copyright2005MatthiasChristianSchabel(matthias@stanfordalumni.org)%UniversityofUtahDepartmentofRadiology%UtahCenterforAdvancedImagingResearch%729ArapeenDrive%SaltLakeCity,UT84108-1218%%ThiscodeisreleasedundertheGnuPublicLicense(GPL).Formoreinformation,%see:%%Portionsofthiscodearebasedonphantom.m,copyrightedbytheMathworks%[ellipse,n]=parse_inputs(varargin{:});p=zeros([nnn]);rng=((0:n-1)-(n-1)/2)/((n-1)/2);[x,y,z]=meshgrid(rng,rng,rng);coord=[flatten(x);flatten(y);flatten(z)];p=flatten(p);fork=1:size(ellipse,1)A=ellipse(k,1);%Amplitudechangeforthisellipsoidasq=ellipse(k,2)^2;%a^2bsq=ellipse(k,3)^2;%b^2csq=ellipse(k,4)^2;%c^2x0=ellipse(k,5);%xoffsety0=ellipse(k,6);%yoffsetz0=ellipse(k,7);%zoffsetphi=ellipse(k,8)*pi/180;%firstEulerangleinradianstheta=ellipse(k,9)*pi/180;%secondEulerangleinradianspsi=ellipse(k,10)*pi/180;%thirdEulerangleinradianscphi=cos(phi);sphi=sin(phi);ctheta=cos(theta);stheta=sin(theta);cpsi=cos(psi);spsi=sin(psi);%Eulerrotationmatrixalpha=[cpsi*cphi-ctheta*sphi*spsicpsi*sphi+ctheta*cphi*spsispsi*stheta;-spsi*cphi-ctheta*sphi*cpsi-spsi*sphi+ctheta*cphi*cpsicpsi*stheta;stheta*sphi-stheta*cphictheta];%rotatedellipsoidcoordinatescoordp=alpha*coord;idx=find((coordp(1,:)-x0).^2./asq+(coordp(2,:)-y0).^2./bsq+(coordp(3,:)-z0).^2./csq<=1);p(idx)=p(idx)+A;endp=reshape(p,[nnn]);return;functionout=flatten(in)out=reshape(in,[1prod(size(in))]);return;function[e,n]=parse_inputs(varargin)%eisthem-by-10arraywhichdefinesellipsoids%nisthesizeofthephantombrainimagen=128;%Thedefaultsizee=[];defaults={'shepp-logan','modifiedshepp-logan','yu-ye-wang'};fori=1:narginifischar(varargin{i})%Lookforadefaultphantomdef=lower(varargin{i});idx=strmatch(def,defaults);ifisempty(idx)eid=sprintf('Images:%s:unknownPhantom',m);msg='Unknowndefaultphantomselected.';error(eid,'%s',msg);endswitchdefaults{idx}case'shepp-logan'e=shepp_logan;case'modifiedshepp-logan'e=modified_shepp_logan;case'yu-ye-wang'e=yu_ye_wang;endelseifnumel(varargin{i})==1n=varargin{i};%ascalaristheimagesizeelseifndims(varargin{i})==2&&size(varargin{i},2)==10e=varargin{i};%userspecifiedphantomelseeid=sprintf('Images:%s:invalidInputArgs',m);msg='Invalidinputarguments.';error(eid,'%s',msg);endend%ellipseisnotyetdefinedifisempty(e)e=modified_shepp_logan;endreturn;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Defaultheadphantoms:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%functione=shepp_logane=modified_shepp_logan;e(:,1)=[1-.98-.02-.02.01.01.01.01.01.01];return;functione=modified_shepp_logan%%ThisheadphantomisthesameastheShepp-Loganexcept%theintensitiesarechangedtoyieldhighercontrastin%theimage.TakenfromToft,199-200.%%Aabcx0y0z0phithetapsi%-----------------------------------------------------------------e=[1.6900.920.810000000-.8.6624.874.7800-.01840000-.2.1100.310.220.2200-18010-.2.1600.410.280-.220018010.1.2100.250.4100.35-.15000.1.0460.046.0500.1.25000.1.0460.046.0500-.1.25000.1.0460.023.050-.08-.6050000.1.0230.023.0200-.6060000.1.0230.046.020.06-.6050000];return;functione=yu_ye_wang%%YuH,YeY,WangG,Katsevich-TypeAlgorithmsforVariableRadiusSpiralCone-BeamCT%%Aabcx0y0z0phithetapsi%-----------------------------------------------------------------e=[1.690

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論