MahalanobisDistanceClassification Task

This task performs a Mahalanobis Distance supervised classification. Mahalanobis Distance is a direction-sensitive distance classifier that uses statistics for each class. It is similar to Maximum Likelihood classification, but it assumes all class covariances are equal and therefore is a faster method. All pixels are classified to the closest training data.

Example

; 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)

File2 = Filepath('qb_boulder_msi_vectors.shp', Subdir=['data'], $

  Root_Dir=e.Root_Dir)

Vector = e.OpenVector(File2)

 

; Get training statistics

StatTask = ENVITask('TrainingClassificationStatistics')

StatTask.INPUT_RASTER = Raster

StatTask.INPUT_VECTOR = Vector

StatTask.Execute

 

; Get the task from the catalog of ENVITasks

Task = ENVITask('MahalanobisDistanceClassification')

 

; Define inputs

Task.INPUT_RASTER = Raster

Task.COVARIANCE = StatTask.Covariance

Task.MEAN = StatTask.Mean

Task.CLASS_PIXEL_COUNT = StatTask.Class_Pixel_Count

 

; 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('MahalanobisDistanceClassification')

Input parameters (Set, Get): CLASS_COLORS, CLASS_NAMES, CLASS_PIXEL_COUNT, COVARIANCE, INPUT_RASTER, MEAN, OUTPUT_RASTER_URI, OUTPUT_RULE_RASTER_URI, REGULARIZATION_METHOD, REGULARIZATION_TOLERANCE, THRESHOLD_MAX_DISTANCE

Output parameters (Get only): OUTPUT_RASTER, OUTPUT_RULE_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)

This is an array of RGB triplets representing the class colors as defined by the input vector.

CLASS_NAMES (optional)

This is a string array of class names as defined by the input vector.

CLASS_PIXEL_COUNT (required)

Specify an array that is the number of pixels per class: [number of classes].

COVARIANCE (required)

Specify an array that is [number of bands, number of bands, number of classes].

INPUT_RASTER (required)

Specify a raster on which to perform supervised classification.

MEAN (required)

Specify an array that is [number of bands, number of classes].

OUTPUT_RASTER_URI (optional)

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

OUTPUT_RULE_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_RULE_RASTER.

REGULARIZATION_METHOD (optional)

Specify a method for regularizing the covariance matrix:

REGULARIZATION_TOLERANCE (optional)

Specify the tolerance value to use for matrix regularization. If not set, the following values will be used based on the regularization method

THRESHOLD_MAX_DISTANCE (optional)

Specify a pixel value between 0 and 10000000 that applies to all classes, or specify an array of pixel values, one for each class. The number of array elements must equal the number of classes. Mahalanobis Distance accounts for possible non-spherical probability distributions. This value represents the distance within which a class must fall from the center or mean of the distribution for a class. The smaller the distance threshold, the more pixels that are unclassified.

Output Parameters

OUTPUT_RASTER

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

OUTPUT_RULE_RASTER

This is a reference to the output rule image of filetype ENVI.

This output will not be generated unless its associated URI input parameter is set.

Methods

Execute

Parameter

ParameterNames

Properties

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History

ENVI 5.2

Introduced

ENVI 6.2

Added the REGULARIZATION_METHOD and REGULARIZATION_TOLERANCE parameters

See Also

ENVITask, MinimumDistanceClassification Task, MaximumLikelihoodClassification Task, Masking Support in ENVITasks