This function constructs an ENVIRaster from an input raster and an ENVIROI that defines the area not to mask. Each pixel in the ROI will not be masked.

The result is a virtual raster, which has some additional considerations with regard to methods and properties. See Virtual Rasters for more information, including how they differ from ENVITasks.

The equivalent task is ROIMaskRaster.

Example


; Start the application
e = ENVI()
 
; Open an input file
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
 
; Select input ROIs
roiFile = Filepath('qb_boulder_roi.xml', SUBDIR=['data'], $
  ROOT_DIR=e.Root_Dir)
rois = e.OpenRoi(roiFile)
 
; Create a masked raster from the water ROI
maskedRaster = ENVIRoiMaskRaster(raster, rois[2])
 
; Display the new raster. The masked areas are transparent.
view = e.GetView()
layer = view.CreateLayer(maskedRaster)

You can optionally save the masked raster to disk. However, be sure to set the DATA_IGNORE_VALUE keyword on the ENVIRaster::Export method as follows:

; Save the masked raster to a file
outFile = e.GetTemporaryFilename()
maskedRaster.Export, outFile, 'ENVI', DATA_IGNORE_VALUE=0

See Data Ignore Value for more information on choosing a suitable value.

Syntax


Result = ENVIROIMaskRaster(Input_Raster, Input_Rois [, Keywords=value])

Return Value


The method returns an ENVIRaster, where the applied mask alters the pixel state of the raster. Use the PIXEL_STATE keyword of ENVIRaster::GetData or ENVIRasterIterator::GetData to determine which pixels to process. See Raster Pixel State for more details.

Arguments


Input_Raster

Specify an input ENVIRaster.

Input_Rois

Specify an input ENVIROI. This reference can be either a scalar or array.

Methods


This virtual raster inherits methods and properties from ENVIRaster; however the following methods will override the ENVIRaster methods:

Dehydrate

Hydrate

Keywords


ERROR (optional)

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.

INVERSE (optional)

Set this keyword to invert the input ROI. Each pixel included in the ROI will be masked.

NAME

Specify a string that identifies the raster.

Version History


ENVI 5.2.1

Introduced

ENVI 5.3.1

Documented the dehydrated form of this virtual raster

ENVI 5.4

Added Dehydrate and Hydrate methods; added NAME keyword

API Version


4.2

See Also


ENVIRaster, ENVIRaster::Export, ENVIROI, Masks, ENVIDataValuesMaskRaster, ENVIMaskRaster, ENVIVectorMaskRaster, ROIMaskRaster Task, How do I process the pixels within a region of interest (ROI)?, How do I set a data value to ignore?