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


  >  Docs Center  >  ENVI API  >  Spectral Read Routines

ENVI

Spectral Read Routines

Spectral Read Routines (Optional)

Spectral read routines handle all spectral data requests, ranging from all spectra for an entire line to a single spectrum. Unlike spatial data requests, the maximum spectral requests are limited to a single line. Spectral data are used extensively throughout ENVI for a number of processing functions and interactive routines.

Spectral requests specify the bands to read, starting and ending pixels, and the line. Spectral readers are also required to open and close the input files. Input filenames are returned from ENVI_FILE_QUERY using the supplied FID. Spectral read routines are defined as follows:

PRO myread_spectral, fid, pos, xs=xs, xe=xe, y=y, spectra=spectra, $
   _extra=_extra

Where:

  • fid: The file ID of the input image. (Note: you must use ENVI_FILE_QUERY to obtain the file information; you cannot currently use ENVIRasterToFID.)
  • pos: The band positions for the desired spectra. POS is a long array with values ranging from 0 to 1, minus the number of bands. If POS is undefined, all the bands for the requested spectra are returned.
  • xs: The x starting pixel for the spectral request (in file coordinates)
  • xe: The x ending pixel for the spectral request (in file coordinates)
  • y: The y line number for the spectral request (in file coordinates)
  • spectra: The name of the variable in which the requested spectra are to be stored. The read routine must define this variable before the routine exits. If the spectra variable is not defined in the routine, ENVI will issue an error.
  • _extra: You must specify this keyword in order to collect keywords not used by custom file readers. The use of _extra prevents errors when calling a routine with a keyword that is not listed in its definition.

The read routine reads the appropriate spectra from the file and stores the results in the SPECTRA variable. Opening and closing input files is performed within the spectral read procedure. The following example only works with unsigned integer data and should not be run on files with other data types.



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