This task creates a classification raster by thresholding on each band of the raster.
Example
This example uses the default parameter settings:
e = ENVI()
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
StatTask = ENVITask('RasterStatistics')
StatTask.INPUT_RASTER = Raster
StatTask.Execute
Task = ENVITask('RuleRasterClassification')
Task.INPUT_RASTER = Raster
Task.THRESHOLD = StatTask.MEAN
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
Syntax
Result = ENVITask('RuleRasterClassification')
Input parameters (Set, Get): CLASS_COLORS, CLASS_NAMES, INPUT_RASTER, MINIMUM_RULE, OUTPUT_RASTER_URI, THRESHOLD
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
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_URI (optional)
Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER.
- If you do not specify this parameter, or set it to an exclamation symbol (!), ENVI creates a temporary file.
- 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.
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.
Output Parameters
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
Methods
Execute
Parameter
ParameterNames
Properties
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
TAGS
Version History