MERIS IDL General Purpose Tools

 

Image Library

Image Library

Last modified: Wed Dec 05 10:45:20 2001.


List of Routines


Routine Descriptions

ANALYZE_IMAGE

[Next Routine] [List of Routines]
 NAME:
	Analyze_Image

 PURPOSE:
	Create a widget to interactively control/execute the display & analysis
	of images obtained from MAMA or CCD detector integrations.

 CALLING:
	Analyze_Image

 KEYWORD INPUTS:

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the top level base of the
		new widget created by this procedure. If specified,
		this Analyze_Image widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 EFFECTS:
	Initiates the Xmanager if it is not already running.

 EXTERNAL CALLS:
	pro Xmanager
	pro widget_Location
	function CW_Bgroup
	function widget_Tree_Map
 COMMON BLOCKS:
	common Analyze_Image, analyze_widget
 PROCEDURE:
	Create the analyze_widget structure variable.
	Create and register the widgets with the Xmanager.
	Selection events are then processed by pro Analyze_Event.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See $IDL_LOCAL\image\analyze_image.pro)


CHGCOLOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CHGCOLOR

 PURPOSE:
       The purpose of this routine is to allow the user to change
       the color at a particular color index. The user is able to
       mix their own color by manipulating red, green, and blue
       sliders. This routine is ideal for changing axes or background
       colors of a plot, for example. The routine works on 8-bit,
       16-bit, and 24-bit displays.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438  
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets, Colors.

 CALLING SEQUENCE:
       CHGCOLOR, index

 REQUIRED INPUTS:
       INDEX: The color index to be changed. It must be a value
       between 0 and 255.

 KEYWORD PARAMETERS:

       LABEL: Text that goes next to the color window. The default is
       "Resulting Color".

       GROUP_LEADER: The group leader for this program. When the group leader
       is destroyed, this program will be destroyed.
      
       JUST_REGISTER: Setting this keyword just registers the program
       with the XMANAGER, but doesn't get the program started.

       NOTIFYID: A a 2 column by n row array that contains the IDs of widgets
       that should be notified when CHGCOLOR changes a color. The first
       column of the array contains widgets that should be notified. The 
       second column contains IDs of widgets that are at the top of the
       hierarch in which the corresponding widgets in the first column
       are located. (The purpose of the top widget IDs is to make it 
       possible for the widget in the first column to get the "info" 
       structure of the widget program.) An CHGCOLOR_LOAD event will be
       sent to the widget identified in the first column. The event 
       structure is defined like this:

       event = {CHGCOLOR_LOAD, ID:0L, TOP:0L, HANDLER:0L, $
          r:(!D.N_COLORS < 256), g:(!D.N_COLORS < 256), b:(!D.N_COLORS < 256)}

       The ID field will be filled out with NOTIFYID(0, n) and the TOP
       field will be filled out with NOTIFYID(1, n).

       TITLE: This is the window title. It is "Modify Drawing Color" by
       default. The program is registered with the name "chgcolor " plus
       the TITLE string. The register name is checked before the widgets
       are defined. This gives you the opportunity to have multiple copies
       of CHGCOLOR operating simultaneously. (For example, one will change
       the background color and one will change the plotting color.)

       XOFFSET: This is the X offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       YOFFSET: This is the Y offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       Color at the specified index is changed. Events are sent to widgets 
       if the NOTIFYID keyword is used. 

 RESTRICTIONS:
       None.

 EXAMPLE:
       To change the background color of a plot, type:

       CHGCOLOR, !P.Background

       To see a more complete example, look at the program SLICE
       in the Coyote Software Library:

          ftp://ftp.frii.com/pub/dfanning/outgoing/idl_examples

 MODIFICATION HISTORY:
       Written by David Fanning, 23 April 97. 
       12 May 97, Fixed a bug in the way colors were loaded when
          a tracking event occurred. DWF
       13 May 97, Added a JUST_REGISTER keyword and set it up for
          running in IDL 5.0 as a non-blocking widget.

(See $IDL_LOCAL\image\chgcolor.pro)


CMCONGRID

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CMCONGRID

 PURPOSE:
       Shrink or expand the size of an array by an arbitrary amount.
       This IDL procedure simulates the action of the VAX/VMS
       CONGRID/CONGRIDI function.

	This function is similar to "REBIN" in that it can resize a
       one, two, or three dimensional array.   "REBIN", however,
       requires that the new array size must be an integer multiple
       of the original size.   CONGRID will resize an array to any
       arbitrary size (REBIN is somewhat faster, however).
       REBIN averages multiple points when shrinking an array,
       while CONGRID just resamples the array.

 CATEGORY:
       Array Manipulation.

 CALLING SEQUENCE:
	array = CONGRID(array, x, y, z)

 INPUTS:
       array:  A 1, 2, or 3 dimensional array to resize.
               Data Type : Any type except string or structure.

       x:      The new X dimension of the resized array.
               Data Type : Int or Long (greater than or equal to 2).

 OPTIONAL INPUTS:
       y:      The new Y dimension of the resized array.   If the original
               array has only 1 dimension then y is ignored.   If the
               original array has 2 or 3 dimensions then y MUST be present.

       z:      The new Z dimension of the resized array.   If the original
               array has only 1 or 2 dimensions then z is ignored.   If the
               original array has 3 dimensions then z MUST be present.

 KEYWORD PARAMETERS:
       INTERP: If set, causes linear interpolation to be used.
               Otherwise, the nearest-neighbor method is used.

	CUBIC:	If set, uses "Cubic convolution" interpolation.  A more
		accurate, but more time-consuming, form of interpolation.
		CUBIC has no effect when used with 3 dimensional arrays.

       MINUS_ONE:
               If set, will prevent CONGRID from extrapolating one row or
               column beyond the bounds of the input array.   For example,
               If the input array has the dimensions (i, j) and the
               output array has the dimensions (x, y), then by
               default the array is resampled by a factor of (i/x)
               in the X direction and (j/y) in the Y direction.
               If MINUS_ONE is present (AND IS NON-ZERO) then the array
               will be resampled by the factors (i-1)/(x-1) and
               (j-1)/(y-1).

       HALF_HALF:
               If set, will tell CONGRID to extrapolate a *half* row
               and column on either side, rather than the default of
               one full row/column at the ends of the array.  If you
               are interpolating images with few rows, then the
               output will be more consistent with this technique.
               This keyword is intended as a replacement for
               MINUS_ONE, and both keywords probably should not be
               used in the same call to CONGRID.

 OUTPUTS:
	The returned array has the same number of dimensions as the original
       array and is of the same data type.   The returned array will have
       the dimensions (x), (x, y), or (x, y, z) depending on how many
       dimensions the input array had.

 PROCEDURE:
       IF the input array has three dimensions, or if INTERP is set,
       then the IDL interpolate function is used to interpolate the
       data values.
       If the input array has two dimensions, and INTERP is NOT set,
       then the IDL POLY_2D function is used for nearest neighbor sampling.
       If the input array has one dimension, and INTERP is NOT set,
       then nearest neighbor sampling is used.

 EXAMPLE:
       ; vol is a 3-D array with the dimensions (80, 100, 57)
       ; Resize vol to be a (90, 90, 80) array
       vol = CONGRID(vol, 90, 90, 80)

 MODIFICATION HISTORY:
       DMS, Sept. 1988.
       DMS, Added the MINUS_ONE keyword, Sept. 1992.
 	Daniel Carr. Re-wrote to handle one and three dimensional arrays
                    using INTERPOLATE function.
 	DMS, RSI, Nov, 1993.  Added CUBIC keyword.
       Craig Markwardt, Dec, 1997.  Added halfhalf keyword to
                        more evenly distribute "dead" pixel row
       Use uniformly spaced grid points for half_half W. Landsman   Feb. 2000
              (and slightly modified by C. Markwardt 14 Feb 2000)

  $Id: cmcongrid.pro,v 1.2 2001/06/28 09:10:28 chr Exp $

(See $IDL_LOCAL\image\cmcongrid.pro)


COLOR24

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       COLOR24

 PURPOSE:
       The purpose of this function is to convert a RGB color triple
       into the equivalent 24-big long integer. 

 CATEGORY:
       Graphics, Color Specification.

 CALLING SEQUENCE:
       color = COLOR24(rgb_triple)

 INPUTS:
       RGB_TRIPLE: A three-element column or row array representing 
       a color triple. The values of the elements must be between 
       0 and 255.

 KEYWORD PARAMETERS:
       None. 

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To convert the color triple for the color YELLOW, 
       (255, 255, 0), to the hexadecimal value '00FFFF'x 
       or the decimal number 65535, type:

       color = COLOR24([255, 255, 0])
       
       This routine was written to be used with routines like 
       COLORS or GETCOLOR

 MODIFICATION HISTORY:
       Written by:	David Fanning, 3 February 96.

(See $IDL_LOCAL\image\color24.pro)


COLORBAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   COLORBAR

 PURPOSE:
       Adds a color bar to the current graphics window.

 CATEGORY:
       Graphics, Widgets.

 CALLING SEQUENCE:
       COLORBAR

 INPUTS:
       None.

 KEYWORD PARAMETERS:

       BOTTOM:   The lowest color index of the colors to be loaded in
                 the bar.

       CHARSIZE: The character size of the color bar annotations. Default is 1.0.

       COLOR:    The color index of the bar outline and characters. Default
                 is !P.Color..

       DIVISIONS: The number of divisions to divide the bar into. There will
                 be (divisions + 1) annotations. The default is 6.

       FONT:     Sets the font of the annotation. Hershey: -1, Hardware:0, True-Type: 1.

       FORMAT:   The format of the bar annotations. Default is '(I5)'.

       MAXRANGE: The maximum data value for the bar annotation. Default is
                 NCOLORS.

       MINRANGE: The minimum data value for the bar annotation. Default is 0.

       MINOR:    The number of minor tick divisions. Default is 2.

       NCOLORS:  This is the number of colors in the color bar.

       POSITION: A four-element array of normalized coordinates in the same
                 form as the POSITION keyword on a plot. Default is
                 [0.88, 0.15, 0.95, 0.95] for a vertical bar and
                 [0.15, 0.88, 0.95, 0.95] for a horizontal bar.
;
       RANGE:    A two-element vector of the form [min, max]. Provides an
                 alternative way of setting the MINRANGE and MAXRANGE keywords.

       RIGHT:    This puts the labels on the right-hand side of a vertical
                 color bar. It applies only to vertical color bars.

       TITLE:    This is title for the color bar. The default is to have
                 no title.

       TOP:      This puts the labels on top of the bar rather than under it.
                 The keyword only applies if a horizontal color bar is rendered.

       VERTICAL: Setting this keyword give a vertical color bar. The default
                 is a horizontal color bar.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       Color bar is drawn in the current graphics window.

 RESTRICTIONS:
       The number of colors available on the display device (not the
       PostScript device) is used unless the NCOLORS keyword is used.

 EXAMPLE:
       To display a horizontal color bar above a contour plot, type:

       LOADCT, 5, NCOLORS=100
       CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $
          C_COLORS=INDGEN(25)*4, NLEVELS=25
       COLORBAR, NCOLORS=100, POSITION=[0.15, 0.85, 0.95, 0.90]

 MODIFICATION HISTORY:
       Written by: David Fanning, 10 JUNE 96.
       10/27/96: Added the ability to send output to PostScript. DWF
       11/4/96: Substantially rewritten to go to screen or PostScript
           file without having to know much about the PostScript device
           or even what the current graphics device is. DWF
       1/27/97: Added the RIGHT and TOP keywords. Also modified the
            way the TITLE keyword works. DWF
       7/15/97: Fixed a problem some machines have with plots that have
            no valid data range in them. DWF
       12/5/98: Fixed a problem in how the colorbar image is created that
            seemed to tickle a bug in some versions of IDL. DWF.
       1/12/99: Fixed a problem caused by RSI fixing a bug in IDL 5.2. Sigh... DWF.
       3/30/99: Modified a few of the defaults. DWF.
       3/30/99: Used NORMAL rather than DEVICE coords for positioning bar. DWF.
       3/30/99: Added the RANGE keyword. DWF.
       3/30/99: Added FONT keyword. DWF
       5/6/99: Many modifications to defaults. DWF.
       5/6/99: Removed PSCOLOR keyword. DWF.
       5/6/99: Improved error handling on position coordinates. DWF.
       5/6/99. Added MINOR keyword. DWF.
       5/6/99: Set Device, Decomposed=0 if necessary. DWF.
       2/9/99: Fixed a problem caused by setting BOTTOM keyword, but not NCOLORS. DWF.
       8/17/99. Fixed a problem with ambiguous MIN and MINOR keywords. DWF
       8/25/99. I think I *finally* got the BOTTOM/NCOLORS thing sorted out. :-( DWF.
       10/1099. Modified the program so that current plot and map coordinates are
            saved and restored after the colorbar is drawn.

(See $IDL_LOCAL\image\colorbar.pro)


COLORBAR__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       COLORBAR__DEFINE

 PURPOSE:
       The purpose of this routine is to implement a COLORBAR object
       class. The ColorBar is rendered in the direct graphics system.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Graphics.

 CALLING SEQUENCE:
       colorbar = Obj_New("COLORBAR")

 INPUTS:
       All inputs to the program are via keyword parameters.

 KEYWORD PARAMETERS:

   Background: Background color. This is the color with which the colorbar is
               erased. The default color is !P.Background.
   Bottom: Bottom color index of colors allocated to colorbar.
   Charsize: Character size of annotation. Default is 1.0.
   Color: Color of annotation and outline. Default is !P.Color.
   Font: Font to use for annotation. Default is -1, Hershey fonts.
   Format: Format of annotation. Default is "(F8.2)".
   Major: The number of major tick intervals. Default is 5.
   Minor: The number of minor tick intervals. Default is 2.
   MinusOne: Set this keyword to choose MinusOne keyword on the Congrid command
               that resizes the colorbar into the window.
   NColors: The number of colors allocated to colorbar. Default is (256 < !D.N_Colors).
   Neighbor: Set to indicate Nearest Neighbor sampling for Congrid. Default is 0 (Bilinear).
   Position: The position of colorbar in normalized coordinates. Default for a horizontal
               colorbar is [0.15, 0.88, 0.85, 0.95]. Default for a vertical colorbar is
               [0.88, 0.15, 0.95, 0.85]. These defaults are designed for a 400 by 400 window.
   Range: The data range on colorbar. Default is [0, 255].
   TickLen: The length of tick marks. Default is 0.2.
   Title: The title of the color bar. Default is a null string.
   Vertical: Set this keyword if you want a vertical colorbar. Default is horizontal.
   XEraseBox: A five-element vector of X points (normalized) for erasing the colorbar plot.
               Normally this keyword will not have to be used. The program uses the plot
               REGION for erasing. But larger character sizes can result in annotation going
               outside the region enclosed by the plot. If that is the case, then use this
               keyword along with YEraseBox to specify a larger-than-normal erasure area.
               The points are sent to the POLYFILL command for erasing.

                 POLYFILL, xEraseBox, yEraseBox, /Normal, Color=background

   YEraseBox: A five-element vector of Y points (normalized) for erasing the colorbar plot.

 OBJECT METHODS:

   Draw: This procedure method draws the colorbar in the display window. The ERASE keyword
               to this method will erase the current colorbar (by calling the ERASE method)
               before drawing the colorbar in the display window.

               colorbar->Draw

   Erase: This procedure method erases the colorbar object in the window. It accomplishes
               this by performing a POLYFILL in the background color. This method is
               primarily useful for interactive graphics display devices.

               colorbar->Erase

   GetProperty: This procedure method allows one to obtain the current state of the
               object via the keyword parameters listed above.

               colorbar->GetProperty, Range=currentRange, Title=currentTitle
               Print, currentRange, currentTitle

   SetProperty: This procedure method allows one to set the properties of the colorbar
               object via the keywords described above. In addition, a DRAW and ERASE
               keyword are provided so that the colorbar can be immediately drawn when
               the new property is set.

               colorbar->SetProperty, Range=[500, 15000], /Erase, /Draw

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       The display window is not erased first.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To create a colorbar, use it, then destroy it, type:

       colorbar = Obj_New("COLORBAR", Title='Colorbar Values', Range=[0,1000], Format='(I4)')
       Window
       LoadCT, 5
       colorbar->Draw
       colorbar->SetProperty, Range=[0,500], /Erase, /Draw
       Obj_Destroy, colorbar

 MODIFICATION HISTORY:
       Written by: David Fanning, Fanning Software Consulting, 26 November 1998.
       Added Horizontal keyword to SetProperty method and fixed problem in going
          from Vertical to Horizontal color bars. 29 Nov 1998. DWF.
       Added LoadCT method and current color table index to object. 6 December 1998.
       Fixed a bug dealing with nearest neighbor resampling. 30 Mar 1999. DWF.
       Fixed a bug with how NCOLORS and BOTTOM keywords interacted. 29 Aug 1999. DWF.
       10/1099. Modified the program so that current plot and map coordinates are
            saved and restored after the colorbar is drawn. DWF.

(See $IDL_LOCAL\image\colorbar__define.pro)


CW_ZOOM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CW_ZOOM

 PURPOSE:
	This compound widget displays two images: an original image
	in one window and a portion of the original image in another.
	The user may select the center of the zoom region, the zoom scale,
	the interpolation style, and the method of indicating the zoom center.

 CATEGORY:
	Compound widgets.

 CALLING SEQUENCE:
	Widget = CW_ZOOM(Parent)

 INPUTS:
       Parent:	 The ID of the parent widget.

 KEYWORD PARAMETERS:
	FRAME:	 If set, a frame will be drawn around the widget. The
		 default is FRAME=0 (no frame).
	MAX:	 The maximum zoom scale, which must be greater than
		 or equal to 1. The default = 20.
	MIN:	 The minimum zoom scale, which must be greater than
		 or equal to 1. The default = 1.
	RETAIN:	 Controls the setting for backing store for both windows.
		 If backing store is provided, a window which was obscured
		 will be redrawn when it becomes exposed. Set RETAIN=0 for
		 no backing store. Set RETAIN=1 to "request backing store
		 from server" (this is the default). Set RETAIN=2 for IDL
		 to provide backing store.
	SAMPLE:	 Set to zero for bilinear interpolation, or to a non-zero
		 value for nearest neighbor interpolation. Bilinear
		 interpolation gives higher quality results, but requires
		 more time. The default is SAMPLE=0 (bilinear interpolation).
	SCALE:	 The initial integer scale factor to use for the zoomed image.
		 The default is SCALE=4. The scale must be greater than or
		 equal to 1.
	TRACK:	 Set to zero if the zoom window should be updated only when
		 the mouse button is pressed. Set to a non-zero value if the
		 zoom window should be updated continuously as the cursor
		 is moved across the original image. Note: On slow systems,
		 /TRACK performance can be inadequate. The default is TRACK=0.
	UVALUE:	 The user value for the widget.
	XSIZE:	 The width of the window (in pixels) for the original image.
		 The default is 500.
	YSIZE:	 The height of the window (in pixels) for the original image.
		 The default is 500.
	X_SCROLL_SIZE: The width of the visible part of the original image.
		       This may be smaller than the actual width controlled
		       by the XSIZE keyword. The default is 0, for no
		       scroll bar.
	Y_SCROLL_SIZE: The height of the visible part of the original image.
		       This may be smaller than the actual height controlled
		       by the YSIZE keyword. The default is 0, for no
		       scroll bar.
	X_ZSIZE: The width of the window for the zoomed image.
		 The default is 250.
	Y_ZSIZE: The height of the window for the zoomed image.
		 The default is 250.

 OUTPUTS:
       The ID of the created widget is returned.

 SIDE EFFECTS:
	When the "Report Zoom to Parent" button is pressed, this widget
	will generate an event structure containing several data fields.
		x_zsize, y_zsize:	size of the zoomed image
		x0, y0:			lower left corner in original image
		x1, y1:			upper right corner in original image
	This event is a report to the parent that allows retrieval of the
	zoomed image using WIDGET_CONTROL.

 PROCEDURE:
	WIDGET_CONTROL, id, SET_VALUE=value can be used to change the
		original, unzoomed image displayed by the widget.
		The value may not be set until the widget has been
		realized.

	WIDGET_CONTROL, id, GET_VALUE=var can be used to obtain the current
		zoomed image displayed by the widget.

 MODIFICATION HISTORY:
	June 30, 1992, ACY
       7 April 1993, AB, Removed state caching.
	13 June, 1994, ACY, Save window and set to zoom prior to erase
			    Add byte conversion in set_value
	23 November, 1994, ACY, add code to handle cases in which the
			set_value image is larger or smaller than the
			original image.  Also remove scaling on display
			operation (only scale the image when it is set.)

(See $IDL_LOCAL\image\cw_zoom.pro)


EXTRACT_REGION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	extract_region

 PURPOSE:
	Interactively extract a sub-region of image array, using mouse.
	Optionally, sub-region can be specified by entering position & size.
	To active this option, press the MIDDLE mouse button first, then
	widget will appear into which region position & size can be typed.

 CALLING:
	imsub = extract_region( image )

 INPUTS:
	image = 2D array.

 KEYWORDS:
	VALUE_FILL = value to use in filling empty pixels of result, default=0.
	SIZE_REGION = 2 integers, desired size of extracted region,
			default is variable (interactive).
	MAGNIFICATION = magification factor of displayed image.
	WINDOW = IDL window number for displayed image.
	WPOS_XY = 2 integers, position of displayed image in window coordinates.

	/LIMIT_REGION : selection of region is limited to actual image size.
	/ERASE_BOX : erase the region selection box upon completion (def=no).
	/DISPLAY : automatically create a window and display the image.
	/LOG10 : display ( image > 1 ) in Log base 10 scaling.
	LOG10 = ( image > LOG10 ) is displayed in Log base 10 scaling.

 KEYWORD OUTPUTS:
	SIZE_REGION = 2 integers, actual size of extracted region.
	START_XY = 2 integers, begining Location of extracted region.
	LAST_XY = 2 integers, ending Location of extracted region.

 OUTPUT:
	Function returns the extracted image array,
	which is a subset, or possibly an extension, of input image.

 EXTERNAL CALLS:
	pro get_window
	pro box_cursor
	function box_create
	pro box_erase
 COMMON BLOCKS:
	common extract_region, xy_region	;saved position & size.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.
	F.V. 1994: options to fix sub-region and edit position & size.

(See $IDL_LOCAL\image\extract_region.pro)


GETCOLOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GETCOLOR

 PURPOSE:
       The purpose of this function is to return the value of a
       "named" color. The result is a 1-by-3 vector containing
       the values of the color triple if the user specified a
       a particular color. Or it is a 5-by-3 array containing the
       color triples of all 5 supported color if no positional 
       parameter is passed.

 CATEGORY:
       Graphics, Color Specification.

 CALLING SEQUENCE:
       result = GETCOLOR(color)

 OPTIONAL INPUTS:
       COLOR: A string with the "name" of the color. Five colors
              are allowed: "CHARCOAL", "RED", "GREEN", "BLUE" and "YELLOW".
              If the string is anything else, a YELLOW color triple is
              returned.

 KEYWORD PARAMETERS:
       TRUE:  If this keyword is set the specified color triple is returned
              as a 24-bit integer equivalent. The lowest 8 bits correspond to
              the red value; the middle 8 bits to the green value; and the
              highest 8 bits correspond to the blue value. 

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       The TRUE keyword is operational only if the input COLOR is present.

 EXAMPLE:
       To load a yellow color in color index 100 and plot in yellow, type:
       
          TVLCT, GETCOLOR('yellow'), 100
          PLOT, data, COLOR=100

       To do the same thing on a 24-bit color system, type:
       
          PLOT, data, COLOR=GETCOLOR('yellow', /TRUE)
       
       To load all five colors into the current color table, starting at
       color index 200, type:

          TVLCT, GETCOLOR(), 200

 MODIFICATION HISTORY:
       Written by: David Fanning, 10 February 96.
       Fixed a bug in which N_ELEMENTS was spelled wrong. 7 Dec 96.

(See $IDL_LOCAL\image\getcolor.pro)


GETIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GETIMAGE

 PURPOSE:
       The purpose of this function is to allow the user to open either
       regular or XDR binary image files of two or three dimensions.

 CATEGORY:
       Widgets, File I/O.

 CALLING SEQUENCE:
       image = GETIMAGE(filename)

 INPUTS:
       filename: The name of the file to open for reading.

 KEYWORD PARAMETERS:

       DIRECTORY: The name of the directory the file is located in. By
       default the program looks in the "training" directory under the
       main IDL directory, if one exists. Otherwise, it defaults to the
       current directory.

       FRAMES: The 3rd dimension of a 3D data set. Defaults to 0.

       HEADER: The size of any header information in the file in BYTES.
       Default is 0.

       PARENT: The group leader for this widget program. The PARENT is
       required if GETIMAGE is called from another widget program.

       XDR: Set this keyword if the binary file is of XDR type.

       XOFFSET: This is the X offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       XSIZE: The size of the 1st dimension of the data.

       YOFFSET: This is the Y offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       YSIZE: The size of the 2nd dimension of the data.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       A "CANCEL" operation is indicated by a 0 return value.
       Any error in reading the file results in a 0 return value.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To load the image "galaxy.dat" in the $IDL/examples/data
       directory, type:

       image = GETIMAGE('galaxy.dat', DIRECTORY=!DIR + '/examples/data', $
          XSIZE=256, YSIZE=256)

 MODIFICATION HISTORY:
       Written by: David Fanning, 3 February 96.
       Fixed bug that prevented reading INTEGER data. 19 Dec 96.
       Modifed program for IDL 5 MODAL operation. 19 Oct 97.

(See $IDL_LOCAL\image\getimage.pro)


IMAGEMAP

[Previous Routine] [Next Routine] [List of Routines]
NAME:
      IMAGEMAP


PURPOSE:
   displays a geolocated image on a map projection
   If a map projection is not currently defined, then a Mercator
   map projection is created which corresponds to the
   lat/lon limits of the image.

CALLING SEQUENCE:
   IMAGEMAP, IMAGE, LAT, LON

INPUT:
   IMAGE      Array (2D) or vector (1D) of image values
   LAT        Array or vector of latitudes corresponding to image values
              (degrees, -90.0 = S, +90.0 = N)
   LON        Array or vector of longitudes corresponding to image values
              (degrees, -180.0 = W, +180.0 = E)

OPTIONAL KEYWORDS:
   NEWIMAGE   Named variable in which resampled image array is returned.
              Note that this image is always scaled to a BYTE array.
   RANGE      Range of image values used for brightness scaling, [MIN,MAX]
              (default is [MIN(IMAGE),MAX(IMAGE)])
   LIMIT      Limits of map display, [LATMIN,LONMIN,LATMAX,LONMAX]
              (default is [MIN(LAT),MIN(LON),MAX(LAT),MAX(LON)])
   POSITION   Normalized coordinates for map display window [X1,Y1,X2,Y2]
              (default is to let MAP_SET determine the window size)
              This is useful when used in conjunction with the
              ESRG BOXPOS procedure. For example,
              IMAGEMAP, IMAGE, LAT, LON, POS = BOXPOS( /RMARG )
              will leave room at the right for a COLOR_KEY colorbar.
   ISOTROPIC  If set, creates an isotropic map projection (default=non-isotropic).
   TITLE      String variable containing image title (default=no title).
   XOFFSET    Named variable in which the lower left device X coordinate
              of the displayed image is returned.
   YOFFSET    Named variable in which the lower left device Y coordinate
              of the displayed image is returned.
   XSIZE      Named variable in which the width of the displayed image
              is returned (used by devices which have scalable pixels
              such as Postscript).
   YSIZE      Named variable in which the height of the displayed image
              is returned (used by devices which have scalable pixels
              such as Postscript).
   MISSING    Byte value to use for missing (unfilled) portions of image
              (default is zero).
   NOBORDER   If set, do not draw border around image (default=draw border).
   NOERASE    If set, do not erase window before creating image (default=erase).
   LOWRES     If set, draw image in low resolution mode (default=high resolution).
   CURRENT    If set, use the current map projection.

OUTPUT:
   The resampled image is displayed in the current graphics window
   in map coordinates. Continental outlines and lat/lon grids may be
   overlaid with MAP_CONTINENTS AND MAP_GRID.

CREATED:
   Liam Gumley, CIMSS/SSEC, 26-JUL-1996
   liam.gumley@ssec.wisc.edu
   http://cimss.ssec.wisc.edu/~gumley/index.html

REVISED:
   Liam Gumley, CIMSS/SSEC, 17-SEP-1996
   Modified to work with Postscript output.
   Added XOFFSET, YOFFSET, XSIZE, YSIZE keywords.
   Mercator map projection is now created only if no map projection exists.

   Liam Gumley, CIMSS/SSEC, 15-OCT-1996
   Added MISSING keyword to set missing values in image.
   Added NOBORDER keyword.

   Liam Gumley, CIMSS/SSEC, 25-NOV-1996
   Now uses MISSING keyword properly.
   Added NOERASE keyword.
   Added LOWRES keyword (useful for low resolution images, e.g. HIRS, AMSU).

   Liam Gumley, CIMSS/SSEC, 26-MAR-1999
   Now uses NOERASE keyword properly.

   Liam Gumley, CIMSS/SSEC, 13-AUG-1999
   Added CURRENT keyword.

NOTES:
   (1) Hermann Mannstein (h.mannstein@dlr.de) suggested this IDL method.
   (2) This has been tested on MAS, AVHRR, GOES, and simulated MODIS data.
       It will not work well on low resolution data like HIRS or MSU.
   (3) You might run into problems with data over the poles - I've only
       tried mid-latitude imagery.
   (4) This procedure was designed for display purposes *only*.
       If you use the resampled data for any other purpose, you do so at
       your own risk.
   (5) The example takes about 15.6 seconds to execute
       on a SGI Power Indigo2 (R8000/75MHz) with 256 MB RAM.

EXAMPLE:

; This example is adopted from the ESRG library 'REGRID' procedure.
; First, create latitude, longitude, and image arrays at 250x200 size.
;
c = complex(2,2) + cmplxgen(250,200,/center)/100
c = c + c^2
lon = float(c) - 100.0
lat = 20 + imaginary(c)
image = sqrt(abs(sin(lon*!pi)*sin(lat*!pi)))^0.3
;
; Resize arrays to simulate 1km resolution imagery.
;
lat = congrid(lat,1000,800,interp=1)
lon = congrid(lon,1000,800,interp=1)
image = congrid(image,1000,800,interp=1)
;
; Resample data to Mercator projection, and overlay coastline and grid
;
t0 = systime(1.0)
imagemap,image,lat,lon
print,'Elapsed time (sec) = ',systime(1.0)-t0
map_continents
map_grid

(See $IDL_LOCAL\image\imagemap.pro)


IMAGE_REGISTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	    IMAGE_REGISTER
 PURPOSE:
	Widget-based program to determine the geometric registration
       between two images of the same scene. Uses affine transformations
       to calculate relative scaling, rotation, displacement, and shear.

 CALLING SEQUENCE:
	image_register,im1,im2,x,xp
 INPUTS:
	im1 - image 1, defined as the "reference image"
       im2 - image 2, image to be aligned/scaled/rotated to image 1.

 OUTPUT:
	x   - vector of points [2,N] where [0,N] are the x-values of
             reference tie points selected by the user and [1,N} are
             the y-values.
	xp  - vector of identical points located by the user in image2.

 KEYWORDS:
       center - not implemented yet.

       output - STRING filename. If set, program writes X and XP to
                the file specified by the string filename.

 USEAGE:
       Upon calling, a widget with four display areas opens. In the
       left half of the widget the reference image (im1) is displayed
       with a 4X zoom in the zoom window. In the right half, im2 is
       similarly displayed. The user selects a point in im1 using
       the mouse and the left button. The user then finds this exact
       same point in im2 and selects it using the mouse. For a robust
       solution, usually more than 10 points are required.

       If an incorrect selection is made, use the EDIT>Undo Selection
       menu item.

       To see the points selected use the DISPLAY>selections menu
       item.

       To print the current solution in the active IDL window, use
       the TRANSFORM>affine menu selection. Repeat this step periodically
       during the selection process to see if the solution is converging.
       In some cases, mis-paired points may cause the solution to
       converge to erroneous values; this requires a restart of the
       procedure.

 NOTES:
       Uses AFFINE_SOLVE.PRO to determine the affine transformation

 REVISION HISTORY:
	Written    T. Berger              20-April-1998

(See $IDL_LOCAL\image\image_register.pro)


IMDISP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    IMDISP

 PURPOSE:
    Display an image on the current graphics device.
    IMDISP is an advanced replacement for TV and TVSCL.

    -> Indexed color and True color images are handled automatically,
    -> 8-bit and 24-bit graphics devices  are handled automatically,
    -> Decomposed color settings are handled automatically,
    -> Supports WIN, MAC, X, CGM, PCL, PRINTER, PS, and Z graphics devices,
    -> Image is automatically sized to fit the display (can be disabled),
    -> Image is automatically byte-scaled (can be disabled),
    -> The !P.MULTI system variable is honored for multiple image display,
    -> Image can be positioned via the POSITION keyword,
    -> Color table customization via the BOTTOM and NCOLORS keywords,
    -> Image aspect ratio customization via the ASPECT keyword,
    -> Resized images can be resampled (default) or interpolated,
    -> Top down image display via the ORDER keyword (!ORDER is ignored).

 CATEGORY:
    Image display

 CALLING SEQUENCE:
    IMDISP, IMAGE

 INPUTS:
    IMAGE       Array containing image data.
                Indexed color images must have 2 dimensions.
                True color images must have 3 dimensions, in either
                [3, NX, NY], [NX, 3, NY], or [NX, NY, 3] form.

 OPTIONAL INPUTS:
    None.

 KEYWORD PARAMETERS:
    BOTTOM      Bottom value in the color table to be used
                for the byte-scaled image.
    NCOLORS     Number of colors in the color table to be used
                for the byte-scaled image.
    MARGIN      A scalar value specifying the margin to be maintained
                around the image in normal coordinates (default is 0.1).
    INTERP      If set, the resized image will be interpolated using
                bilinear interpolation (default is nearest neighbor sampling).
    DITHER      If set, true color images will be dithered when displayed
                on an 8-bit graphics device (default is no dithering).
    ASPECT      A scalar value specifying the aspect ratio (height/width)
                for the displayed image (default is to maintain native
                aspect ratio).
    POSITION    On input, a 4-element vector specifying the position
                of the displayed image in the form [X0,Y0,X1,Y1] in
                in normal coordinates (default is [0.0,0.0,1.0,1.0]).
                The image will be displayed inside the given position
                while maintaining aspect ratio.
    OUT_POS     On output, a 4-element vector specifying the position
                actually used to display the image.
    NOSCALE     If set, the image will not be byte-scaled.
    NORESIZE    If set, the image will not be resized.
    ORDER       If set, the image is displayed from the top down
                (default is to display the image from the bottom up).
                Note that the system variable !ORDER is always ignored.

 OUTPUTS:
    None.

 OPTIONAL OUTPUTS:
    None

 COMMON BLOCKS:
    None

 SIDE EFFECTS:
    The image is displayed on the current graphics device.

 RESTRICTIONS:
    Requires IDL 5.0 or higher (square bracket array syntax).

 EXAMPLE:

;- Load test data

openr, lun, filepath('ctscan.dat', subdir='examples/data'), /get_lun
ctscan = bytarr(256, 256)
readu, lun, ctscan
free_lun, lun 
openr, lun, filepath('hurric.dat', subdir='examples/data'), /get_lun
hurric = bytarr(440, 330)
readu, lun, hurric
free_lun, lun
read_jpeg, filepath('rose.jpg', subdir='examples/data'), rose
help, ctscan, hurric, rose

;- Display single images

!p.multi = 0
erase
loadct, 0
imdisp, ctscan
wait, 3.0
erase
loadct, 13
imdisp, hurric, margin=0
wait, 3.0
erase
imdisp, rose, /interp
wait, 3.0

;- Display multiple images without color table splitting
;- (works on 24-bit displays only; top 2 images are garbled on 8-bit displays)

!p.multi = [0, 1, 3, 0, 0]
loadct, 0
imdisp, ctscan, margin=0.02
loadct, 13
imdisp, hurric, margin=0.02
imdisp, rose, margin=0.02
wait, 3.0

;- Display multiple images with color table splitting
;- (works on 8-bit or 24-bit displays)

!p.multi = [0, 1, 3, 0, 0]
loadct, 0, ncolors=64, bottom=0
imdisp, ctscan, margin=0.02, ncolors=64, bottom=0
loadct, 13, ncolors=64, bottom=64
imdisp, hurric, margin=0.02, ncolors=64, bottom=64
imdisp, rose, margin=0.02, ncolors=64, bottom=128
wait, 3.0

;- Display an image with contour plot overlay

!p.multi = 0
erase
loadct, 0
imdisp, hurric, out_pos=pos
contour, smooth(hurric, 10, /edge), /noerase, pos=pos, $
  xstyle=1, ystyle=1, levels=findgen(5)*40.0, /follow
wait, 3.0

;- Display a small image with correct resizing

!p.multi = 0
erase
loadct, 0
data = (dist(8))[1:7, 1:7]
imdisp, data
wait, 3.0
imdisp, data, /interp
wait, 3.0

;- Display a true color image without and with interpolation

!p.multi = 0
erase
imdisp, rose, margin=0
wait, 3.0
erase
imdisp, rose, margin=0, /interp

 MODIFICATION HISTORY:
 Liam.Gumley@ssec.wisc.edu
 http://cimss.ssec.wisc.edu/~gumley
 $Id: imdisp.pro,v 1.2 2001/06/28 09:10:30 chr Exp $

 Copyright (C) 1999, 2000 Liam E. Gumley

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

(See $IDL_LOCAL\image\imdisp.pro)


LOOK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	    look
 Purpose:
       This procedure produces a widget to view an image or series of images.
         o You roam in a grid of 2x2 windows with menus on three sides.
         o The plots are dynamic: horizontal and vertical cuts are updated
           as you move the mouse over the full and zoom images.
         o Zoom by dragging the left mouse over the full image.
         o Select numerous options in the Options menu,
           - blink compare (between 2 or more images)
           - movies (all or selected images)
           - catalogs (all or selected images)
           - enlargements (to window and to entire screen)
           - plots (surface, shade_surf, show3, etc.)
           - regions of interest
           - spatial filters, and ...
         o Look is extensible: you can define
           - one loading function, and
           - procedures and functions for display and image processing, e.g.,
               look_fourier - to filter square images
               lego, image_cont, threed, etc. - any IDL pro using 2-D param
               roberts, sin, alog10, etc. - any IDL function using 2-D arg
         o Read more on operation below.  Here's a rendition:
              -----------------------------------------------------
              | Done  | cuts:           |                 | full  |
              |       |   vertical ---> |      plot/      |   &   |
              |xloadct|   horizontal    |   zoom region   | zoom  |
              |switch |            |    |            /|\  | stats |
              |       |------------|------------------|---|       |
              |Options|           \|/   | cuts:       |   |Incre* |
              | menu  |    tv/roam      |    horizontal   |Select*|
              |       |   full image    | <--- vertical   |       |
              |filter |                 |                 |       |
              | slider|-----------------------------------|       |
              | dim3  | plot min slider | plot max slider |       |
              | ...   | =======|======= | =======|======= |       |
              | dim7  | Autoscale/Fixed | Autoscale/Fixed |       |
              -----------------------------------------------------
              | instructions or comments                          |
              -----------------------------------------------------
 Examples:
       look                    ; 1) Test with test images
       images = randomu(seed,10,10,100)
       look,images             ; 2) Display series of 2-D images
       look,/noload            ; 3) Use existing images from common
       common look             ; 4) To access the stored images at main level
       look,/help              ; 5) Just display the look.pro header
       look,/assoc		; 6) Use an associate variable; prompt for
       			;    file and definition of variable.
       			; OR
       file = 'existing_file'
       definition = 'intarr(128,128)'
       look,/assoc,file=file,definition=definition
       			;    The associate variable can have
       			;    additional variables---with a tag.
       definition = '{struct,header:bytarr(100),data:intarr(128,128)}'
       			;    Up to v3.6, the structure has to be named!
       look,/assoc,tag=1,file=file,definition=definition
       			;   use tag #1 (data) in the structure
       look,loader_name='getdata',d imensions=[3,4,5]
       			; 7) Use getdata.pro to obtain the set of
       			;    3x4x5 images,
       			;    each of size returned by getdata.
       			;    Here 3 dimension sliders will be used.
       look,procedures='process'
       			; 8) Add processing procedures, e.g., to use
       			;    YOUR OWN process.pro to
       			;    modify the current image.
       look,functions=['roberts','sobel']
       			; 9) Add edge filters to Options menu
       look,options=['db','look_fourier','tv'],types=['f','p','p']
       			; 10)Add functions and procedures together.
       			;    Specifying types avoids search of !path.
       look,userscalefunc=['bytscl','myfunc']
                               ; 11)Add custom functions to auto scaling menu
       look,axes=['frame','index','a,b,c,d,e']
                               ; 12) Replace 'dim 3' label with 'frame', etc.
       look,dim5marks=['raw counts','scaled counts','temperature','radiance']
                               ; 13) Replace 'dim 5' label with a pulldown
                               ;     menu to select the dim5 index.
       tmp = {mark,mark:0l,tag:''}
       look,dim5marks=[{mark,3500,'slew start'},{mark,3650,'slew stop'}]
                               ; 14) Same result as 13) but input is a
                               ;     structure array.  This allows
                               ;     quick-access marks to be placed in the
                               ;     data, so the user can jump to them.
                               ;     The tagsname and structure name are
                               ;     arbitrary, but you need two tags:
                               ;     (0)=int/long and (1)=string
       look,units=['azimuth (200 !3m!5rad pixels)','elevation','counts']
                               ; 15) Replace image dimensions and image value
                               ;     names with the 3 elements of units,
                               ;     e.g. 'y (pixels)' --> 'elevation'
                               ;     These are stored in common look_common
                               ;     in the 'all' structure, so they can be
                               ;     altered by the routine to fetch images,
                               ;     see units in Keywords section below.
 Loading Images:
	There are four ways to load data into look:
         1. Pass images as a parameter: look,images
         2. Load images into common look and call: look,/noload
         3. Access images in a file via associate variable: look,/assoc,...
         4. Give look a function that returns images: look,loader='getdata',...
 Operation:
       1. The basic thing is to roam around the image and look at cuts.
          Buttons, sliders and lists control other features.
       2. The mouse buttons control the following, on the full image.
                  \        ______
                   \______/      \
                                  |   __________
                     ____   ______|__/___       Middle button:
          Left button:   \ |        /    |       Click to recenter
           Click & drag   \|  _   _/  _  |       the zoom region.
           on full image   \ |l| | | | | |
           to define       |\|e| |m| |r|\|
           the zoom        | |f| |i| |t| \
           window.         | |t| |d| | | |\____
           Select options. | |_| |_| |_| |     Right button:
                           |             |      Click to do controlled move
                           |             |      of one quantity (*'d),
                           |             |      e.g., the zoom center
                           |_____________|      in the x direction.

       3. The plot buttons can be selected at any time.
          The plots appear in the zoom window (by default) or both windows.
          Toggle the "Use Full & Zoom" button to get either
            a. the plot of the full image in the zoom window or
            b. the plot of the zoom image in the full window or
            c. 2 plots: zoom and full in the 2 windows.
       4. To zoom, click and drag the left mouse over the region of interest.
          Then you can roam in the zoom image also, looking at cuts.
       5. To change the center of the zoom region, click the middle mouse
          button.  To move the zoom region in a controlled manner,
          use the right button.
       6. Moving the sliders at the bottom changes the plot and tv scales.
          You can use auto scaling or set the min & max, within the limits
          shown.
       7. There are guards against choosing out-of-range quantities.
       8. If you give a series of 2-D images, the sliders at the left allow
          you to move through the images---one slider per dimension.
          A catalog option allows display of multiple images.
       9. The right mouse button allows controlled increments and decrements
          of the zoom center and width, selected by using the Increment type
          menu.
       10.An options menu lists available processing and image display operators.
          The menu can contain user-supplied procedures or functions;
          see keywords options, types, procedures, and functions.  Most of the
          options appear in pull-down sub-menus in the followiing categories:
            - xloadct
            - enlargement: on the window or the entire screen
            - catalog: all or selective
            - plot types: contour, histogram, surface, show3, etc.
            - region of interest
            - filters: smooth, median, leefilt
            - write Postscript file
       11.There are more detailed notes below.
 Usage:
       look[,image][,/help][,options]
 Optional Inputs:
       image = one or more 2-D images
 Keywords:
       /assoc = flag to say the parameter is an associate variable
         Then the slider for dim3 becomes an index into the associated file.
         Related keywords are "filename" "definition" "dimensions" and "offset".
       axes = string array of names to replace dim 3, dim4, ...
       definition = string used to define the associate variable
       dimensions = the 3rd and higher dimensions for a series of images and
         the /assoc or loader= options, also needed for optical disks where
         only part of the disk has been written on
       dim3marks = string array or structure array of names used to create
         a pulldown menu for selecting the dim 3 index.  The pulldown menu
         is labeled as "dim 3" or the 1st element of the axes keyword if
         present.  The marks are values along the 3rd dimension and can be
         selected via the pulldown menu.  The string array provides tags, each
         with the mark set to its index in the array.  The structure array
         consists of a named structure with two tags, an int or long and a
         string, here called mark and tag:
           tmp = {look_mark,mark:0l,tag:''}
           dim3marks = [{look_mark,3600,'start'},{look_mark,3800,'end'}]
       dim4marks = ditto for dim 4
       dim5marks = ditto for dim 5
       dim6marks = ditto for dim 6
       dim7marks = ditto for dim 7
       filename = name of the file associated with the associate variable
       functions = synonym for options that are functions, cf. options
       /help = flag to print the header only and return
       interval = time in seconds between timer events (D=0.3s)
	kernel_width = the initial width of the smooth and median filters
       lines = # of lines in the comment/help scrollable widget (D=2)
       loader_name = name of an IDL function to return the ith image for
         display.  It needs one parameter, a vector of the indices for the
         current image, and returns one parameter, the image.  The
         important point is that allowing a function to return the image gives
         the user freedom to grab an image in a variety of ways---not tied
         directly to look.pro.  A prototype function, returning a 10x10 array,
         is the following:
         	function getdata,higherdims,comment
         	comment = 'This is an 2-D Gaussian random image with non-zero mean.'
         	return,randomn(seed,10,10)+higherdims(0)
         	end
         To use this function with 100 images, the call to look is:
         	look,...,loader='getdata',dimensions=100
         If the dimensions keyword is omitted, the user is asked to specify
         the # of images.
         Another example would be returning the magnitude, phase, real, or,
         imaginary part of a complex array:
         	function getcomplex,higherdims,comment
         	c= complex(dist(10),dist(10)*higherdims(0))
         	case higherdims(1) of	; flag is the 2nd dimension
         	0: return,abs(c)
         	1: return,atan(imaginary(c),float(c))*!radeg
         	2: return,float(c)
         	3: return,imaginary(c)
         	endcase
         	end
         Then the dim4 slider would control the return value and the dim3
         slider would control the image index.  In this example the call is:
         	look,...,loader='getcomplex',dimensions=[...,4]
       /noload = flag to say the input comes directly from common look
       offset = byte offset pointing to the start of the associated data,
         the third argument to the assoc call.
       options = names of IDL functions or pros to process the current image for
         display or other action, e.g., to define a region of interest or to
         scale nonlinearly.  The option names appear in the options menu.
         Each function accepts one parameter, the current image, and returns
         the modified image.  You can use any idl function that
         operates on images or make your own.  A prototype function is the
         following:
         	function db,image
         	return,alog10(image)*10
         	end
         A procedure accepts one parameter, the current image scaled with look_scl.
         You can use any idl procedure that operates on images or make your own.
         A prototype procedure is the following:
         	pro dbscl,image
         	tvscl,db(image)
         	return
         	end
         To use this procedure, the call to look is:
         	look,...,options='dbscl'
	  Multiple options are easy, just make an array:
         	look,...,options=['dbscl','lego','image_cont','slide_image']
         look has to determine whether the option is a function or a procedure
         and does a search for each option to find its source code.  These
         searches are time-consuming if !path has many entries.  You can
         shorten the search by including another keyword types; see below.
       procedures = synonym for options that are procedures, cf. options
       range = range of values to be displayed (D=3x range of images)
       tag = tag # if the associate variable is a (named) structure
         e.g., a = assoc(lun,{struct,hdr:0l,data:intarr(128,128)}).
         Then tag=1 references the data tag; see examples above.
       types = types of options, either 'pro' or 'function', corresponding to the
         options keyword to obviate the need for look to determine the option
         type, e.g., look,options=['sin','blob'],types=['function','pro']
       units = 3-element string array to replace labels on images and plots
         x (pixels) --> units(0)
         y (pixels) --> units(1)
         z (value) --> units(2)
         common look_common contains a structure ws that has the units tag
         and can be manipulated by the function used to fetch images, e.g.,
           function get_an_image,indices,comment
           common look_common
           ws.units = ['longitude (deg)','latitude (deg)','pressure (mbar)']
           ...
           return,image
           end
       userscalefunc = array of custom scaling function names, e.g.,
         .r
         - function myfunc, image
         - return, 4 * bytscl (image)
         - end
         look,...,userscalefunc=['bytscl','myfunc']
       /verbose = flag to print informational messages (debug mostly)
       viewers = array of names of procedures to call each time the display
         is updated by a mouse event.  Procedures can do anything, e.g.,
         display other images, calculate statistics, or keep track of what
         has occurred in the program.  The action of each viewer can be
         set to one of three states using the options menu:
           off: procedure not called
           on/all mouse: called for all mouse clicks AND movements
           on/click only: called for mouse clicks and drags only.
         You would choose "on/all mouse" if your procedure shows cuts but
         "on/click only" if your procedure shows images only.  The
         "on/all mouse" option takes more time, so there will be
         delayed updates on cuts.  Each viewer procedure
         takes no parameters but can obtain information from the two
         common blocks and should have two keywords: create and destroy.
         Whenever the viewer is toggled on (off), the procedure will be
         called with /create (/destroy).  Here's an example.
           PRO my_display,create=create,destroy=destroy
           COMMON look
           COMMON look_common
           COMMON look_viewer,viewer_window
           IF keyword_set(create) THEN BEGIN
             window,/free,xsize = 256,ysize = 256, title = 'Sobel window'
             viewer_window = !d.window
           ENDIF
           IF keyword_set(destroy) THEN BEGIN
             wdelete,viewer_window
             return
           ENDIF
           wset,viewer_window
           tvscl,sobel(thisimage) ; example
           return
           END
         In addition the call to look would be:
           look,viewers='my_display',...
 Outputs:
       widget as rendered above
 Common blocks:
       look = images copied from the input parameter or loaded externally,
         declared and filled by user as one alternative to loading images:
           common look,images,catalog,index
           images = ...
         Note that catalog is another variable; it is loaded by look with
         the images selected by catalog/movie/blink.  The same is true for
         index, which is a 2-D array of indices corresponding to the images.
       look_common = variables that need to be passed between routines,
         not likely to be needed by the user, except units (see above).
 Procedure:
       There are two top-level routines: one to initialize (look) and an
       event handler (look_event).  There are a number of lower-level
       routines to perform specific tasks.  After creating the widgets,
       look places the full image in the tv window and a zoom image
       in the optional plots window.  The cut windows are left blank
       until the mouse is moved over the image in the tv window.
       The event loop does all the dynamic processing.
 Restrictions:
       All the images in a series have to have the same 2-D dimensions.
       All the sliders use whole numbers because IDL's cw_fslider lacks the
         ability to specify an increment.
       Slider value for the maximum slider may be incorrect, even though the
         the proper values are being sent.  I don't understand this one.
 Future Additions:
       Report pixel values when scanning over the cut plots?
       Add a display of the actual values in the array.
       Add a color bar.
       Fourier filtering (A version for square images is look_fourier.pro.)
       Add a comment keyword, like the 2nd parameter of the loader.
 Modification history:
       Write, 21-26 Feb 95, FKKnight (knight@Ll.mit.edu)
       Add roaming in the zoom image, 27 Feb-1 Mar 95, FKK
       Fix bug if middle mouse is pressed first, 1 Mar 95, FKK
       Add xloadct and rescale plot min and max sliders when a new image is
         is accessed, 5 Mar 95, FKK
       Clean up, make fixes, add manual scale limits, 11-12 Mar 95, FKK
       Add dynamic help messages, 11 Mar 95, FKK
       Change common to allow input of images via common.  This avoids
         copying a large number of images to the internal common block from
         the input parameter, 13 Mar 95, FKK
       Add search of path for "look.pro" in !PATH + current directory
         when the HELP button is selected, 09 Mar 95, GGA (gga@otl.sma.ch)
       Change timer interval from 0.1 to 0.3 [s],
         insert some code comments, 15 Mar 95, GGA.
       Add interval keyword to override the default, 15 Mar 95, FKK
       Add scroll increments (range/!d.n_colors) to sliders, 17 Mar 95, FKK
       Add function to right mouse: increase/decrease selected quantities
         by a selected increment (-10 to +10), 18 Mar 95, FKK
       Add switch to plot zoom and full images or just full image using
         the plot menu, 19 Mar 95, FKK
       Add a guard against out-of-range sliders, e.g., int's with
         imrange = (0:32767) would make range = (-32767:-2),
         but the guard may not be sufficient, 20 Mar 95, FKK
       Omit controlled mouse increments because there is no way to shift
         the mouse position in software---it has to be moved, 21 Mar 95, FKK
       Make the allowed range of increments larger, up to half the size of
         the image, which is probably more than enough, 21 Mar 95, FKK
       Add guards against not having images and not having Bill Thompson's
         routines available, 21 Mar 95, FKK
       Exchange the text on the toggle button 'Plot Zoom Only', 23 Mar 95, FKK
       Call setflag,/noscale to avoid rescaling data, 28 Mar 95, FKK
       Reset flags /noscale & /noexact on exit, 19 Jun 95, FKK
       Add range keyword to preselect a slider range, 3 Jul 95, FKK
       Add the associate variable code, 17 Jul 95, FKK
       Add catalog of associate variable, 18-19 Jul 95, FKK
       Add byte offset to start of assoc data, 30 Jul 95, FKK
       Add function keyword to give the ability to grab images from outside
         of look.pro and bring them in, e.g., from a frame grabber or an
         associate variable, 4 Aug 95, FKK
       Tried to fix scaling problem of imrange outside srange with another
         guard, 4 Aug 95, FKK
       Add an optional comment to the function return, 5 Aug 95, FKK
       Add the enlargement button and a keyword lines to tell the
         number of lines in the help/comment widget, 8 Aug 95, FKK
       Add a guard against calling widget_slider with small srange (using
         cw_fslider requires a mod to have a scroll keyword), 11 Aug 94, FKK
       Add a keyword, option_names, to name functions to process an image.  This
         allows user-specified functions in the process menu, 11 Aug 95, FKK
       Revamp:
         change keyword option_names --> options
         change keyword last --> dimensions
         add smooth and median filters and a slider for filter width
         rearrange menus to group items better
         add restore image button to undo processing effects
         omit help button because xdisplayfile can't cope with >1000 lines
         change help text to reflect new widget arrangement
         13 Aug 95, FKK
       Alter the min and max sliders, so they're easy to use, 15 Aug 95, FKK
       Revamp:
         change keyword options --> process_names
         change keyword function_name --> loader_name
         add keyword display_name to allow user-supplied display procedures
         retool the pull_down menu code
         20 Aug 95, FKK
       Add selective catalog for large datasets.  Change the catalog item to
         a pull-down menu with two options: all and selective, which,
         if chosen, brings up a widget to select first, last, and step values
         for the catalog display, 24 Aug 95, FKK
       Move look_fourier to a separate file with a new name: fourier.pro,
         24 Aug 95, FKK
       Change menu names AGAIN to combine the two menus into one:
         display menu --> options menu		; for procedures and functions
         process menu --> options menu		; for procedures and functions
       Add code to distinguish between pro and function, but also add a
         keyword types to allow user to distinguish between pros and
         functions and synonyms for options, procedures=... and
         functions=..., 24 Aug 95, FKK
       Decouple from Bill Thompson's routines, needed three procedures so I
         mimicked them with only the options look needs:
           plot_image --> look_image
           exptv --> look_exptv
           put --> look_put
         ,26 Aug 95, FKK
       Revamp catalog, incl. proper index, processing, 27 Aug 95, FKK
       Allow even zoom width (odd only before), 30 Aug 95, FKK
       Add the region of interest processing using IDL's cw_defroi.pro.  Had
         to block the timers during the cw_defroi life; cf. look_event,
         31 Aug 95, FKK
       Replace cw_defroi.pro with look_defroi.pro, an augmented version,
         including roi selection by threshold.  Keep look_defroi.pro in a
         separate file.  3 Sep 95, FKK
       Omit timers; add /motion_events to draw windows.  Add crosshairs.  Add
         drag box during zoom.  Alter substitute test images, 8-10 Sep 95, FKK
       Replace border.pro with hard-coded border, 12 Sep 95, FKK
       Omit testimages (hassles betw IDL3.6 and IDL4.0);
         just use calculated ones, 14 Sep 95, FKK
       Add blink compare and fixed increments, 15-16 Sep 95, FKK, with advice
         from Vincent Coude' de Foresto and code from David Stern
       Add movies using xinteranimate, 16 Sep 95, FKK
       Make cuts smoother, per Andrew Cool's suggestion, 17-19 Sep 95, FKK
       Make press of Set Min= and Set Max= buttons work, 28 Sep 95, FKK
       Reorder subroutines and make image updates faster by relying on
         color table modifications where possible.  See look_span_update.
         8 Oct 95, FKK
       Add _extra keyword to allow non-look keywords, 13 Oct 95, FKK
       Add optional names of axes to replace dim 3, dim 4,... 18 Oct 95, FKK
       Add ability to input specific values for dim 3, dim 4,..., 30 Oct 95, FKK
       Replace each dim slider with 2 buttons (+ and -) and two editable
         text boxes for the dim value and an increment, 1 Nov 95, FKK
       Fix bugs in catlim 1) if min and max are equal, 2) bad defaults,
         3) out of range integers, 5-7 Dec 95, FKK
       Improve the catalog/movie/blink options by adding a new mechanism
         for choosing frames that allows aborting and easy frame selection,
         11-18 Dec 95, FKK
       Add a Laplacian filter, i.e., a high-pass filter, 24 Feb 96, FKK
       Guard against !d.n_colors = 2^24 in look_span_update, 2 Apr 96, FKK
       Change all !d.n_colors to (!d.n_colors look', 7-9 Dec 97, FKK
       Change the export capability in common look: catalog changed to 3-D
         array, index array added, option to store only indices, append
         capability, 10-12 Dec 97, FKK
       Add a button to determine whether the increment is updated when a new
         image is read.  Update is nice if images span widely different ranges
         but frustrating if the images only vary slightly.  22 Dec 97, FKK
       Fix problem in catalog where index variable didn't exist at the
         beginnning: add extra test (n_elements(index) EQ 0), 9 Jan 98, FKK
       Fix movie for "Use Zoom Only" case.  The ZOOM structure in LOOK_COMMON
         was being replaced by the zoom factor in look_catalog.  5 Mar 98, DSR
       Add viewers keyword to allow user to add procedures to do things
         triggered by mouse events (similar to procedures and functions
         keywords but automatic instead of being chosen from options
         menu), 26 Mar 98, FKK
       Improved code for display of vertical crosscuts (histogram case).
         22 Jul 98, FKK
       Repair movie mode: allow zoomed movie for full and zoom images with
         default size to fill 1/4 of smaller screen dimension and range up
         full screen, guard against single frame sent to xinteranimate
         (slider error).  Still can't do full & zoom movies together
         (xinteranimate restriction). 9 Sep 98, FKK
       look_auto_minmax changed to use fix / auto slider setting; catalog
         now auto scales each image separately.  20 Oct 98, DSR
       fixed catalog indexing scheme.  16 Jun 99, DSR
       Replace stdev calls (obsolete) with calls to moment.  14 Dec 99, DSR
       Fix to avoid calling moment with structure elements as keyword
         arguments.  14 Mar 00, DSR
       Added option to catalog to generate indices without displaying
         images.  22 Jun 00, DSR
       Changed catalog default to display images.  12 Jul 00, DSR

(See $IDL_LOCAL\image\look.pro)


LOOK_CUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       look_cut
 PURPOSE:
       This procedure updates the horizontal and vertical cuts.
 INPUTS:
       tmp = structure containing state information, either all or zoom
       xn,yn = device coordinates of the mouse
       xincr,yincr = increments, in data coordinates, to be added to
         the converted values of xn,yn
 MODIFICATION HISTORY:
       add xn,yn,xincr,yincr, 21 Mar 95, FKK
       xincr, yincr not used anymore so remove them, 9 Sep 95, FKK
       add crosshairs code and docrosshairs flag, 9 Sep 95, FKK

(See $IDL_LOCAL\image\look.pro)


LOOK_DEFROI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	look_defroi
 PURPOSE:
   This function returns a where vector of the pixels in a region of interest,
   selected via a number of methods from within a draw widget.
 CATEGORY:
   Regions of interest, graphics.
 CALLING SEQUENCE:
   Result = look_defroi(draw[,options])
 INPUTS:
   Draw = id of drawable to draw the region, not the window number.
 KEYWORD PARAMETERS:
   CONTRAST = flag to select positive (/contrast, the default) or negative
       (contrast=0) for the threshold method of definiing the roi
   IMAGE = the real image that is displayed with the zoom factor in the
       drawable.  Passing it in allows the threshold to be calculated exactly,
       even for non-unity zooms.  Without it, a congrid is necessary and
       the resulting image is only an approximation.
   MODE = integer code for initial method of selecting pixels:
       0=polygon, 1=point, 2=rectangle, 3=circle, 4=threshold
   OFFSET = offset of lower left corner of image within the
       drawable.  Default = [0,0].
   ORDER = if set, return inverted subscripts, as if the array
       were output from top to bottom.
   RESTORE = Set to restore the drawable to its previous appearance
       on exit.  Otherwise, the regions remain on the drawable.
   SIZE = the size of the underlying array, expressed
       as a two element vector: [columns, rows].  Default =
       (drawable_size-offset) / zoom.
   ZOOM = if the image array was expanded (via REBIN for example)
       specify this two element vector containing the expansion
       factor in X and Y.  Default = [1,1].  Must be integer.
 OUTPUTS:
      Result = 1-D vector of subscripts of points within the region[s] defined.
       If no region was defined, a scalar -1 is returned.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       The regions are drawn within the drawable.  Set the RESTORE
       keyword to undo the damage.
 RESTRICTIONS:
   This is a MODAL widget.  No other widget applications will be
   responsive while this widget is in use.  The draw widget should
   have the /motion and /button.  For the threshold method, the
   return value can be off due to the congrid employed, unless the actual
   image is passed in.
 PROCEDURE:
   Defining the roi is interective: you select the method(s) and use the mouse.
   The left mouse button selects points (click or drag); the right deletes points.
   The methods are:
     - polygon: click on vertices
     - point: click on single pixels
     - rectangle: drag from lower left to upper right or vice versa
     - circle: drag from center to point on circumference
     - threshold: select positive or negative contrast and adjust slider.
   When you change the method, the current points are added to the total, so
   you can combine methods, except for the threshold method.  The event loop
   is inside the main function, but mouse events in the drawable are processed
   in an event procedure.  Some important points about the code are the
   following.
     - There are two pixel coordinate lists that are stored as uvalues.
     - Except for the threshold method, the displayed image is not needed.
       Instead the XOR graphics mode is used to draw and fill on top of
       the image.
     - For the threshold mode, the image is read using tvrd, so it is a
       scaled copy.
     - A structure, s, which holds the state information, is passed to the
       subroutines:
         look_defroi_draw: overlay outline or fill on drawable.
         look_defroi_nmode: concatenate current points with old ones
         look_defroi_event: process mouse events
 EXAMPLE:
   To obtain the average of the counts of a region within a drawable:
   Assume A = the array of interest, n columns, m rows, and that
   it is displayed in drawable D, at offset X=20, Y=100, and zoomed
   with a factor of 2:
       TV, REBIN(A, M*2, N*2), 20, 100     ;Display the image
       q = look_defroi(D, ZOOM=[2,2], OFFSET=[20,100], IMAGE_SIZE=[m,n])
       if q(0) ne -1 then print,'Average = ', total(a(q))/n_elements(q)

 MODIFICATION HISTORY:
   DMS, RSI, December, 1993.  Written.
   modify for incorporating into look.pro:
     - change name from cw_defroi to look_defroi
     - add another mode, threshold with positive or negative contrast
     - allow floating zoom factors
     - allow a timer to be active in the drawable by only processing events
       with 8 tags (mouse events)  Timer events have 3 tags.
     - add mode-specific instructions
     31 Aug-1 Sep 95, FKKnight (knight@ll.mit.edu)
   add the image keyword and change image_size keyword to size.  This allows
     an exact calculation of the return value.  See notes above. 3 Sep 95, FKK

(See $IDL_LOCAL\image\look.pro)


PROCESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PROCESS

 PURPOSE:
       The purpose of this routine is to demonstrate a simple
       image processing program that runs as a "color aware"
       application. The program works on 8-bit, 16-bit, and
       24-bit displays. The image is displayed in a resizeable
       graphics window and the window contents can be saved as
       GIF or JPEG images. The application can "protect" its
       colors from other applications that change colors. The
       color protection is implemented via draw widget EXPOSE
       events or the Refresh Colors button in the menubar.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets.

 CALLING SEQUENCE:
       PROCESS

 INPUTS:
       image: An optional 2D image. The image is always scaled.

 KEYWORD PARAMETERS:
       BOTTOM: The lowest color index of the colors to be changed.

       GROUP: The group leader for this program. When the group leader
       is destroyed, this program will be destroyed.

       NCOLORS: This is the number of colors to load when a color table
       is selected.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       This is a non-blocking widget.

 RESTRICTIONS:
       The GETIMAGE and XCOLORS programs from the Fanning Consulting
       web page are required: http://www.dfanning.com/.

 EXAMPLE:
       To run the program, type:

       PROCESS

 MODIFICATION HISTORY:
       Written by:     David Fanning, 13 April 97.
       Fixed a bug in the TVImage call. 25 June 97. DWF.
       Extensively modified to incorporate changing ideas
         about color protection and operation on 8-bit and
         24-bit displays. 19 Oct 97. DWF.
       Whoops. Forgot to make *this* draw widget the current
         graphics window. 15 Nov 97. DWF.

(See $IDL_LOCAL\image\process.pro)


PROFILES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PROFILES

 PURPOSE:
	Interactively draw row or column profiles of an image in a separate
	window.

 CATEGORY:
	Image analysis.

 CALLING SEQUENCE:
	PROFILES, Image [, SX = sx, SY = sy]

 INPUTS:
	Image:	The variable that represents the image displayed in current
		window.  This data need not be scaled into bytes.
		The profile graphs are made from this array.

 KEYWORD PARAMETERS:
	SX:	Starting X position of the image in the window.  If this
		keyword is omitted, 0 is assumed.

	SY:	Starting Y position of the image in the window.  If this
		keyword is omitted, 0 is assumed.

	WSIZE:	The size of the PROFILES window as a fraction or multiple
		of 640 by 512.

	ORDER:	Set this keyword param to 1 for images written top down or
		0 for bottom up.  Default is the current value of !ORDER.

 OUTPUTS:
	No explicit outputs.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	A new window is created and used for the profiles.  When done,
	the new window is deleted.

 RESTRICTIONS:
	None.

 PROCEDURE:
	A new window is created and the mouse location in the original
	window is used to plot profiles in the new window.  Pressing the
	left mouse button toggles between row and column profiles.
	The right mouse button exits.

 EXAMPLE:
	Create and display an image and use the PROFILES routine on it.
	Create and display the image by entering:

		A = BYTSCL(DIST(256))
		TV, A

	Run the PROFILES routine by entering:

		PROFILES, A

	The PROFILES window should appear.  Move the cursor over the original
	image to see the profile at the cursor position.  Press the left mouse
	button to toggle between row and column profiles.  Press the right
	mouse button (with the cursor over the original image) to exit the
	routine.

 MODIFICATION HISTORY:
	DMS, Nov, 1988.

(See $IDL_LOCAL\image\profiles.pro)


SLICE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SLICE

 PURPOSE:
	This is a routine to display a 3D data set and slice through it
       at arbitrary orthographic angles. The display window (when run
       with the GUI) is resizeable. The output can be sent either to
       the display, to a GUI, or to a PostScript printer (as true
       PostScript output, not a screen dump.) When run with the GUI,
       slices can be animated and displays can be saved and restored
       for later processing. The program works on 8-bit, 16-bit, and
       24-bit displays.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:

	3D Graphics, Widgets.

 CALLING SEQUENCE:

       For display in a regular IDL graphics window:

          SLICE, data

       For display with a built-in GUI:

          SLICE, data, /GUI

       To send display to a PostScript printer:

          deviceKeywords = PS_FORM(/INITIALIZE)
          SLICE, data, POSTSCRIPT=deviceKeywords

 INPUTS:

	data:	The 3D data set to be displayed. The data is assumed to be
          scaled into the number of colors (keyword NCOLORS).

 KEYWORD PARAMETERS:

       AX      The rotation of the 3D coordinate system about the X axis.
               Must be between 0 and 90 degrees. Default is 30 degrees.

       AZ      The rotation of the 3D coordinate system about the Z axis.
               Must be between -30 and 210 degrees. Default is 30 degrees.

       BACKGROUND   The color index of the plot background. Default is BOTTOM.

       BOTTOM   The starting index of the color table. Default is 0.

       COLOR    The color index of the plot axes and annotation. Default is
                (NCOLORS-1) + BOTTOM.

       CHARSIZE   The size of the plot annotations. Default is 1.0.

       _EXTRA   This keyword allows other undefined keywords to be passed
                to the SURFACE command. For example: XTITLE, YTITLE, ZTITLE,
                and TITLE keywords.

       GROUP    The group leader of the GUI. Normally used with GUI.

       GUI      Set this keyword if you want a graphical user interface to the
                program functionality.

       NCOLORS  The number of colors used in the color table. The default is
                !D.N_COLORS.

       NOAXES   Set this keyword to draw the plot without axes.

       POSTSCRIPT   This will be a strucuture of the type returned by PS_FORM.
                The fields of the structure are used to congfigue the PostScript device.

       THISINSTANCE   Multiple versions of the GUI program can be running concurrently.
                This keyword is used to make sure they can be managed by XMANAGER
                concurrently. The keyword is NOT normally set by the user.

       TRANSPARENT   This keyword sets the transparency threshold for the 3D volume.
                allowed values go from 0 to 100 percent. The default is 0.

       WID      The window index number of the window you wish the display to go into.
                In non-GUI mode, the window does not have to currently be open. This
                keyword is ignored in GUI mode.

       WTITLE   The window title. Used in conjunction with THISINSTANCE to label
                control and graphics windows. It can be set by the user.

       XCOORD   The X coordinate of the 3D data set. The data will be sliced at this
                coordinate in the X direction. The default is XSIZE / 2.

       XSLICE   Set this keyword to draw an slice through the data in the X direction.

       YCOORD   The Y coordinate of the 3D data set. The data will be sliced at this
                coordinate in the Y direction. The default is YSIZE / 2.

       YSLICE   Set this keyword to draw an slice through the data in the Y direction.

       ZCOORD   The Z coordinate of the 3D data set. The data will be sliced at this
                coordinate in the Z direction. The default is ZSIZE / 2.

       ZSLICE   Set this keyword to draw an slice through the data in the Z direction.


 OUTPUTS:

	None.

 COMMON BLOCKS:

       None.

 RESTRICTIONS:

	Requires modified IDL library routines CW_ANIMATE and XINTERANIMATE
       which have been added to this code. Requires the programs PS_FORM,
       XCOLORS, and CHGCOLOR from the Coyote Software Library.

         ftp://ftp.frii.com/pub/dfanning/outgoing/idl_examples

 EXAMPLE:

      To run this program with a GUI, a charcoal background color, axes
      drawn in yellow and with the X and Y axes shown, type:

      filename = FILEPATH(SUBDIR=['examples', 'data'], 'abnorm.dat')
      OPENR, lun, filename, /GET_LUN
      heart = BYTARR(64,64,15)
      READU, lun, heart
      FREE_LUN, lun
      LOADCT, 5, NCOLORS=150, BOTTOM=0
      TVLCT, [70, 255], [70, 255], [70, 0], 150
      SLICE, heart, /GUI, BACKGROUND=150, COLOR=151, NCOLORS=150, $
         BOTTOM=0, /XSLICE, /YSLICE

      The program code comes with its own example program. Type:

          IDL> .Compile SLICE
          IDL> example

 MODIFICATION HISTORY:
 	Written by:	David Fanning, Sept 1996.
       31 Oct 96: Made slight changes in how PostScript output is handled.
       23 April 1997. Fixed a bug that prevented PostScript output when
          the size was expressed in centimeters. DWF.
       23 April 1997. Added support for 24-bit color displays. DWF

(See $IDL_LOCAL\image\slice.pro)


TVIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     TVIMAGE

 PURPOSE:
     This purpose of TVIMAGE is to allow you to display an image
     on the display or in a PostScript file in a particular position.
     The position is specified by means of the POSITION keyword. In
     this respect, TVIMAGE works like other IDL graphics commands.
     Moreover, the TVIMAGE command works identically on the display
     and in a PostScript file. You don't have to worry about how to
     "size" the image in PostScript. The output on your display and
     in the PostScript file will be identical. The major advantage of
     TVIMAGE is that it can be used in a natural way with other IDL
     graphics commands in resizeable IDL graphics windows. TVIMAGE
     is a replacement for TV and assumes the image has been scaled
     correctly when it is passed as an argument.

 AUTHOR:
       FANNING SOFTWARE CONSULTING:
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
     Graphics display.

 CALLING SEQUENCE:

     TVIMAGE, image

 INPUTS:
     image:    A 2D or 3D image array. It should be byte data.

 KEYWORD PARAMETERS:
     _EXTRA:   This keyword picks up any TV keywords you wish to use.

     KEEP_ASPECT_RATIO: Normally, the image will be resized to fit the
               specified position in the window. If you prefer, you can
               force the image to maintain its aspect ratio in the window
               (although not its natural size) by setting this keyword.
               The image width is fitted first. If, after setting the
               image width, the image height is too big for the window,
               then the image height is fitted into the window. The
               appropriate values of the POSITION keyword are honored
               during this fitting process. Once a fit is made, the
               POSITION coordiates are re-calculated to center the image
               in the window. You can recover these new position coordinates
               as the output from the POSITION keyword.

     MINUS_ONE: The value of this keyword is passed along to the CONGRID
               command. It prevents CONGRID from adding an extra row and
               column to the resulting array.

     POSITION: The location of the image in the output window. This is
               a four-element floating array of normalized coordinates of
               the type given by !P.POSITION or the POSITION keyword to
               other IDL graphics commands. The form is [x0, y0, x1, y1].
               The default is [0.15, 0.15, 0.85, 0.85]. Note that this can
               be an output parameter if the KEEP_ASPECT_RATIO keyword is
               used.

 OUTPUTS:
     None.

 SIDE EFFECTS:
     Unless the KEEP_ASPECT_RATIO keyword is set, the displayed image
     may not have the same aspect ratio as the input data set.

 RESTRICTIONS:
     If the POSITION keyword and the KEEP_ASPECT_RATIO keyword are
     used together, there is an excellent chance the POSITION
     parameters will change. If the POSITION is passed in as a
     variable, the new positions will be returned as an output parameter.

 EXAMPLE:
     To display an image with a contour plot on top of it, type:

        filename = FILEPATH(SUBDIR=['examples','data'], 'worldelv.dat')
        image = BYTARR(360,360)
        OPENR, lun, filename, /GET_LUN
        READU, image
        FREE_LUN, lun

        TVIMAGE, image, POSITION=thisPosition, /KEEP_ASPECT_RATIO
        CONTOUR, image, POSITION=thisPosition, /NOERASE, XSTYLE=1, $
            YSTYLE=1, XRANGE=[0,360], YRANGE=[0,360], NLEVELS=10

 MODIFICATION HISTORY:
      Written by:     David Fanning, 20 NOV 1996.
      Fixed a small bug with the resizing of the image. 17 Feb 1997. DWF.
      Removed BOTTOM and NCOLORS keywords. This reflects my growing belief
         that this program should act more like TV and less like a "color
         aware" application. I leave "color awareness" to the program
         using TVIMAGE. Added 24-bit image capability. 15 April 1997. DWF.
      Fixed a small bug that prevented this program from working in the
          Z-buffer. 17 April 1997. DWF.
      Fixed a subtle bug that caused me to think I was going crazy!
          Lession learned: Be sure you know the *current* graphics
          window! 17 April 1997. DWF.
      Added support for the PRINTER device. 25 June 1997. DWF.
      Extensive modifications. 27 Oct 1997. DWF
          1) Removed PRINTER support, which didn't work as expected.
          2) Modified Keep_Aspect_Ratio code to work with POSITION keyword.
          3) Added check for window-able devices (!D.Flags AND 256).
          4) Modified PostScript color handling.
      Craig Markwart points out that Congrid adds an extra row and column
          onto an array. When viewing small images (e.g., 20x20) this can be
          a problem. Added a Minus_One keyword whose value can be passed
          along to the Congrid keyword of the same name. 28 Oct 1997. DWF

(See $IDL_LOCAL\image\tvimage.pro)


VCOLORBAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       VCOLORBAR

 FILENAME:
       vcolorbar__define.pro
;
 PURPOSE:
       The purpose of this program is to create a vertical
       colorbar object to be used in conjunction with other
       IDL 5 graphics objects.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com/

 CATEGORY:
       IDL 5 Object Graphics.

 CALLING SEQUENCE:
       thisColorBar = Obj_New('VColorBar')

 REQUIRED INPUTS:
       None.

 INIT METHOD KEYWORD PARAMETERS:

       COLOR: A three-element array representing the RGB values of a color
          for the colorbar axes and annotation. The default value is
          white: [255,255,255].

       NCOLORS: The number of colors associated with the colorbar. The
          default is 256.

       MAJOR: The number of major tick divisions on the colorbar axes.
          The default is 5.

       MINOR: The number of minor tick marks on the colorbar axes. $
          The default is 4.

       PALETTE: A palette object for the colorbar. The default palette
           is a gray-scale palette object.

       POSITION: A four-element array specifying the position of the
           colorbar in normalized coordinate space. The default position
           is [0.90, 0.10, 0.95, 0.90].

       RANGE: The range associated with the colorbar axis. The default
           is [0, NCOLORS].

       TEXT: A text object. Colorbar axis annotation will use this text
           object to set its properties. The default is a text object
           using a 9 point Helvetica font in the axis color.

       TITLE: A string containing a title for the colorbar axis
           annotation. The default is a null string.

 OTHER METHODS:

       GetModel (Function): Returns the colorbar model object.

       GetProperty (Procedure): Returns colorbar properties in keyword
          parameters as defined for the INIT method. Keywords allowed are:

               COLOR
               MAJOR
               MINOR
               PALETTE
               POSITION
               RANGE
               TEXT
               TITLE

       SetProperty (Procedure): Sets colorbar properties in keyword
          parameters as defined for the INIT method. Keywords allowed are:

               COLOR
               MAJOR
               MINOR
               PALETTE
               POSITION
               RANGE
               TEXT
               TITLE

 SIDE EFFECTS:
       A VCOLORBAR structure is created.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To create a colorbar object and add the colorbar model to a
       plot view object, type:

       thisColorBarObject = Obj_New('VColorBar', GetModel=colorBarModel)
       plotView->Add, colorBarModel
       plotWindow->Draw, plotView

 MODIFICATION HISTORY:
       Written by David Fanning, 19 June 97.
       Changed the optional "colorbarmodel" parameter to an
           optional GETMODEL parameter. 26 June 97. DWF.
       Fixed bug in the way the color palette was assigned. 13 Aug 97. DWF.
       Added missing container object to self structure. 13 Aug 97. DWF.
       Removed image model, which was a workaround for
           broken 5.0 objects. 5 Oct 97. DWF

(See $IDL_LOCAL\image\vcolorbar__define.pro)


WRITE_MPEG

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
        WRITE_MPEG



 PURPOSE: 
        Write a sequence of images as an mpeg movie



 CATEGORY: utility



 CALLING SEQUENCE:
        WRITE_MPEG,'movie.mpg',ims


 INPUTS:
         ims: sequence of images as a 3D array with dimensions [sx, sy, nims]
              where sx = xsize of images
                    sy = ysize of images
                    nims = number of images

 OPTIONAL INPUTS:



 KEYWORD PARAMETERS:
             delaft:   if set delete temporary array after movie was created
                       you should actually always do it otherwise you get
                       problems with permissions on multiuser machines (since
                       /tmp normally has the sticky bit set)
             rep:      if given means repeat every image 'rep' times
                       (as a workaround to modify replay speed)


 OUTPUTS: None

 OPTIONAL OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:
          creates some files in TMPDIR which are only removed when
          the DELAFT keyword is used


 RESTRICTIONS:
          depends on the program mpeg_encode from University of
          California, Berkeley, which must be installed in /usr/local/bin


 PROCEDURE:
         writes a parameter file based on the dimensions of the image
         array + the sequence of images in ppm format into a
         temporary directory; finally spawns mpeg_encode to build the
         movie


 EXAMPLE:



 MODIFICATION HISTORY:

       Mon Nov 18 13:13:53 1996, Christian Soeller
       

		grabbed original from the net and made slight modifications

(See $IDL_LOCAL\image\write_mpeg.pro)


XCOLORS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       XCOLORS

 PURPOSE:
       The purpose of this routine is to interactively change color tables
       in a manner similar to XLOADCT. No common blocks are used so
       multiple copies of XCOLORS can be on the display at the same
       time (if each has a different TITLE). XCOLORS has the ability
       to notify a widget event handler or an object method if and when
       a new color table has been loaded. The event handler or object method
       is then responsibe for updating the program's display on 16- or
       24-bit display systems.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets.

 CALLING SEQUENCE:
       XCOLORS

 INPUTS:
       None.

 KEYWORD PARAMETERS:
       BOTTOM: The lowest color index of the colors to be changed.

       DRAG: Set this keyword if you want colors loaded as you drag
       the sliders. Default is to update colors only when you release
       the sliders.

       FILE: A string variable pointing to a file that holds the
       color tables to load. The normal colors1.tbl file is used by default.

       GROUP_LEADER: The group leader for this program. When the group
       leader is destroyed, this program will be destroyed.

       NCOLORS: This is the number of colors to load when a color table
       is selected.

       NOTIFYID: A 2-column by n-row array that contains the IDs of widgets
       that should be notified when XCOLORS loads a color table. The first
       column of the array is the widgets that should be notified. The
       second column contains IDs of widgets that are at the top of the
       hierarchy in which the corresponding widgets in the first column
       are located. (The purpose of the top widget IDs is to make it
       possible for the widget in the first column to get the "info"
       structure of the widget program.) An XCOLORS_LOAD event will be
       sent to the widget identified in the first column. The event
       structure is defined like this:

       event = {XCOLORS_LOAD, ID:0L, TOP:0L, HANDLER:0L, $
          R:BytArr(!D.N_COLORS < 256), G:BytArr(!D.N_COLORS < 256), $
          B:BytArr(!D.N_COLORS < 256), INDEX:0}

       The ID field will be filled out with NOTIFYID[0, n] and the TOP
       field will be filled out with NOTIFYID[1, n]. The R, G, and B
       fields will have the current color table vectors, obtained by
       exectuing the command TVLCT, r, g, b, /Get. The INDEX field will
       have the index number of the just-loaded color table.

       Note that XCOLORS can't initially tell *which* color table is
       loaded, since it just uses whatever colors are available when it
       is called. Thus, it stores a -1 in the INDEX field to indicate
       this "default" value. Programs that rely on the INDEX field of
       the event structure should normally do nothing if the value is
       set to -1. This value is also set to -1 if the user hits the
       CANCEL button.

       Typically the XCOLORS button will be defined like this:

           xcolorsID = Widget_Button(parentID, Value='Load New Color Table...', $
               Event_Pro='Program_Change_Colors_Event')

       The event handler will be written something like this:

           PRO Program_Change_Colors_Event, event

              ; Handles color table loading events. Allows colors be to changed.

           Widget_Control, event.top, Get_UValue=info, /No_Copy
           thisEvent = Tag_Names(event, /Structure_Name)
           CASE thisEvent OF

              'WIDGET_BUTTON': BEGIN

                    ; Color table tool.

                 XColors, NColors=info.ncolors, Bottom=info.bottom, $
                    Group_Leader=event.top, NotifyID=[event.id, event.top]
                 ENDCASE

              'XCOLORS_LOAD': BEGIN

                    ; Update the display for 24-bit displays.

                 Device, Get_Visual_Depth=thisDepth
                 IF thisDepth GT 8 THEN BEGIN
                    WSet, info.wid

                    ...Whatever display commands are required go here. For example...

                    TV, info.image

                 ENDIF
                 ENDCASE

           ENDCASE

           Widget_Control, event.top, Set_UValue=info, /No_Copy
           END

       NOTIFYOBJ: A vector of structures (or a single structure), with
       each element of the vector defined as follows:

          struct = {XCOLORS_NOTIFYOBJ, object:Obj_New(), method:'', wid:0}

       where the "object" is an object reference, "method" is the object
       method that should be called when XCOLORS loads its color tables,
       and "wid" is the window index number of the window where the object
       output should be displayed. Note that the current graphics window
       will be set to struct.wid before the object method is called.

           ainfo = {XCOLORS_NOTIFYOBJ, a, 'Draw', 0}
           binfo = {XCOLORS_NOTIFYOBJ, b, 'Display', 3}
           XColors, NotifyObj=[ainfo, binfo]

       Note that the XColors program must be compiled before these structures
       are used. Alternatively, you can put this program, named
       "xcolors_notifyobj__define.pro" (*three* underscore characters in this
       name!) in your PATH:

           PRO XCOLORS_NOTIFYOBJ__DEFINE
              struct = {XCOLORS_NOTIFYOBJ, OBJECT:Obj_New(), METHOD:'', WID:0}
           END

       TITLE: This is the window title. It is "Load Color Tables" by
       default. The program is registered with the name 'XCOLORS:' plus
       the TITLE string. The "register name" is checked before the widgets
       are defined. If a program with that name has already been registered
       you cannot register another with that name. This means that you can
       have several versions of XCOLORS open simultaneously as long as each
       has a unique title or name. For example, like this:

         IDL> XColors, NColors=100, Bottom=0, Title='First 100 Colors'
         IDL> XColors, NColors=100, Bottom=100, Title='Second 100 Colors'

       XOFFSET: This is the X offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       YOFFSET: This is the Y offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       Colors are changed. Events are sent to widgets if the NOTIFYID
       keyword is used. Object methods are called if the NOTIFYOBJ keyword
       is used. This program is a non-blocking widget.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To load a color table into 100 colors, starting at color index
       50 and send an event to the widget identified at info.drawID
       in the widget heirarchy of the top-level base event.top, type:

       XCOLORS, NCOLORS=100, BOTTOM=50, NOTIFYID=[info.drawID, event.top]

 MODIFICATION HISTORY:
       Written by:     David Fanning, 15 April 97. Extensive modification
         of an older XCOLORS program with excellent suggestions for
         improvement by Liam Gumley. Now works on 8-bit and 24-bit
         systems. Subroutines renamed to avoid ambiguity. Cancel
         button restores original color table.
       23 April 97, added color protection for the program. DWF
       24 April 97, fixed a window initialization bug. DWF
       18 June 97, fixed a bug with the color protection handler. DWF
       18 June 97, Turned tracking on for draw widget to fix a bug
         in TLB Tracking Events for WindowsNT machines in IDL 5.0. DWF
       20 Oct 97, Changed GROUP keyword to GROUP_LEADER. DWF
       19 Dec 97, Fixed bug with TOP/BOTTOM reversals and CANCEL. DWF.
        9 Jun 98, Fixed bug when using BOTTOM keyword on 24-bit devices. DWF
        9 Jun 98, Added Device, Decomposed=0 for TrueColor visual classes. DWF
        9 Jun 98, Removed all IDL 4 compatibility.
       21 Oct 98, Fixed problem with gamma not being reset on CANCEL. DWF
        5 Nov 98. Added the NotifyObj keyword, so that XCOLORS would work
         interactively with objects. DWF.
        9 Nov 98. Made slider reporting only at the end of the drag. If you
         want continuous updating, set the DRAG keyword. DWF.
        9 Nov 98. Fixed problem with TOP and BOTTOM sliders not being reset
         on CANCEL. DWF.
       10 Nov 98. Fixed fixes. Sigh... DWF.
        5 Dec 98. Added INDEX field to the XCOLORS_LOAD event structure. This
         field holds the current color table index number. DWF.
        5 Dec 98. Modified the way the colorbar image was created. Results in
         greatly improved display for low number of colors. DWF.
        6 Dec 98. Added the ability to notify an unlimited number of objects. DWF.
       12 Dec 98. Removed obsolete Just_Reg keyword and improved documetation. DWF.
       30 Dec 98. Fixed the way the color table index was working. DWF.
        4 Jan 99. Added slightly modified CONGRID program to fix floating divide
          by zero problem. DWF
        2 May 99. Added code to work around a Macintosh bug in IDL through version
          5.2 that tries to redraw the graphics window after a TVLCT command. DWF.
        5 May 99. Restore the current window index number after drawing graphics.
          Not supported on Macs. DWF.
        9 Jul 99. Fixed a couple of bugs I introduced with the 5 May changes. Sigh... DWF.
       13 Jul 99. Scheesh! That May 5th change was a BAD idea! Fixed more bugs. DWF.
       31 Jul 99. Substituted !D.Table_Size for !D.N_Colors. DWF.
        1 Sep 99. Got rid of the May 5th fixes and replaced with something MUCH simpler. DWF.

(See $IDL_LOCAL\image\xcolors.pro)


XCONTOUR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       XCONTOUR

 PURPOSE:
       The purpose of this program is to demonstrate how to
       create a contour plot with axes and a title in the
       new IDL 5 object graphics.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets, IDL 5 Object Graphics.

 CALLING SEQUENCE:
       XCONTOUR, data, x, y

 REQUIRED INPUTS:
       None. Fake data will be used if no data is supplied in call.

 OPTIONAL INPUTS

       data: A 2D array of surface data.

       x: A vector of X data values.

       y: A vector of Y data values.

 OPTIONAL KEYWORD PARAMETERS:

       _EXTRA: This keyword collects otherwise undefined keywords that are
       passed to the old IDL contour command. Most of the keywords will
       have absolutely no effect.

       GROUP_LEADER: The group leader for this program. When the group leader
       is destroyed, this program will be destroyed.

       NLEVELS: The number of equally spaced contour intervals to draw.
       There are no provisions (yet) for specifying your own contour levels.

       TITLE: A string used as the title of the plot.

       XTITLE: A string used as the X title of the plot.

       YTITLE: A string used as the Y title of the plot.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       Requires the Vertical Colorbar program, vcolorbar__define.pro, from
       the Fanning Software Consulting web page.

 EXAMPLE:
       To use this program with your 2D data, type:

        IDL> XContour, data

 MODIFICATION HISTORY:
       Written by David Fanning, 9 June 97.
       Added a colorbar to the plot. 19 June 97, DWF.
       Modified the way VCOLORBAR was called. 14 July 97. DWF.

(See $IDL_LOCAL\image\xcontour.pro)


XIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       XIMAGE

 PURPOSE:
       The purpose of this program is to demonstrate how to
       create a image plot with axes and a title in the
       new IDL 5 object graphics.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets, IDL 5 Object Graphics.

 CALLING SEQUENCE:
       XImage, image

 REQUIRED INPUTS:
       None. The image "worldelv.dat" from the examples/data directory
       is used if no data is supplied in call.

 OPTIONAL INPUTS

       image: A 2D or 3D image array.

 OPTIONAL KEYWORD PARAMETERS:

       COLORTABLE: The number of a color table to use as the image palette.
       Color table 0 (grayscale) is used as a default.

       GROUP_LEADER: The group leader for this program. When the group leader
       is destroyed, this program will be destroyed.

       KEEP_ASPECT_RATIO: Set this keyword if you wish the aspect ratio
       of the image to be preserved as the graphics display window is resized.

       SIZE: The initial window size. Default is 300 by 300 pixels.

       TITLE: A string used as the title of the plot.

       XRANGE: A two-element array specifying the X axis range.

       XTITLE: A string used as the X title of the plot.

       YRANGE: A two-element array specifying the Y axis range.

       YTITLE: A string used as the Y title of the plot.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To use this program with your 2D or 3D image data, type:

        IDL> XImage, image

 MODIFICATION HISTORY:
       Written by David Fanning, 13 June 97.
       Added Keep_Apect_Ratio keyword and Zoom buttons. DWF 15 JUNE 97.
       Improved font handling and color support. DWF 4 OCT 97.

(See $IDL_LOCAL\image\ximage.pro)


XMOVIE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     XMOVIE

 PURPOSE:
     This program is a simplified version of XINTERANIMATE. It is written
     to illustrate the proper way to write an animation loop in a widget
     program using the WIDGET_TIMER functionality.

 CATEGORY:
     Widgets.

 CALLING SEQUENCE:
     
      XMOVIE, image3d

 INPUTS:
     image3d: A three-dimensional image array. The animation occurs over
              the third dimension. 

 KEYWORD PARAMETERS:
     GROUP:   The group leader of the program. When the group leader dies,
              this program dies as well.

     TITLE:   The window title of the program. The default is "Animation 
              Example...".

 COMMON BLOCKS:
     None.

 SIDE EFFECTS:
     None.

 EXAMPLE:
     To open the abnormal heart data and animate it, type:

        filename = FILEPATH(SUBDIR=['examples', 'data'], 'abnorm.dat')
        OPENR, lun, filename, /GET_LUN
        data = BYTARR(64, 64, 15)
        READU, lun, data
        FREE_LUN, lun
        data = REBIN(data, 256, 256, 15)

        XMOVIE, data

 MODIFICATION HISTORY:
      Written by: David Fanning, June 96.

(See $IDL_LOCAL\image\xmovie.pro)


XSTRETCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       XSTRETCH

 PURPOSE:
       The purpose of this program is to interactively apply a simple
       linear stretch to an image by moving two lines on a histogram
       plot of the image. The portion of the image data between the
       two lines is stretched over the available colors in the color table.

 CATEGORY:
       Graphics, Widgets

 CALLING SEQUENCE:
       XSTRETCH, image

 INPUT PARAMETERS:
       image:    The image data to be stretched.It must be 2D.

 KEYWORD PARAMETERS:
       COLORTABLE: The index of a colortable you would like to load. 
                 The current colortable is used if this keyword is undefined.

       _EXTRA:   This keyword collects any keyword appropriate for the 
                 Plot command.

       GROUP_LEADER: Keyword to assign a group leader (so this program can be
                 called from within another widget program).

       MAX_VALUE: Keyword to assign a maximun value for the Histogram Plot. 
                 Images with lots of pixels of one color (e.g. black) skew 
                 the histogram. This helps make a better looking plot. 

       NCOLORS:  Keyword to assign the number of colors used to display 
                 the image. The default is !D.N_Colors-4. 

 OUTPUTS:
       None.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       None.

 EXAMPLE:
       If you have a 2D image in the variable "image", you can run this
       program like this:

       XSTRETCH, image

 MODIFICATION HISTORY:
       Written by: David Fanning, April 1996.
       October, 1996 Fixed a problem with not restoring the color 
          table when the program exited. Substituted a call to XCOLORS 
          instead of XLOADCT.

(See $IDL_LOCAL\image\xstretch.pro)


XSURFACE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       XSURFACE

 PURPOSE:
       The purpose of this program is to demonstrate how to
       create a surface with axes and a title in the new IDL 5
       object graphics.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets, IDL 5 Object Graphics.

 CALLING SEQUENCE:
       XSURFACE, data, x, y

 REQUIRED INPUTS:
       None. Fake data will be used if no data is supplied in call.

 OPTIONAL INPUTS

       data: A 2D array of surface data.

       x: A vector of X data values.

       y: A vector of Y data values.

 OPTIONAL KEYWORD PARAMETERS:

       _EXTRA: This keyword collects otherwise undefined keywords that are
        passed to the surface initialization routine.

       GROUP_LEADER: The group leader for this program. When the group leader
       is destroyed, this program will be destroyed.

       TITLE: A string used as the title of the plot.

       XTITLE: A string used as the X title of the plot.

       YTITLE: A string used as the Y title of the plot.

       ZTITLE: A string used as the Z title of the plot.


 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To use this program with your data, type:

        IDL> XSurface, data

 MODIFICATION HISTORY:
       Written by David Fanning, 8 June 97.
       Made axis scaling more robust. 17 Sept 97. DWF.
       Minor modifications to incorporated better understanding
          of how objects work. 4 Oct 97. DWF.

(See $IDL_LOCAL\image\xsurface.pro)


ZIMAGE

[Previous Routine] [List of Routines]
 NAME:
       ZIMAGE

 PURPOSE:
       The purpose of this program is to display an image which
       can be zoomed by drawing a rubberband box on top of it. The
      "zoomed" image appears in its own window.

 CATEGORY:
      Image Processing, Widgets.

 CALLING SEQUENCE:
     
      ZIMAGE, image

 INPUTS:

      image:     A 2D array of image data.

 KEYWORD PARAMETERS:

       BOTTOM:   The lowest color index of the colors to be used (see
                 NCOLORS). The default is 0.

       COLORINDEX: The color index for the rubberband box. This index will
                 be loaded with a green color. Whatever color is there will 
                 be restored when the ZIMAGE program exits. The default is 
                 NCOLORS + BOTTOM.

       NCOLORS:  This is the number of colors to use when displaying the
                 image. The default is !D.N_COLORS-2.

       GROUP:    This keyword is used to assign a group leader to this
                 program. This program will be destroyed when the group
                 leader is destroyed. Use this keyword if you are calling
                 ZIMAGE from another widget program.


 OUTPUTS:
       None.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       The COLORINDEX color is turned to green while the rubberband box
       is being drawn. The color is restored after the box is drawn.

 RESTRICTIONS:
       None.

 PROCEDURE:
       Clicking the left mouse button allows you to drag a rubberband box
       over the portion of the window you want to zoom into.

       Clicking the right mouse button calls up hidden controls that allow
       you to load different color tables and set the zoom factor.

       The rubberband box is drawn with pixmaps and the "device copy"
       technique. 

       This is an excellent example of how you can take advantage of the
       widget program *as* the loop do to something (i.e., draw the box)
       that in a regular IDL program would have to be done in a loop. It 
       is also a good example of modular programming style. Notice the draw
       widget has two event handlers associated with it. Motion events
       are only turned on for the draw widget when the box has to be
       drawn.

 EXAMPLE:
     
        To display an image you can zoom into, type:

        filename = FILEPATH(SUBDIR=['examples','data'], 'worldelv.dat')
        image = BYTARR(360,360)
        OPENR, lun, filename, /GET_LUN
        READU, image
        FREE_LUN, lun
      
        ZIMAGE, image

 MODIFICATION HISTORY:
        Written by: David Fanning, 15 August 96.

(See $IDL_LOCAL\image\zimage.pro)


HOME|Index|Work in Progress