資源簡介
實現種子點的動態選取, dicom圖片的讀取和保存,基于8鄰域的區域增長算法,可以直接運行。(運行前需要修改自己要處理的圖片目錄)
代碼片段和文件信息
%加邊界限制
%{
Ie=imread(‘C:\Users\Emily\Desktop\Matlab\segliver.bmp‘);
bw=imfill(Ie‘holes‘);
iedge=edge(bw);
figureimshow(iedge)
I=imread(‘C:\Users\Emily\Desktop\Matlab\liver.bmp‘);
figureimshow(I[])title(‘原始圖像‘)
I=im2double(I);
I(iedge==1)=3;
%}
%彩色圖像
%{
image=imread(‘C:\Users\Emily\Desktop\Matlab\liver.bmp‘);
I=rgb2gray(image);
%}
%Dicom圖像
info=dicominfo(‘C:\Users\Emily\Desktop\Matlab\1\IM185‘);
I=dicomread(info);
I=double(I);
I=Liver_WindowLevel(I1493722);
figureimshow(I[])title(‘原始圖像‘)
%{
I=imread(‘C:\Users\Emily\Desktop\Matlab\liver.bmp‘);
figureimshow(I[])title(‘原始圖像‘)
I=im2double(I);
%}
[M?N]=size(I);
[y?x]=getpts;
x1=round(x);
y1=round(y);
seed_mean=I(x1y1);
Y=zeros(MN);
Y(x1y1)=1;
seed_sum=seed_mean;
seed_count=1;
neg_count=1;
threshold=30;
tic;
while?neg_count>0
????neg_count=0;
????s=0;
????for?i=1:M
????????for?j=1:N
???
評論
共有 條評論