ParallelepipedClassification Task

This task performs a parallelepiped supervised classification. Parallelepiped classification uses a simple decision rule to classify multispectral data. The decision boundaries form an n-dimensional parallelepiped classification in the image data space. The dimensions of the parallelepiped classification are defined based upon a standard deviation threshold from the mean of each selected class.

Example

; Start the application

e = ENVI()

 

; Open an input raster and vector

File1 = Filepath('qb_boulder_msi', Subdir=['data'], $

  Root_Dir=e.Root_Dir)

 

Raster = e.OpenRaster(File1)

 

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

 

class_names = ['Unclassified', StatTask.CLASS_NAMES]

num_classes = n_elements(StatTask.CLASS_NAMES)

lookup = bytarr(3, num_classes + 1)

 

; Set the unclassified class to black and use ROI colors

lookup = bytarr(3,num_classes+1)

lookup[0,1] = StatTask.CLASS_COLORS

; Get the task from the catalog of ENVITasks

Task = ENVITask('ParallelepipedClassification')

 

; Define inputs

Task.INPUT_RASTER = Raster

Task.MEAN = StatTask.MEAN

Task.STDDEV = StatTask.STDDEV

 

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

DataColl.Add, Task.OUTPUT_RASTER

 

; Display the result

View = e.GetView()

Layer = View.CreateLayer(Task.OUTPUT_RULE_RASTER)

Layer = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax

Result = ENVITask('ParallelepipedClassification')

Input properties (Set, Get): CLASS_COLORS, CLASS_NAMES, INPUT_RASTER, MEAN, OUTPUT_RASTER_URI, OUTPUT_RULE_RASTER_URI, STDDEV, STDWIDTH

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

This is an array of [3, number of classes] for RGB triplets representing the class colors.

CLASS_NAMES (optional)

This is a string array of [number of classes] for unclassified and class names.

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

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 to export the associated OUTPUT_RASTER.

OUTPUT_RULE_RASTER

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

OUTPUT_RULE_RASTER_URI (optional)

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

STDDEV (optional)

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

STDWIDTH (required)

SSpecify the width around standard deviations within which the spectrum may fall and still be classified into that class. If an array is specified, each class is tested with its corresponding width.

Version History

ENVI 6.0

Introduced

API Version

4.2

See Also

ENVITask