Band Math
ENVI's Band Math function accesses data spatially by mapping user-defined
variables to bands or files. You can use ENVI's Band Math dialog to define the
bands or files used as input, to call a user Band Math function, and to write
the result to a file or memory. See "Band Math" ( ENVI User's Guide ) for
complete details about writing proper Band Math expressions.
Writing Band Math User Functions
Since ENVI + IDL gives you access to IDL functionality, you can use the
power of built-in IDL features, IDL user functions, or your own routines to
perform custom Band Math operations. The only requirement for these
functions is that they accept one or more image arrays as input and that they
output a single-band, 2D array with the same dimensions as the input bands.
Band Math user functions are simple to write and execute as Band Math
expressions. For example, to execute a function called BM_RATIO with two
input bands, enter the following in the Enter an expression field of the Band
Math dialog:
bm_ratio(b1, b2)
The function declaration for this routine is as follows:
FUNCTION bm_ratio, b1, b2
The processing that takes place within the Band Math user function has the
same constraints as Band Math expressions. Input data are tiled; therefore,
functions like min() and max() are invalid since they return only the
minimum or maximum of the current tile and not the minimum or maximum of
the input band.
The function accepts the input bands, processes the data, and returns the
result. Functions have the following model:
FUNCTION bm_func, b1, [b2,..., bn, parameters and keywords]
$$$processing steps
$$$RETURN, result
END
To be compatible with tiled processing, custom Band Math functions should
avoid processing that requires the entire band in memory at one time.
评论3