This task computes statistics from classification training regions. The mean spectra for all vector records are grouped by unique CLASS_ID, CLASS_NAME, or CLASS_CLR attribute values, if any of these attributes exists.
Example
e = ENVI()
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)
StatTask = ENVITask('TrainingClassificationStatistics')
StatTask.INPUT_RASTER = Raster
StatTask.INPUT_VECTOR = Vector
StatTask.OUTPUT_REPORT_URI = e.GetTemporaryFilename('txt')
StatTask.Execute
Task = ENVITask('SpectralAngleMapperClassification')
Task.INPUT_RASTER = Raster
Task.MEAN = StatTask.MEAN
Task.CLASS_NAMES = StatTask.CLASS_NAMES
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
Syntax
Result = ENVITask('TrainingClassificationStatistics')
Input properties (Set, Get): INPUT_RASTER, INPUT_VECTOR, OUTPUT_REPORT_URI
Output properties (Get only): CLASS_COLORS, CLASS_NAMES, CLASS_PIXEL_COUNT, COVARIANCE, MEAN, STDDEV
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
This is an array of RGB triplets representing the class colors as defined by the input vector.
CLASS_NAMES
This is an array of class names as defined by the input vector.
CLASS_PIXEL_COUNT
This is the number of pixels used to compute the training statistics, returned as a long-integer array [number of classes].
COVARIANCE
This is the covariance matrix of the training data, returned as a double-precision array [number of bands, number of bands, number of classes].
INPUT_RASTER (required)
Specify a raster from which to generate statistics.
INPUT_VECTOR (required)
Specify a vector that defines training regions for a raster. Statistics will be calculated from this vector. The vector attributes should include CLASS_NAME and CLASS_CLRS fields, if class names and class colors are desired. The CLASS_CLRS field should contain one RGB triplet representing a color for each class.
MEAN
This is the mean of the training data, returned as a double-precision array [number of bands, number of classes].
OUTPUT_REPORT_URI (optional)
Specify a string with the fully qualified path and filename of a text file that will contain the statistics.
STDDEV
This is the standard deviation of the training data, returned as a double-precision array [number of bands, number of classes].
Version History
ENVI 5.2 |
Introduced |
ENVI 5.5.3 |
Added OUTPUT_REPORT_URI property
|
API Version
4.2
See Also
ENVITask, ROIStatistics Task, PixelStatistics Task