pro regiongrow ,x,y,im IF im[x,y] eq 254 THEN BEGIN im[x,y] = 255 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 circularbse2pass1 device , decomposed = 0 loadct , 0 file = filepath('output.tif' , $ subdirectory = ['idldata1','bse2','bse2-vernoi']) imagesize =[1024,768] ;DIMENSIONS OF THE ORIGINAL IMAGE. image = read_image(file) ;THIS IS TO READ A IMAGE FILE. finalimage=image image1 = REPLICATE(byte(0), imagesize[0]+22, imagesize[1]+22) image1[11,11] =image padDims = SIZE(image1, /DIMENSIONS) ; Change below j and i values to extract different circular regions from the image. ; j and i acts as coordinates of some chosec pixel (pivot pixel) in the region. j=912 i=771 ;PRINT ,"value -" ;PRINT ,image1[j,i] ;regiongrow, j,i,image1 for y=0,789 do begin for x=0,1045 do begin if image1[x,y] ne 0 then begin image1[x,y]=254 end end end PRINT ,"value -" PRINT ,image1[j,i] cnt=0; IF image1[j,i] EQ 254 THEN BEGIN regiongrow, j,i,image1 cnt++; ;PRINT,j,i,cnt END ;WINDOW, 0, XSIZE=imagesize[0], YSIZE=imagesize[1], $ ;TITLE='ouput' ;im1 = rotate(imagea,7) ;TV , im1 for i=11,778 do begin for j=11,1034 do begin IF image1[j,i] EQ 255 THEN BEGIN finalimage[j-11,i-11]=image1[j,i] END ELSE BEGIN finalimage[j-11,i-11]=0 END end end WINDOW, 0, XSIZE=imagesize[0], YSIZE=imagesize[1], $ TITLE='ouput' im1 = rotate(finalimage,7) TV , im1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Write the Binary Image with only that region. ;write_tiff, 'idldata1\bse2\bse2-vernoi\Region_XX.tif' , finalimage ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; write_tiff, 'idldata1\bse2\bse2-vernoi\Region_57.tif' , finalimage ;TO WRITE FINAL OUTPUT IMAGE. END