MLTrainingDataFromROIs Task

This task builds a spectral raster from an input raster and ROIs for use with ENVI Machine Learning routines.

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 an input ROI file

ROIFile = Filepath('qb_boulder_roi.xml', Subdir=['data'], $

Root_Dir=e.Root_Dir)

ROI = e.OpenROI(ROIFile)

 

; Get the statistics task from the catalog of ENVITasks

StatsTask = ENVITask('NormalizationStatistics')

 

; Define inputs

StatsTask.INPUT_RASTERS = Raster

 

; Run the task

StatsTask.Execute

 

; Get the data prep task from the catalog of ENVITasks

DataPrepTask = ENVITask('MLTrainingDataFromROIs')

 

; Define inputs

DataPrepTask.INPUT_RASTER = Raster

DataPrepTask.INPUT_ROI = ROI

DataPrepTask.BACKGROUND_LABELS = ['Disturbed Earth', 'Water']

DataPrepTask.NORMALIZE_MIN_MAX = StatsTask.Normalization

DataPrepTask.Execute

 

; Path to the training raster

Print, DataPrepTask.Output_Raster_URI

Syntax

Result = ENVITask('MLTrainingDataFromROIs')

Input parameters (Set, Get): BACKGROUND_LABELS, INPUT_RASTER, INPUT_ROI, NORMALIZE_MIN_MAX, 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

BACKGROUND_LABELS (optional)

Specify the ROI classes to be used as background, classes of no interest.

INPUT_RASTER (required)

Specify the input raster to use for extracting spectral data.

INPUT_ROI (required)

Specify the ROIs that indicate the label pixels for each desired class in the INPUT_RASTER.

NORMALIZE_MIN_MAX (required)

Specify the data value that corresponds to 0% and 100% reflectance.

OUTPUT_RASTER_URI (optional)

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

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

MLTrainingDataFromSpectralLibrary Task