ENVIPixelwiseBandMathRaster

This function constructs an ENVIRaster from a source raster that has a mathematical expression applied on a pixel-by-pixel basis. If any of the bands referenced by the expression have a bad pixel state (due to masking or a data ignore value) and you set the DATA_IGNORE_VALUE keyword, then the corresponding output pixel will have a bad pixel state and will be transparent.

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 PixelwiseBandMathRaster.

Example

This example calculates an Enhanced Normalized Difference Vegetation Index (ENDVI, source: MaxMax.com).

; 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)

 

; Calculate enhanced NDVI

expression = 'float((b4 + b2) - 2*b1) / float((b4 + b2) + 2*b1)'

bandMathRaster = ENVIPixelwiseBandMathRaster(raster, expression)

 

; Display the result

View = e.GetView()

Layer = View.CreateLayer(bandMathRaster)

Syntax

Result = ENVIPixelwiseBandMathRaster(Input_Raster, Expression, ERROR=variable)

Return Value

This routine returns a reference to an ENVIRaster.

Arguments

Input_Raster

Specify the input ENVIRaster.

Expression

Enter a string indicating the mathematical expression.

Methods

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

Dehydrate

Hydrate

Keywords

DATA_IGNORE_VALUE (optional)

Set this keyword to a numeric pixel value that ENVI should ignore when subsequently processing data or computing statistics from the output image.

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.

NAME

Specify a string that identifies the raster.

Version History

ENVI 5.3.1

Introduced

ENVI 5.4

Added Dehydrate and Hydrate methods; added NAME keyword

ENVI 5.4.1

Expanded the Expression argument to include IDL functions and other mathematical operations besides +, -, *, and /.

API Version

4.2

See Also

ENVIRaster, PixelwiseBandMathRaster Task