RasterStatistics Task

This task computes statistics on a raster.

Use the RasterHistogram task to compute a histogram for a raster.

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)

 

; Get the task from the catalog of ENVITasks

Task = ENVITask('RasterStatistics')

 

; Define inputs

Task.INPUT_RASTER = Raster

Task.OUTPUT_REPORT_URI = e.GetTemporaryFilename('txt')

 

; Run the task

Task.Execute

 

; Print Statistics

Print, Task.MAX

Print, Task.MEAN

Print, Task.MIN

Print, Task.NPIXELS

Print, Task.STDDEV

Syntax

Result = ENVITask('RasterStatistics')

Input properties (Set, Get): COMPUTE_COVARIANCE, COMPUTE_HISTOGRAMS, INPUT_RASTER, OUTPUT_REPORT_URI

Output properties (Get only): CORRELATION, COVARIANCE, EIGENVALUES, EIGENVECTORS, MAX, MEAN, MIN, NPIXELS, 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:

COMPUTE_COVARIANCE (optional)

Set this property to true to compute covariance matrix, eigenvectors, eigenvalues, and correlation on the raster. The options are true or false (default).

COMPUTE_HISTOGRAMS (optional)

Set this property to true to compute histograms. The result will be added to the report file specified by OUTPUT_REPORT_URI.

CORRELATION

This is the correlation matrix of the data.

COVARIANCE

This is the covariance matrix of the data.

EIGENVALUES

This is an array of eigenvalues from the data.

EIGENVECTORS

This is an array of eigenvectors from the data.

INPUT_RASTER (required)

Specify a raster from which to generate statistics.

MAX

This is the maximum data value of each band.

MEAN

This is the mean data value of each band.

MIN

This is the minimum data value of each band.

NPIXELS

This is the number of pixels in the raster.

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 data value of each band.

Version History

ENVI 5.2

Introduced

ENVI 5.5.3

Added COMPUTE_HISTOGRAMS and OUTPUT_REPORT_URI properties

API Version

4.2

See Also

ENVITask, ENVIRasterStatistics, ENVISubsetRaster, RasterHistogram Task