This task subsets a raster spectrally using the BandMax algorithm.

The virtual raster associated with this task is ENVIBandMaxSubsetRaster.

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 task.
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
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('BandMaxSubsetRaster')
 
; Define inputs
Task.INPUT_RASTER = raster
Task.TARGET = targetSpec
Task.BACKGROUND = backgroundSpec
Task.THRESHOLD = thresh
 
; Run the task
Task.Execute
 
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
 
; Add the output to the Data Manager
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax


Result = ENVITask('BandMaxSubsetRaster')

Input parameters (Set, Get): BACKGROUND, INPUT_RASTER, NUMBER_BANDS, OUTPUT_RASTER_URI, TARGET, THRESHOLD

Output parameters (Get only): OUTPUT_RASTER

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters


BACKGROUND (required)

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

INPUT_RASTER (required)

Specify the input ENVIRaster to subset.

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.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.

  • If you set this parameter to an asterisk symbol (*), the output raster will be virtual and not written to disk.
  • If you do not specify this parameter, or set it to an exclamation symbol (!), a temporary file will be created.
  • If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.

TARGET (required)

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

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.

Output Parameters


OUTPUT_RASTER

This is a reference to the output raster of filetype ENVI.

Methods


Execute

Parameter

ParameterNames

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History


ENVI 6.1

Introduced

See Also


ENVITask, SubsetRaster Task