This section describes the following topics:

You can also write a script to work with spectral libraries using any of the following: ENVISpectralLibrary, GetSpectrumFromLibrary task, QuerySpectralLibrary task, ResampleSpectrum task

Spectral Library Builder


Use the Spectral Library Builder to create ENVI spectral libraries from a variety of spectra sources, including ASCII files, spectral files produced by ASD spectrometers, other spectral libraries, ROI means, and spectral profiles and plots. The collected spectra are automatically resampled to an input wavelength space using FWHM information, if available.

Add Wavelength Data

  1. From the Toolbox, select Spectral > Spectral Libraries > Spectral Library Builder. The Spectral Library Builder dialog appears.
  2. Select the input file containing the wavelengths and optional FWHM values.
    • If you select Input Data File, the wavelengths and FWHM values (if present) are read from the ENVI header file. Click OK. The Spectral Library Builder dialog appears.
    • If you select Input ASCII File, the Enter File Containing Output Wavelength dialog appears. Select an ASCII file. The Input ASCII File dialog appears. Specify the Wavelength Column. If you know the units of the wavelengths contained in the file, select the units from the Wavelength Units drop-down list. If the ASCII file also contains FWHM values, specify the FWHM Column. Click OK. The Spectral Library Builder dialog appears.
    • If you select First Input Spectrum, the Spectral Library Builder dialog appears. Click OK.

Collect Spectra

Use the Spectral Library Builder dialog to collect endmember spectra from a variety of sources. All spectra are automatically resampled to the selected wavelengths. For details, see Manage Endmember Spectra.

Write Spectral Libraries

After collecting your spectra, select an output option to build the spectral library:

  • To create an ASCII file containing all of the spectra, select File > Save Spectra As > ASCII from the Spectral Library Builder menu bar. Specify an output filename and click OK.
  • To create an ENVI spectral library either as an output file or in memory, select File > Save Spectra As > Spectral Library.

Spectral Library Resampling


Use Spectral Library Resampling to resample spectral libraries to match either the response of a known instrument (for example, AVIRIS), an ASCII wavelength file (with or without full-width-half-maximum information), or the wavelengths of a specific image input file. The resampling method you use depends on the input information. If you only provide wavelengths (band centers), ENVI assumes critical sampling and uses a Gaussian model with a FWHM equal to the band spacings. If you provide wavelengths and FWHM information, ENVI uses a Gaussian model using the FWHM spacings. If you provide a filter function, ENVI uses that for the resampling.

  1. From the Toolbox, select Spectral > Spectral Libraries > Spectral Library Resampling. The Spectral Resampling Input File dialog appears.
  2. Select the name of a spectral library.
  3. Click OK.

For information on plotting spectral libraries, see Spectral Library Viewer.

Select Resampling Types

  1. Select the appropriate Resample Wavelength to radio button.
  2. Enter a Set Bad Values to value.
  3. Bands that fall outside the input wavelength range are considered bad values, and the value you enter will be used for these bands. No extrapolation is performed. For example, if your input data ranges from 0.4-2.4 mm and you resample to 0.3-2.5 mm, the bands between 0.3-0.4 and 2.4-2.5 mm will contain the Set Bad Values to value.
  4. Select output to File or Memory.
  5. Click OK.
  6. An additional dialog may appear, depending on the type of resampling selected.

Resample from Data Files

If you select Input Data File as the resampling method in the Spectral Resampling Parameters dialog, the File Containing Output Wavelength dialog appears.

The data file must contain wavelength values used for the resampling in its associated header. If FWHM values are present in the file header, they are also used in the resampling.

  1. Select the filename.
  2. Click OK. ENVI adds the resulting output to the Layer Manager.

Resample from ASCII Files

If you select Input ASCII File as the resampling method in the Spectral Resampling Parameters dialog and click OK, the Enter File Containing Output Wavelength dialog appears.

  1. Select the ASCII wavelength file. The Input ASCII File dialog appears.
  2. Specify the Wavelength Column.
    • If you know the units of the wavelengths contained in the file, select the units from the Wavelength Units drop-down list.
    • If the ASCII file also contains FWHM values, specify the FWHM Column.
  3. Click OK. ENVI adds the resulting output to the Layer Manager.
  4. If the input and output wavelength ranges do not overlap completely, and you did not specify output wavelength units, ENVI prompts you to specify the output wavelength units to perform the conversion.

Resample from User-Defined Filter Functions

If you select User Defined Filter Function as the resampling method in the Spectral Resampling Parameters dialog, the Input Filter Function Spectral Library dialog appears.

The user-defined filter function must take the form of an ENVI spectral library with each sample of the image representing a wavelength value and each line of the image representing an individual filter function. The value at each wavelength must be a weight between 0 and 1, which is used as a multiplicative factor when applied to the library being resampled. To see an example filter function file, navigate to the filterfuncs directory of your ENVI installation, open the Landsat TM file tm.sli as a spectral library file, and plot the filter functions.

  1. In the Input Filter Function Spectral Library dialog, select the filter function.
  2. Click OK. ENVI adds the resulting output to the Layer Manager.
  3. Note: You should not resample from a low resolution to a high-resolution spectrum; the results may be false.

Resample from Pre-Defined Filter Functions

If you select Pre-Defined Filter Function as the resampling method in the Spectral Resampling Parameters dialog, the Sensor drop-down list appears.

Select a supported sensor type. ENVI adds the resulting output to the Layer Manager.

Note: The SPOT-1 filter functions included in spot.sli correspond to the HRV-1 instrument. The SPOT-4 filter functions included in spot.sli correspond to the HRVIR-1 instrument. (For the Vegetation instrument, bands 2, 3, and 4 are the same as HRVIR-1 but band 1 is not provided.) The SPOT-5 filter functions included in spot.sli correspond to the HRG-1 instrument.

See Also


Spectral Library Viewer