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 Display  >  ENVI_COLLECT_SPECTRA

ENVI_COLLECT_SPECTRA

ENVI_COLLECT_SPECTRA

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.

Use this procedure to perform spectra collection. This procedure incorporates ENVI Classic’s Endmember Collection dialog into a user function; the dialog is used to collect training sets and endmembers for classification and mapping routines.

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

Syntax


ENVI_COLLECT_SPECTRA, DIMS=array, FID=file ID [, INFO=variable] [, M_FID=file ID] [, M_POS=value] [, POS=array], PROCEDURE=procedure [, TITLE=string]

Keywords


DIMS

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

FID

The file ID (FID) is a long-integer scalar with a value greater than 0. An invalid FID has a value of -1. The FID is provided as a named variable by any routine used to open or select a file. Often, the FID is returned from the keyword R_FID in the ENVIRasterToFID routine. Files are processed by referring to their FIDs. If you work directly with the file in IDL, the FID is not equivalent to a logical unit number (LUN).

INFO (optional)

Use this keyword to specify user-defined data to pass to the routine defined by the keyword PROCEDURE. The value of INFO can be any IDL variable, including structures.

M_FID (optional)

Use this keyword to specify the file ID of the mask file. This value is returned from the keyword R_FID in the ENVI_OPEN_FILE procedure. M_FID is a long integer with a value greater than 0. An invalid file ID has a value of -1.

M_POS (optional)

Use this keyword to specify the band position of the mask band. M_POS is a long integer with a value greater than or equal to 0.

POS (optional)

Use this keyword to specify an array of band positions. POS is an array of long integers, ranging from 0 to the number of bands minus 1. The default is POS = LINDGEN(nb), where the number of bands (nb) is retrieved from the file specified by FID.

PROCEDURE

Use this keyword to specify the procedure to call when you click Apply on the Endmember Collection dialog. PROCEDURE must have the following definition even if you do not specify the optional keywords to ENVI_COLLECT_SPECTRA:

PRO MY_PROCEDURE, FID=FID, POS=POS, DIMS=DIMS, $      INFO=INFO, M_FID=M_FID, M_POS=M_POS, SPEC=SPEC, $      SNAMES=SNAMES, SCOLORS=SCOLORS, _EXTRA=_EXTRA

The values from the keywords FID, POS, DIMS, INFO, M_FID and M_POS are passed through from the call to ENVI_COLLECT_SPECTRA. SPEC, SNAMES and SCOLORS contain information about the collected spectra. The SPEC array, whose dimensions are [nb, nspec], contains the data for the collected spectra. SNAMES is a string array of the collected spectra names. SCOLOR is an array of graphics color indices. To convert graphics colors to RGB triplets, see ENVI_GET_RGB_TRIPLETS. The keyword _EXTRA is used to collect unused keywords.

TITLE

Use this keyword to specify the string used in the title bar of the Spectral Collection dialog. The default string is 'Endmember Collection'.

Example


PRO EXAMPLE_ENVI_COLLECT_SPECTRA
  compile_opt IDL2
  envi_select, fid=fid  
  if (fid eq -1) then return  
  envi_collect_spectra, fid=fid, $
     procedure='my_procedure'
END
  ;
  ; Define the procedure that is called 
  ; each time the apply button is selected.
  ;
PRO MY_PROCEDURE, fid=fid, pos=pos, $
   dims=dims, spec=spec,   snames=snames, $
   scolors=scolors, _extra=_extra  
  print, 'snames  ', snames
  print, 'scolors ', scolors  
  print, 'spec    ', spec
END

API Version


3.2



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