%Funcion que segmenta mediante crecimiento de regiones de semilla utilizando como semilla de entrada la función impixel con aumento de %contraste automatizado y umbral 0.02 name=input('introduzca nombre de la imagen: ','s'); y=dicomread(name); minimo=min(min(y)); resul=y-minimo; maximo=max(max(resul)); maximo=double(maximo); I=double(resul)/maximo; % Automatizamos los umbrales para aumentar el contraste de la imagen [h,n]=imhist(I); %h=representa el numero de veces q se repite intensidad de la imagen, n=el valor de intensidad del hist. for(i=2:length(n)-1) if((h(i)>h(i+1))) maximo=h(i); p=i; else maximo=h(i+1); p=i+1; end maximo=h(p); queue(1,i)=maximo; end maxtotal=max(queue(1,:)) %calculamos el vlor maximo del histograma eliminando el maximo en cero m=imhist(I)==maxtotal; %Vector que toma el valor 1 en la posición en la que el histograma toma el valor maximo resu=m'*n imhist(I) mini=resu+0.1 ; %Intervalo mimino para aplicar contraste maxi=mini+0.3 ; %Intervalo maximo para aplicar contraste if(maxi>1) maxi=1; end I2=imadjust(I,[mini;maxi]); clf imshow(I2),title('SELECCIONE LA SEMILLA') %Implantamos semilla title('seleccione semilla'),[col,fil,sem]=impixel(I2) sem=I2(fil,col) umbral=0.02; interior=zeros(512,512); %inicializamos matriz interior(0=no visitado,1=visitado y pertenece,2=visitado y no pertenece) I3=zeros(512,512); y=fil; x=col; for i2=1:512 %recorremos filas for j2=1:512 %recorremos columnas if (interior(i2,j2)==0 || interior(i2,j2)==2) if(abs(sem-I2(i2,j2))>umbral) interior(i2,j2)=2; else interior(i2,j2)=1; indfila=i2; indcolu=j2; I3(indfila,indcolu)=I2(indfila,indcolu); queue(1,1)=i2; queue(1,2)=j2; p=1; q=1; while(q<=p) i=queue(q,1); j=queue(q,2); q=q+1; if((i+1)<512) if (interior(i+1,j)==0 || interior(i+1,j)==2) if(abs(I2(i2,j2)-I2(i+1,j))>umbral) interior(i+1,j)=2; else interior(i+1,j)=1; indfila=i+1; indcolu=j; I3(indfila,indcolu)=I2(indfila,indcolu); p=p+1; queue(p,1)=i+1; queue(p,2)=j; end end end if((i-1)>0) if(interior(i-1,j)==0 || interior(i-1,j)==2) if(abs(I2(i2,j2)-I2(i-1,j))>umbral) interior(i-1,j)=2; else interior(i-1,j)=1; indfila=i-1; indcolu=j; I3(indfila,indcolu)=I2(indfila,indcolu); p=p+1; queue(p,1)=i-1; queue(p,2)=j; end end end if ((j+1)<512) if(interior(i,j+1)==0 || interior(i,j+1)==2) if(abs(I2(i2,j2)-I2(i,j+1))>umbral) interior(i,j+1)=2; else interior(i,j+1)=1; indfila=i; indcolu=j+1; I3(indfila,indcolu)=I2(indfila,indcolu); p=p+1; queue(p,1)=i; queue(p,2)=j+1; end end end if((j-1)>0) if(interior(i,j-1)==0 || interior(i,j-1)==2) if(abs(I2(i2,j2)-I2(i,j-1))>umbral) interior(i,j-1)=2; else interior(i,j-1)=1; indfila=i; indcolu=j-1; I3(indfila,indcolu)=I2(indfila,indcolu); p=p+1; queue(p,1)=i; queue(p,2)=j-1; end end end end end end end end imview(I3) I4=medfilt2(I3); I5=medfilt2(I4); imview(I5) e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.


PROCESADO Y SEGMENTACIÓN DE IMÃGENES TOMOGRÃFICAS AXIALES COMPUTERIZADAS (TAC)

: Suárez Mejías, Cristina
: Ingeniería Telecomunicación
Contenido del proyecto: