This task creates a label raster from an input raster and binary classification raster, which can be used to train a model. The output label raster contains the original image bands plus an additional band that consists of a binary mask. The mask band indicates which pixels in the input raster correspond to a feature of interest.

All images used for training should have the same data type (byte) and range of data values. For better results, use the BuildDeepLearningRaster task with the same minimum and maximum pixel values for all images prior to calling the BuildLabelRasterFromClassification task. Note that while the BuildLabelRasterFromClassification task will do this conversion for you when images are not of byte data type, it converts each image with its own minimum and maximum, which is not as optimal as a single minimum and maximum for all images.

This task is part of ENVI Deep Learning, which requires a separate license and installation.

Example


This example calculates a Normalized Difference Vegetation Index (NDVI) on a multispectral image. It applies a threshold to the highest NDVI values and creates a binary classification image from the thresholded values. The classification image is used to create a label raster that can be used to train a deep learning model to identify green vegetation.

; Start the application
e = ENVI()
 
; Open an input image
File = Filepath('qb_boulder_msi', SUBDIR=['data'], $
  ROOT_DIR=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Calculate NDVI
SITask = ENVITask('SpectralIndices')
SITask.INPUT_RASTER = Raster
SITask.INDEX = 'NDVI'
SITask.Execute
 
; Apply color slice classification
ClassTask = ENVITask('ColorSliceClassification')
ClassTask.INPUT_RASTER = SITask.OUTPUT_RASTER
ClassTask.CLASS_COLORS = [0,128,0]
ClassTask.CLASS_RANGES = [0.3, 1.0]
ClassTask.Execute
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('BuildLabelRasterFromClassification')
 
; Define inputs
Task.INPUT_RASTER = Raster
Task.INPUT_CLASSIFICATION_RASTER = ClassTask.OUTPUT_RASTER
 
; Run the task
Task.Execute
 
; Add the output to the Data Manager
e.Data.Add, Task.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax


Result = ENVITask('BuildLabelRasterFromClassification')

Input properties (Set, Get): CLASS_NAMES, INPUT_CLASSIFICATION_RASTER, INPUT_RASTER, OUTPUT_RASTER_URI

Output properties (Get only): OUTPUT_RASTER

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

Methods


This task inherits the following methods from ENVITask. See the ENVITask topic in ENVI Help.

  • AddParameter
  • Execute
  • Parameter
  • ParameterNames
  • RemoveParameters

Properties


This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

See the ENVITask topic in ENVI Help for details.

This task also contains the following properties:

CLASS_NAMES (optional)

Specify a string array with a list of class names that the model will be trained to find. If the input classification raster does not contain all these classes, or if they are out of order, this parameter will ensure consistency between tasks.

INPUT_CLASSIFICATION_RASTER (required)

Specify a binary classification raster that provides labeled pixel data for the desired class in the input raster. You can create the classification raster using any of ENVI's tools to create single-class output. With a binary classification raster, pixel values of 1 represent the feature of interest and values of 0 represent the background. The classification raster must have the same dimensions as the input raster.

INPUT_RASTER (required)

Specify the input raster that will be used as label data.

OUTPUT_RASTER

This is a reference to the output raster of filetype ENVI and byte data type.

If INPUT_RASTER is not byte data then each band will be byte stretched to its minimum and maximum.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.

Version History


Deep Learning 1.0

Introduced

Deep Learning 1.1

Added CLASS_NAMES property

See Also


ENVIDeepLearningLabelRaster, BuildLabelRasterFromROI Task