This task builds a training raster from an input raster and a Spectral Library for use with ENVI Machine Learning training tasks.

Example


; Start the application
e = ENVI()
 
; Open an input raster file
RasterFile = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(RasterFile)
 
; Open a spectral library from the distribution
specLibFile = FILEPATH('veg_2grn.sli', ROOT_DIR=e.ROOT_DIR, $
SUBDIR=['resource', 'speclib', 'veg_lib'])
 
; Open spectral library
specLib = ENVISpectralLibrary(specLibFile)
 
; Define spectra names
specNames = ['*redwood*',  '*oak*', 'Jasper Ridge Serpentine']
 
; Get the data prep task from the catalog of ENVITasks
DataPrepTask = ENVITask('MLTrainingDataFromSpectralLibrary')
 
; Define inputs
DataPrepTask.INPUT_RASTER = Raster
DataPrepTask.INPUT_SPECTRAL_LIBRARY = specLib 
DataPrepTask.SPECTRA_NAMES = specNames
DataPrepTask.Execute
 
; Path to the training raster
Print, DataPrepTask.Output_Raster_URI

Syntax


Result = ENVITask('MLTrainingDataFromSpectralLibrary')

Input parameters (Set, Get): INPUT_RASTER, INPUT_SPECTRAL_LIBRARY, SPECTRA_NAMES, OUTPUT_RASTER_URI

Output parameters (Get only): OUTPUT_RASTER

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters


INPUT_RASTER (required)

Specify the input raster to use for extracting spectral data.

INPUT_SPECTRAL_LIBRARY (required)

Specify the spectral library on which to extract spectral data from the INPUT_RASTER.

SPECTRA_NAMES (required)

Specify the target spectra of interest. Targets will be used to extract matching data as foreground classes collected from the INPUT_RASTER. Spectra not referenced will be collected as background class data.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.

  • If you set this parameter to an asterisk symbol (*), the output raster will be virtual and not written to disk.
  • If you do not specify this parameter, or set it to an exclamation symbol (!), a temporary file will be created.
  • If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.

Output Parameters


OUTPUT_RASTER

This is a reference to the output raster of filetype ENVI.

Methods


Execute

Parameter

ParameterNames

See ENVI Help for details on these ENVITask methods.

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

See the ENVITask topic in ENVI Help for details.

Version History


Machine Learning 2.0

Introduced

See Also


MLTrainingDataFromROIs Task