資源簡介
matlab課程設計源代碼(肺實質的提取)
專為課程設計打造!!!

代碼片段和文件信息
%%?Segmentation?of?the?CT?image?of?lung
%?This?code?reads?a?BMP?image??extract?the?part?of?lung
%?and?then?dispaly?the?result.
%%?Read?the?image?data
im=imread(‘f.bmp‘);
im=rgb2gray(im);
[row?column]=size(im);
imshow(im)
title(‘the?Original?Image‘)
%%?Get?the?threshold?for?segmentation?using?iteration?process
%get?the?maximun?and?minimun?value?of?the?vector
Gmax=max(max(im));
Gmin=min(min(im));
%supposing?T0?is?the?threshold
T0=(Gmax+Gmin)/2;
%mean?of?both?partsthen?get?the?new?threshold?T1
M0=mean(im(find(im M1=mean(im(find(im>=T0)));
T1=(M0+M1)/2;?
%get?the?appropriate?threshold?
%by?no?more?then?5000?loops?
for?i=1:5000???????????????%here?gives?the?maximun?numbers?of?trying
????if?T1~=T0
????????T0=T1;
????????M0=mean(im(find(im ????????M1=mean(im(find(im>=T0)));
????????T1=(M0+M1)/2;
????else?break
????end
end
thresh=T0
%%?Segmentation
for?index=1:row*column
????if?im(index)>thresh
????????im(index)=0;
????end
end
figureimshow(im)
title(‘After?Segmentation‘)
%make?a?copyusing?to?get?the?position
im0=im;
%%?Extract
%divided?the?image?into?2?parts
%foreground?with?1background?with?0
for?index=1:row*column
????if?im0(index)~=0
????????im0(index)=1;
????end
end
%transform?im0?into?‘logical‘then?label
%the?part?of?lung?has?been?labelled?with?20
im0=logical(im0);
im0=bwlabel(im0);
%display?the?relational?pixel
for?i=1:row*column
????if?im0(i)~=20????????????????
????????im(i)=0;
????end
end
figureimshow(im)
title(‘After?Extract‘)
%%?About
%?*Authored*?by?Xiaol?Z.
%??Nov.12th2010.
%??USST
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????6791??2010-11-13?21:52??肺實質的提取\DataPackage\LungSeg.html
?????文件???????1953??2010-11-13?21:52??肺實質的提取\DataPackage\LungSeg.png
?????文件?????141233??2010-11-13?21:52??肺實質的提取\DataPackage\LungSeg_01.png
?????文件?????111336??2010-11-13?21:52??肺實質的提取\DataPackage\LungSeg_02.png
?????文件??????45978??2010-11-13?21:52??肺實質的提取\DataPackage\LungSeg_03.png
?????文件?????470454??2009-10-13?17:25??肺實質的提取\f.bmp
?????文件???????1634??2010-11-13?21:52??肺實質的提取\LungSeg.m
?????目錄??????????0??2011-01-17?16:12??肺實質的提取\DataPackage
?????目錄??????????0??2011-01-17?16:12??肺實質的提取
-----------?---------??----------?-----??----
???????????????779379????????????????????9
- 上一篇:matlab實現圖像的配準,手動選點
- 下一篇:超分辨率重建的matlab代碼
評論
共有 條評論