;THIS PROGRAM ILLUSTRATES SECOND PASS WHERE AREA RATIO IS MEASURED IN ORDER TO DETERMINE CIRCULAR REGIONS(Bone Image 1). pro regiongrow ,x,y,im ;bordercolor = !d.table_size-1 ;topcolor = !d.table_size-1 ;successcolor = !d.table_size-1 ;unsuccesscolor = !d.table_size-1 ;tvlct ,255,0,0,topcolor ;TO EXTRACT RED COLOR. ;tvlct ,0,255,0,bordercolor ;tvlct ,0,0,255,successcolor ;tvlct ,0,255,255,unsuccesscolor IF im[x,y] eq 254 THEN BEGIN im[x,y] = 150 regiongrow ,x-1,y-1,im regiongrow ,x,y-1,im regiongrow ,x+1,y-1,im regiongrow ,x-1,y,im regiongrow ,x+1,y,im regiongrow ,x-1,y+1,im regiongrow ,x,y+1,im regiongrow ,x+1,y+1,im END END PRO circularbse1pass1 device , decomposed = 0 loadct , 0 file = filepath('pass1(0.70).tif' , $ subdirectory = ['idldata1','pass1']) imagesize =[1068,812] ;DIMENSIONS OF THE ORIGINAL IMAGE. image = read_image(file) ;THIS IS TO READ A IMAGE FILE. ;bordercolor = !d.table_size-1 ;topcolor = !d.table_size-1 ;successcolor = !d.table_size-1 ;unsuccesscolor = !d.table_size-1 ;tvlct ,255,0,0,topcolor ;TO EXTRACT RED COLOR. ;tvlct ,0,255,0,bordercolor ;tvlct ,0,0,255,successcolor ;tvlct ,0,255,255,unsuccesscolor ;image1 = REPLICATE(byte(0), imagesize[0]+22, imagesize[1]+22) ;image1[11,11] =image ;padDims = SIZE(image1, /DIMENSIONS) ;print ,image1[300,300] for i=0,811 do begin for j=0,1067 do begin IF image[j,i] EQ 200 THEN BEGIN image[j,i] = 254 END end end j=770 i=490 PRINT ,IMAGE[j,i] ;regiongrow, j,i,image1 ;minx = 1045 ;maxx = 0 ;miny = 789 ;maxy = 0 ;xlength = 0 ;ylength = 0 ;maxside = 0 ;minside = 0 ;ratio1 = 0 for i=0,811 do begin for j=0,1067 do begin IF image[j,i] EQ 254 THEN BEGIN regiongrow, j,i,image minx = 1045 maxx = 0 miny = 789 maxy = 0 xlength = 0 ylength = 0 maxside = 0.0 minside = 0.0 xcentre = 0 ycentre = 0 radius = 0 areacircle = 0.0 count =0 for k=0,811 do begin for l=0,1067 do begin IF image[l,k] EQ 150 THEN BEGIN IF l LE minx THEN BEGIN minx=l END ELSE BEGIN IF l GE maxx THEN BEGIN maxx=l END END IF k LE miny THEN BEGIN miny=k END ELSE BEGIN IF k GE maxy THEN BEGIN maxy=k END END end end end ; print,maxx ; print,minx ; print,maxy ; print,miny xlength = maxx-minx ylength = maxy-miny IF xlength LE yleNgth THEN BEGIN maxside = ylength minside = xlength xcentre = minx+UINT(minside/2) ycentre = miny+UINT(maxside/2) END ELSE BEGIN maxside = xlength minside = ylength xcentre = minx+UINT(maxside/2) ycentre= miny+UINT(minside/2) END radius = (float(minside)/2.0) areacircle = UINT((22*radius*radius)/7) for m=0,811 do begin for n=0,1067 do begin IF logical_and((image[n,m] EQ 150),(((n-xcentre)^2+(m-ycentre)^2) LE radius^2)) THEN BEGIN count=count+1 END END END arearatio =float(count)/float(areacircle) for m=0,811 do begin for n=0,1067 do begin IF logical_and((image[n,m] EQ 150),arearatio LE 0.80) THEN BEGIN image[n,m]=100 END ELSE BEGIN IF image[n,m] EQ 150 THEN BEGIN image[n,m] = 200 END END end end END END END WINDOW, 0, XSIZE=imagesize[0], YSIZE=imagesize[1], $ TITLE='ouput' im1 = rotate(image,7) TV , im1 write_tiff, 'output.tif' , image ;TO WRITE FINAL OUTPUT IMAGE. END