;;; images.pro: to run this script, at the idl prompt type ;;; .run images ;;; ;;; this script shows how to load in an image, display and ;;; manipulate it ;;; ;;; requires graphics file calvin.gif go = strarr(1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, 'Read in gif file and display it' ; read in the gif file named calvin.gif and store it ; in the variable calvin1, and display it read_gif, 'calvin.gif', calvin1, r, g, b tvlct, r, g, b tv, calvin1 print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, 'Erase screen' ; erase screen erase print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, 'Dissolve image' ; use built-in dissolve function, which displays the image ; in scattered tiles and fills it all in dissolve, calvin1 print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, 'Read image from screen and store to another variable' print, 'Delete current window, open a new window print, 'Display newly saved image' ; read the current image in and store it in the variable calvin2, ; delete current window and open a new window with a title of a ; specific size, and display the new variable calvin2 calvin2 = tvrd() wdelete window, 0, xsize=512, ysize=384, title='SWIG Window' tv, calvin2 print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, 'Zoom in interactively' ; use the built-in zoom function, which allows one to zoom ; in interactively on the image displayed zoom print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, 'Add the image to itself' ; add the image to itself and display the results tv, calvin2 + calvin2 print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print,'Smooth image and add it to itself' ; smooth the image, add it to itself and display the results tvscl, calvin2 + smooth(calvin2,3) print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, 'Inverse video by subtracting max value' ; find the max of the image calvin2 and subtract it from ; calvin2 and display the results tv, calvin2 - max(calvin2) print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print,'Apply a median filter' ; apply a median filter using a neighborhood of 9 pixels tvscl, median(calvin2,9) print, 'Hit return to continue' readf, 0, go ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, 'Done!' end