ENVIBandMaxSubsetRaster

This function constructs an ENVIRaster from a source raster that has been spectrally subsetted using the BandMax algorithm.

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

Example

; Start the application

e = ENVI()

 

; Open an input file

File = Filepath('AVIRISReflectanceSubset.dat', $

SUBDIR=['data', 'hyperspectral'], $

ROOT_DIR=e.Root_Dir)

Raster = e.OpenRaster(File)

 

; Define three ROIs, each containing 9 pixels of a common

; material.

nSpectra = 9d

roi1 = EnviRoi(NAME='Green Field')

pixelAddr1 = [[77,182],[78,182],[79,182], $

             [77,183],[78,183],[79,183], $

             [77,184],[78,184],[79,184]]

roi1.AddPixels, pixelAddr1, SPATIALREF=raster.SpatialRef

 

roi2 = EnviRoi(NAME='Soil')

pixelAddr2 = [[386,285],[387,285],[388,285], $

             [386,286],[387,286],[388,286], $

             [386,287],[387,287],[388,287]]

roi2.AddPixels, pixelAddr2, SPATIALREF=raster.SpatialRef

 

roi3 = EnviRoi(NAME='Ground')

pixelAddr3 = [[296,326],[297,326],[298,326], $

             [296,327],[297,327],[298,327], $

             [296,328],[297,328],[298,328]]

roi3.AddPixels, pixelAddr3, SPATIALREF=raster.SpatialRef

 

; Retrieve the spectra from the ROIs and use their mean as

; target and background to the BandMaxSubsetRaster.

spectra1 = raster.GetData(ROI=roi1)

mean1 = Total(spectra1,1) / nSpectra

 

spectra2 = raster.Getdata(ROI=roi2)

mean2 = Total(spectra2,1) / nSpectra

 

spectra3 = raster.GetData(ROI=roi3)

mean3 = Total(spectra3,1) / nSpectra

 

targetSpec = [[mean1], [mean2]]

backgroundSpec = mean3

thresh = 0.387

 

; Create a spectral subset of those bands whose BandMax

; significance values are not less than 0.387.

Subset = ENVIBandMaxSubsetRaster(raster, targetSpec, $

  backgroundSpec, THRESHOLD=thresh)

 

; Display the result

View = e.GetView()

Layer = View.CreateLayer(Subset)

Syntax

Result = ENVIBandMaxSubsetRaster(Background, Input_Raster, Target [, Keywords=value])

Return Value

This method returns an ENVIRaster that is a spectral subset of an original raster file.

Arguments

Background

Specify the background spectra as a floating-point array of [number of bands, number of background spectra].

Input_Raster

Specify the input ENVIRaster.

Target

Specify the target spectra as a floating-point array of [number of bands, number of target spectra].

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.

NAME

Specify a string that identifies the raster.

NUMBER_BANDS (optional)

Specify the number of significant bands for BandMax subset raster. If this value and THRESHOLD are undefined, this task spectrally subsets raster using the BandMax calculated threshold.

THRESHOLD (optional)

Specify a floating-point value ranging from 0.0 to 1.0. This value represents the threshold for the minimum significance value that determines which bands are in the output raster of this task. The default threshold value is calculated to select 25% of the input bands, but never less than six bands. If this value and NUMBER_BANDS are undefined, the default threshold value is used for output raster.

Version History

ENVI 6.1

Introduced

See Also

ENVIRaster, ENVIBandMaxSubsetRaster::Dehydrate, ENVIBandMaxSubsetRaster::Hydrate