Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

  >  Docs Center  >  ENVI API  >  ENVI Classic Data Control  >  ENVI_BANDMAX_SELECT_BANDS



This function performs the BandMax background suppression algorithm to derive a subset of significant bands using input target and background spectra. The resulting band subset can be used to highlight targets and suppress backgrounds in a classification or other analysis.


Result = ENVI_BANDMAX_SELECT_BANDS(TargetSpectra, BackgroundSpectra [, GOOD_BAND_COUNT=variable] [, GOOD_BAND_LIST=variable] [, SIGNIFICANCE=variable] [, THRESHOLD=value])

Return Value

The return value is an array of band positions that are the best for differentiating between the target and background spectra. This value can be used as a POS input to other ENVI Classic processing functions. If no significant bands are found, a value of –1 is returned.



This is an array of one or more spectra representing the input targets.


This is an array of one or more spectra representing the input backgrounds. These spectra must have the same number of bands as the TargetSpectra argument.


GOOD_BAND_COUNT (optional)

Use this keyword to specify a named variable that contains a scalar value with the number of significant bands found by the BandMax algorithm.

GOOD_BAND_LIST (optional)

Use this keyword to specify a named variable that contains an array of zeros and ones, indicating which bands the BandMax algorithm determines are significant. Each value is set to 0 (indicating this band should be ignored for processing) or 1 (indicating this band is significant for isolating the targets from the background data). If no significant bands are found, the variable returned by this keyword is undefined.


Use this keyword to specify a named variable that contains an array of band significance values. The array returned by this keyword contains floating-point values ranging from 0 to 1. Each value indicates how well the corresponding band differentiates between target and background spectra. If an error is encountered in the processing, a value of –1 is returned.

THRESHOLD (optional)

Use this keyword to 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 this function returns. The default threshold value is calculated to select 25% of the input bands, but never less than six bands. If you specify an undefined named variable for this keyword, the default threshold value is returned for that variable.


The following example uses the cup95eff.int file, which is provided in your installation of ENVI Classic. The xx is the software version number:

Windows: C:\Program Files\Harris\ENVIxx\classic\data

UNIX and Linux: /usr/local/harris/envixx/classic/data

The jpl1.sli file is in the envixx\classic\spec_lib\jpl_lib directory. Input image wavelengths are derived from the cup95eff.int file to resample the spectra from the library in the jpl1.sli file. One resampled spectrum is used as a target, and another is used as the background in the BandMax algorithm.

;+ This example uses the BandMax algorithm to
; determine a subset of bands from the cup95eff.int
; image file that we can use to distinguish an Alunite
; target spectrum from a well-ordered Kaolinite background
; spectrum. These spectra are a part of the jpl1.sli spectral
; library.
PRO BandMaxExample
  compile_opt IDL2
  ; Find the input image file and query its wavelengths. 
  ; Thesewavelengths are used to resample the input spectra.
  cupriteFile = envi_pickfile(filter='*.int', $
     title='Find the "cup95eff.int" File')
  if (cupriteFile eq '') then return
  envi_open_file, cupriteFile, r_fid=cupriteFID
  envi_file_query, cupriteFID, wl=cupriteWLs
  ; Find the input spectral library and query its number 
  ; of samplesand wavelengths. The number of samples value 
  ; is used to accessspecific spectra in the library. The 
  ; wavelengths are used toresample the input spectra.
  libFile=envi_pickfile(filter='*.sli', $   
     title='Find the "jpl1.sli" File')
  if (libFile eq '') then return
  envi_open_file, libFile, r_fid=libFID
  envi_file_query, libFID, ns=libNS, wl=libWLs
  ; Get spectrum for Alunite (the target) from the input 
  ; spectrallibrary.
  libSpectrum3=envi_get_slice(fid=libFID, $
     line=3, pos=0, xs=0, xe=libNS - 1)
  ; Resample Alunite spectrum to the wavelengths of the 
  ; input image.
  envi_resample_spectra, libWLs, libSpectrum3, cupriteWLs, $   
  ; Get spectrum for well-ordered Kaolinite (the background) 
  ; fromthe input spectral library.
  libSpectrum83 = envi_get_slice(fid=libFID, line=83, $   
     pos=0, xs=0, xe=libNS - 1)
  ; Resample Kaolinite spectrum to the wavelengths of the 
  ; inputimage.
  envi_resample_spectra, libWLs, libSpectrum83, cupriteWLs, $
  ; Perform the BandMax algorithm on the Alunite target 
  ; and theKaolinite background to obtain a subset for the 
  ; input image.
  subset = envi_bandmax_select_bands(targetSpectrum, $
  ; Show the resulting subset. This subset can be used as an 
  ; input tothe POS keyword of any ENVI library routine. It 
  ; will help todifferentiate the target from the background 
  ; in the input image.
  print, subset
  ; Exit ENVI

This example produces the following subset of band positions:

2   3   6   11   14   15   17   18   21   29   30   35   37

API Version


© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us