DEFROI [2] $SSW/goes/sxig12/IDL/IDAC_source/IDACDefROI.pro
[Next]
 NAME:         DEFROI
 PURPOSE:  Define an irregular region of interest of an image
       using the image display system and the cursor/mouse.
 CATEGORY: Image processing.
 CALLING SEQUENCE:
   R = Defroi(Sx, Sy, X0, Y0)
 INPUTS:
   Sx, Sy = Size of image, in pixels.
 Optional Inputs:
   X0, Y0 = Coordinate of Lower left corner of image on display.
   If omitted, (0,0) is assumed.  Screen device coordinates.
   ZOOM = zoom factor, if omitted, 1 is assumed.
 OUTPUTS:
   Function result = vector of subscripts of pixels inside the region.
   Side effect: The lowest bit in which the write mask is enabled
   is changed.
 OPTIONAL OUTPUTS:
   Xverts, Yverts = Optional output parameters which will contain
       the vertices enclosing the region.
 KEYWORD Parameters:
   NOREGION = Setting NOREGION inhibits the return of the
       pixel subscripts.
   NOFILL = if set, inhibits filling of irregular region on completion.
   RESTORE = if set, original image on display is restored to its
       original state on completion.
 CALLED BY:
	BORN_AGAIN, C3_CME, C3_CME_FRONT, CH_BOUNDARY [2], CME_MASS, CME_MASSIMG2TOTAL
	MOVIE_MAKER, REMOVE_CR, cr_rem_array, cr_rem_file, cur_teemcursor Te and EM
	lwa_plot_arc, plot_arc [1], plot_arc [2], plot_arc [3], sxt_defroi, wdefroi [1]
	wdefroi [2]
 COMMON BLOCKS:
   None.
 SIDE EFFECTS:
   Display is changed if RESTORE is not set.
 RESTRICTIONS:
   Only works for interactive, pixel oriented devices with a
       cursor and an exclusive or writing mode.
   A region may have at most 1000 vertices.  If this is not enough
       edit the line setting MAXPNTS.
 PROCEDURE:
   The exclusive or drawing mode is used to allow drawing and
   erasing objects over the original object.

   The operator marks the vertices of the region, either by
       dragging the mouse with the left button depressed or by
       marking vertices of an irregular polygon by clicking the
       left mouse button, or with a combination of both.
   The center button removes the most recently drawn points.
   Press the right mouse button when finished.
   When the operator is finished, the region is filled using
       the polyfill function, and the polyfillv function is used
       to compute the subscripts within the region.

 MODIFICATION HISTORY:  DMS, March, 1987.
   Revised for SunView, DMS, Nov, 1987.
       Added additional argument checking, SNG April, 1991
   Modified for devices without write masks: DMS, March, 1992.
       Uses exclusive or mode rather than write masks.
   Modified to preserve device mode, RJF, Nov 1997.