;You need to compile "tvread.pro" to compile this IDL script. PRO finalvornoibse2 device , decomposed = 0 loadct , 0 ;output.tif is the gray scale version of final image of PHASE-II file = filepath('output.tif' , $ subdirectory = ['idldata1','bse2','bse2-vernoi']) imagesize =[1024,768] image = read_image(file) ;vornoi_bse2.tif is the gray scale version of vornoi-grid. file = filepath('vornoi_bse2.tif' , $ subdirectory = ['idldata1','bse2','bse2-vernoi']) imagesize1 =[1024,768] original = read_image(file) image1=image greencolor = !d.table_size-1 tvlct ,0,255,0,greencolor ;image1 = bytscl(image,top=greencolor-1) for i=0,767 do begin for j=0,1023 do begin IF image1[j,i] EQ 200 THEN BEGIN image1[j,i]=greencolor END END END redcolor = !d.table_size-2 tvlct ,255,0,0,redcolor for i=0,767 do begin for j=0,1023 do begin IF image1[j,i] EQ 50 THEN BEGIN image1[j,i]= redcolor END END END bluecolor = !d.table_size-3 tvlct ,0,0,255, bluecolor for i=0,767 do begin for j=0,1023 do begin IF image1[j,i] EQ 100 THEN BEGIN image1[j,i]= bluecolor END END END for i=0,767 do begin for j=0,1023 do begin IF ((image1[j,i] EQ redcolor)||(image1[j,i] EQ greencolor)||(image1[j,i] EQ bluecolor)) THEN BEGIN original[j,i]= image1[j,i] END END END WINDOW, 0, XSIZE=imagesize1[0], YSIZE=imagesize1[1], $ TITLE='ouput' im1 = rotate(original,7) TV , im1 ;write_tiff, 'output.tif' , image1 ;TO WRITE FINAL OUTPUT IMAGE. void = TVRead(/tiff, File='myimage') end