Pro LinkWin, image On_Error,1 ; If there is no image parameter, open the worldelv.dat file. IF N_Elements(image) EQ 0 THEN BEGIN file = Filepath(Subdir='training', 'worldelv.dat') OpenR, lun, file, /Get_lun image = BytArr(360,360) ReadU, lun, image Free_lun, lun ENDIF ; What size is the image data? imsize = Size(image) IF imsize(0) NE 2 THEN $ Message, 'Sorry, this is not a 2D dataset' xsize = imsize(1) ysize = imsize(2) ; Establish box coordinate limits. boxmaxx = xsize - 50 boxmaxy = ysize - 50 boxminx = 50 boxminy = 50 ; Scale the image data so it can appear in two windows ; using different portions of the colortable. image1 = BytScl(image, Top=100) image2 = BytScl(image, Top=100) + 100B ; Load different colortables into the one physical table. LoadCt, 0, NColors=100, Bottom=0 ; Gray-scale LoadCt, 11, NColors=100, Bottom=100 ; Colored ; Create the two display windows. We will copy colored ; window onto gray-scale window. Window, /Free, XSize=xsize, YSize=ysize, $ Title='Click cursor here!' grayIndex = !D.Window Tv, image1 Window, /Free, XSize=xsize, YSize=ysize, $ Title='Click cursor in OTHER window!' colorIndex = !D.Window Tv, image2 ; Create a pixmap window for repairing window. Window, /Free, XSize=100, YSize=100, /Pixmap pixmapIndex = !D.Window ; Make the gray-scale window the current window. WSet, grayIndex WShow, grayIndex ; When the user clicks inside the window a 100x100 ; box is established. This box follows the cursor ; around the window until the RIGHT mouse button ; is clicked. !Err = 0 ; No buttons clicked. Cursor, x, y, /Device, /Down ; Make sure the box is in the window. x = boxminx > x < boxmaxx y = boxminy > y < boxmaxy ; Copy current window contents to pixmap. WSet, pixmapIndex Device, Copy=[x-50, y-50, 100,100, 0, 0, grayIndex] WSet, grayIndex ; Copy colored window to gray-scale window Device, Copy=[x-50, y-50, 100,100, x-50, y-50, colorIndex] ; Go into a loop. Follow the cursor around immediately. ; First, erase old overlay by copying from pixmap, then ; establish new overlay. WHILE (!Err NE 4) DO BEGIN Cursor, xx, yy, /Device, /NoWait ; Restore old gray colors in box. Device, Copy=[0, 0, 100,100, x-50, y-50, pixmapIndex] ; Get new box coordinates. x = boxminx > xx < boxmaxx y = boxminy > yy < boxmaxy ; Copy current window contents to pixmap. WSet, pixmapIndex Device, Copy=[x-50, y-50, 100,100, 0, 0, grayIndex] WSet, grayIndex ; Copy colored window to gray-scale window Device, Copy=[x-50, y-50, 100,100, x-50, y-50, colorIndex] ; Slow it down just a bit. Wait, 0.1 ENDWHILE ; Erase the window for the last time. Device, Copy=[0, 0, 100,100, x-50, y-50, pixmapIndex] ; Delete the pixmap WDelete, pixmapIndex END