This method reverts a dirty ENVIROI back to a clean state.

Example


For the following example:

  1. Copy and paste the procedure into an IDL editor window.
  2. Save the file as enviroi_revert_example.pro.
  3. Compile and run the procedure.
 
PRO enviroi_revert_example
compile_opt idl2
 
; Launch the application
e = ENVI()
 
; Create an ROI
file = FILEPATH('qb_boulder_pan', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
view = e.GetView()
layer = view.CreateLayer(raster)
roi1 = EnviRoi(NAME='Sun Reflectance', COLOR='Red')
 
; Iterate through the tiles of the original data set
tileIterator = raster.CreateTileIterator()
FOREACH data, tileIterator DO BEGIN
ptr = WHERE(DATA GT 1000 AND data LT 1530, COUNT)
  IF (COUNT GT 0) THEN BEGIN
    x = (tileIterator.Current_Subrect)[0] + $
        (ptr mod (tileIterator.Tile_Size)[0])
    y = (tileIterator.Current_Subrect)[1] + $
        (ptr / (tileIterator.Tile_Size)[0])
    roi1.AddPixels, Transpose([[x],[y]]), spatialref=raster.spatialref
  ENDIF
ENDFOREACH
 
roi1.AddThreshold, raster, 0, MIN_VALUE=1000, MAX_VALUE=1530
visRoi1 = layer.AddRoi(roi1)
 
; Create an ROI file
newFile = e.GetTemporaryFilename('.xml')
roi1.Save, newFile
roi1.AddPixels,[0,0], spatialref=raster.spatialref
roi1.Revert
 
END

Syntax


ENVIROI.Revert [, ERROR=variable]

Keywords


ERROR

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

Version History


ENVI 5.1

Introduced

API Version


4.3

See Also


ENVIROI