;THIS PROGRAM ILLUSTRATES FIRST PASS WHERE SIDE RATIO IS MEASURED IN ORDER TO DETERMINE CIRCULAR REGIONS(Bone Image 1). pro regiongrow ,x,y,im IF im[x,y] eq 255 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 circularbse1 device , decomposed = 0 loadct , 0 file = filepath('morphedbse1.tif' , $ subdirectory = ['idldata1']) imagesize =[1046,790] ;DIMENSIONS OF THE ORIGINAL IMAGE. image = read_image(file,/RGB) ;THIS IS TO READ A IMAGE FILE. image1 = REPLICATE(byte(0), imagesize[0]+22, imagesize[1]+22) image1[11,11] =image padDims = SIZE(image1, /DIMENSIONS) ;print ,image1[300,300] ;j=300 ;i=300 ;regiongrow, j,i,image1 for i=22,789 do begin for j=22,1045 do begin IF image1[j,i] EQ 255 THEN BEGIN regiongrow, j,i,image1 minx = 1045 maxx = 0 miny = 789 maxy = 0 xlength = 0 ylength = 0 maxside = 0.0 minside = 0.0 ratio1 = 0.0 for k=22,789 do begin for l=22,1045 do begin IF image1[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 xlength = maxx-minx ylength = maxy-miny IF xlength LE yleNgth THEN BEGIN maxside = ylength minside = xlength END ELSE BEGIN maxside = xlength minside = ylength END ratio1=float(minside)/float(maxside) for m=22,789 do begin for n=22,1045 do begin IF logical_and((image1[n,m] EQ 150),(ratio1 LE 0.66)) THEN BEGIN image1[n,m] = 50 END ELSE BEGIN IF image1[n,m] EQ 150 THEN BEGIN image1[n,m] =200 END END END END END END END WINDOW, 0, XSIZE=paddims[0], YSIZE=paddims[1], $ TITLE='ouput' im1 = rotate(image1,7) TV , im1 write_tiff, 'ouput(0.95).tif' , image1 ;TO WRITE FINAL OUTPUT IMAGE. END