This task creates a label raster from an input raster and regions of interest (ROIs) that correspond to a specific feature. 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 are in the ROI, which identifies the feature of interest.

All images used for training and classification 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 using the BuildLabelRasterFromROI task. Note that while this 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


Sample data files are available on our ENVI Tutorials web page. Click the "Deep Learning" link in the ENVI Tutorial Data section to download a .zip file containing the data. Extract the contents to a local directory. Files are located in the tornado directory.

; Start the application
e = ENVI()
 
; Update the following line with the correct path
; to the tutorial data files
File = 'C:\MyTutorialFiles\TrainingRaster1.dat'
Raster = e.OpenRaster(File)
 
; Update the following line with the correct path
; to the tutorial data files
ROIFile = 'C:\MyTutorialFiles\TrainingRaster1ROIs.xml'
ROI = e.OpenROI(ROIFile)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('BuildLabelRasterFromROI')
 
; Define inputs
Task.INPUT_RASTER = Raster
Task.INPUT_ROI = ROI
Task.CLASS_NAMES = ['Roof Damage', $ 
  'Structural Damage', 'Rubble', 'Blue Tarps']
 
; 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('BuildLabelRasterFromROI')

Input properties (Set, Get): CLASS_NAMES, INPUT_RASTER, INPUT_ROI, 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 ROIs do not contain all these classes, or if they are out of order, this parameter will ensure consistency between tasks.

INPUT_RASTER (required)

Specify the input raster to use for label data.

INPUT_ROI (required)

Specify an ROI that indicates the labeled pixels for the desired class in the input raster.

In some cases, you may want to create a label raster that consists entirely of background pixels with no feature pixels. To do this, create an empty ENVIROI object and use it for INPUT_ROI; for example:

roi = ENVIROI(NAME='empty', color=[0,255,128])
Task.INPUT_ROI = roi

OUTPUT_RASTER

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

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, BuildLabelRasterFromClassification Task, ClassActivationToPixelROI Task