This routine only works with ENVI Classic display groups and cannot be used with the ENVI display or in code that starts the application with the ENVI function.

This procedure displays an ENVI Classic Band Selection dialog that allows you to select three bands from the Available Bands List.

Note: An interactive ENVI Classic session is required to run this procedure.


RGB_GET_BANDS, DIMS=array, FID=file ID [, /NO_DIMS], POS=array [, STR=string array], TITLE=string



The “dimensions” keyword is a five-element array of long integers that defines the spatial subset (of a file or array) to use for processing. Nearly every time you specify the keyword FID, you must also specify the spatial subset of the corresponding file (even if the entire file, with no spatial subsetting, is to be processed).

  • DIMS[0]: A pointer to an open ROI; use only in cases where ROIs define the spatial subset. Otherwise, set to -1L.
  • DIMS[1]: The starting sample number. The first x pixel is 0.
  • DIMS[2]: The ending sample number
  • DIMS[3]: The starting line number. The first y pixel is 0.
  • DIMS[4]: The ending line number

To process an entire file (with no spatial subsetting), define DIMS as shown in the following code example. This example assumes you have already opened a file using ENVI_SELECT or ENVI_PICKFILE:

  envi_file_query, fid, dims=dims


Use this keyword to specify a named variable that contains the file IDs of the selected files. FID is a three-element array of long integers.

NO_DIMS (optional)

Set this keyword to disable spatial subsetting on the selected RGB bands.


Use this keyword to specify a named variable that contains a three-element array of the selected band positions.

STR (optional)

Use this keyword to specify a string array containing the labels for the text boxes used to enter the three band names. The default value for the array is ['R','G','B'].


Use this keyword to specify the string used in the title bar of the Band Selection dialog window. Enter the title enclosed in single quotes.


This examples uses an RGB selection widget titled “USGS Munsell RGB to HSI Input File” to select three bands. The resulting selection is returned in FID, POS, and DIMS.

Note: If FID(0) = -1, the Cancel button was selected and you should take the appropriate action. There is no requirement that the three bands come from the same file, so you should be sure to properly handle the three FIDs and band positions.

tstr = 'USGS Musell RGB to HSI Input File'
rgb_get_bands, title=tstr, fid=fid, pos=pos, dims=dims
if (fid[0] eq -1) then return

API Version