ROIStatistics Task
This task computes statistics from one or more ENVIROIs and their associated raster. The ROI statistics can be used as input to supervised classification methods.
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)
RoiFile = Filepath('qb_boulder_roi.xml', $
ROOT_DIR=e.Root_Dir, $
SUBDIRECTORY=['data'])
Rois = e.OpenRoi(RoiFile)
; Get the task from the catalog of ENVITasks
StatTask = ENVITask('ROIStatistics')
; Get training statistics
StatTask.INPUT_RASTER = Raster
StatTask.INPUT_ROI = Rois
StatTask.OUTPUT_REPORT_URI = e.GetTemporaryFilename('txt')
StatTask.Execute
; Run SAM classification
ClassTask = ENVITask('SpectralAngleMapperClassification')
ClassTask.INPUT_RASTER = Raster
ClassTask.MEAN = StatTask.Mean
ClassTask.CLASS_NAMES = StatTask.ROI_NAMES
ClassTask.CLASS_COLORS = StatTask.ROI_COLORS
ClassTask.Execute
; Add the output to the Data Manager
e.Data.Add, ClassTask.OUTPUT_RASTER
; Display the result
View = e.GetView()
Layer = View.CreateLayer(ClassTask.OUTPUT_RASTER)
Syntax
Result = ENVITask('ROIStatistics')
Input properties (Set, Get): INPUT_RASTER, INPUT_ROI, OUTPUT_REPORT_ROI
Output properties (Get only): COVARIANCE, MAX, MEAN, MIN, ROI_COLORS, ROI_NAMES, ROI_PIXEL_COUNT, 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:
Properties
This task inherits the following properties from ENVITask:
This task also contains the following properties:
COVARIANCE
This is the covariance matrix, returned as an array: [number of bands, number of bands, number of ROIs].
INPUT_RASTER (required)
Specify a raster from which to generate ROI statistics.
INPUT_ROI (required)
Specify an array of one or more ENVIROIs.
MAX
This is the maximum data value, returned as an array: [number of bands, number of ROIs].
MEAN
This is the mean data value, returned as an array: [number of bands, number of ROIs].
MIN
This is the minimum data value, returned as an array: [number of bands, number of ROIs].
OUTPUT_REPORT_URI (optional)
Specify a string with the fully qualified path and filename of a text file that will contain the statistics.
ROI_COLORS
This is an array of RGB triplets representing the ROI colors as defined by the ENVIROIs.
ROI_NAMES
This is an array of ROI names as defined by the input ENVIROIs.
ROI_PIXEL_COUNT
This is the number of pixels for each ROI, returned as an array: [number of ROIs].
STDDEV
This is the standard deviation, returned as an array: [number of bands, number of ROIs].
Version History
ENVI 5.4. 1 |
Introduced |
ENVI 5.5.3 |
Added OUTPUT_REPORT_URI property |
API Version
4.2
See Also
ENVITask, TrainingClassificationStatistics Task, ENVIRaster, ENVIROI, ExtractROIsFromFile Task, PixelStatistics Task