NormalizedEuclideanDistanceClassification Task

This task performs a Normalized Euclidean Distance (NED) supervised classification. NED is a physically-based spectral classification that calculates the distance between two vectors in the same manner as a Euclidean Distance method, but it normalizes the vectors first by dividing each vector by its mean.

Use the TrainingClassificationStatistics task to compute the mean spectra from vector layers.

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

 

; Get the task from the catalog of ENVITasks

Task = ENVITask('NormalizedEuclideanDistanceClassification')

 

; Define inputs

Task.INPUT_RASTER = Raster

Task.MEAN = 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)

See More Examples below.

Syntax

Result = ENVITask('NormalizedEuclideanDistanceClassification')

Input parameters (Set, Get): BACKGROUND_THRESHOLD, CLASS_COLORS, CLASS_NAMES, INPUT_RASTER, MEAN, OUTPUT_RASTER_URI, OUTPUT_RULE_RASTER_URI, STDDEV, THRESHOLD_MAX_DISTANCE, THRESHOLD_STDDEV, USE_SUBSPACE_BACKGROUND

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

BACKGROUND_THRESHOLD (optional)

This is a float value indicating the fraction of the background in the anomalous image to use when calculating statistics using subspace background. It ranges from 0.500 to 1.000 (the entire image), with the default 0.9.

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.

INPUT_RASTER (required)

Specify an input raster to process.

MEAN (required)

Specify an array of size [number of bands, number of classes], representing the mean spectra from the input training regions. You can use the TrainingClassificationStatistics task to compute the mean spectra.

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.

STDDEV (required)

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

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. This value represents a distance threshold. The smaller the threshold, the more pixels that are unclassified. The pixel of interest must be within both the threshold for distance to mean and the threshold for the standard deviation for a class. The condition for Minimum Distance reduces to the lesser of the two thresholds. A higher value for each parameter is more inclusive because more pixels are included in a class for a higher threshold.

THRESHOLD_STDDEV (optional)

Specify the number of standard deviations to use around the mean for all classes, or specify an array of values, one for each class. Enter a pixel value between 0 and 10000000. ENVI does not classify pixels outside this range. The lower the value, the more pixels that are unclassified.

USE_SUBSPACE_BACKGROUND (optional)

Specify whether to use subspace background in statistics calculation.

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

More Examples

Use mean spectra from ROIs as input to NED classification

The following example uses mean spectra from individual ROIs as input to NED classification. The ROIs represent locations of known mineral types. The input image is an AVIRIS hyperspectral scene of Cuprite, Nevada, USA. The source files are available from our ENVI Tutorials web page. Click the Hyperspectral link to download the .zip file to your machine, then unzip the files. You will be using the files the files CupriteAVIRISSubset.dat and CupriteMineralROIs.xml.

  1. Copy the following code into a new window of the IDL Editor and save it to a file named CupriteNEDExample.pro.
  2. Change the input data paths to the location of the files on your system.
  3. Compile and run the program.

PRO CupriteNEDExample

COMPILE_OPT IDL2

 

; Start the application

e = ENVI()

 

; Select input data

File = 'CupriteAVIRISSubset.dat'

CupriteRaster = e.OpenRaster(File)

 

ROIFile = 'CupriteMineralROIs.xml'

rois = e.OpenROI(ROIFile)

 

; Create a mask that includes the ROIs

MeanArray = !NULL

 

For i=0, N_ELEMENTS(rois)-1 DO BEGIN

  ROITask = ENVITask('ROIMaskRaster')

  ROITask.DATA_IGNORE_VALUE = 0

  ROITask.INPUT_MASK_ROI = rois[i]

  ROITask.INPUT_RASTER = CupriteRaster

  ROITask.Execute

 

; Compute the mean from each ROI-masked image

RSTask = ENVITask('RasterStatistics')

RSTask.INPUT_RASTER = ROITask.OUTPUT_RASTER

RSTask.Execute

 

; Construct an array of mean values from the ROIs

MeanArray = [[MeanArray], [RSTask.MEAN]]

EndFOR

 

; Run NED classification

Task = ENVITask('NormalizedEuclideanDistanceClassification')

Task.INPUT_RASTER = CupriteRaster

Task.MEAN = MeanArray

Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()

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(CupriteRaster)

roiLayers = !NULL

FOREACH roi, rois DO $

roiLayers = [roiLayers, Layer.AddRoi(roi)]

Layer3 = View.CreateLayer(Task.OUTPUT_RASTER)

END

Version History

ENVI 5.7

Introduced

See Also

ENVITask, TrainingClassificationStatistics Task