This task creates a classification raster by thresholding on each band of the raster.

Example


This example uses the default property settings:

; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Get the raster statistics
StatTask = ENVITask('RasterStatistics')
StatTask.INPUT_RASTER = Raster
StatTask.Execute
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('RuleRasterClassification')
 
; Define inputs
Task.INPUT_RASTER = Raster
Task.THRESHOLD = StatTask.MEAN
 
; Run the task
Task.Execute
 
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
 
; Add the output to the Data Manager
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax


Result = ENVITask('RuleRasterClassification')

Input properties (Set, Get): CLASS_COLORS, CLASS_NAMES, INPUT_RASTER, MINIMUM_RULE, OUTPUT_RASTER_URI, THRESHOLD

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:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties


This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

CLASS_COLORS (optional)

Specify a (3,n) byte array with the RGB colors for the given ranges, where n is the number of classes

CLASS_NAMES (optional)

This is a string array of class names.

INPUT_RASTER (required)

Specify a raster on which to perform supervised classification.

MINIMUM_RULE (optional)

To use MINIMUM_RULE for the classification, set this value to 1. This uses the lowest score values of each pixel class for the final classification. If 0 (the default of MAXIMUM_RULE), the highest score values of each pixel class are used for the final classification.

For example, a rule image pixel with 3 bands could be classified into grass, water, or dirt when all meet the THRESHOLD. The pixel values are grass: 0.75, water: 0.63, and dirt: 0.46.

  • If the value is 1 (MINIMUM_RULE), dirt will be classified because has the lowest value at 0.46.

  • If the value is 0 (MAXIMUM_RULE), grass will be classified because it has the highest value at 0.75.

OUTPUT_RASTER

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

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.

THRESHOLD (optional)

Specify a value or array of the thresholds. If only a value, it will be used for every band. Pixels lower than this value will be set to unclassified.

Version History


ENVI 6.0

Introduced

API Version


4.2

See Also


ENVITask