This task computes 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('RasterHistogram')
 
; Define inputs
Task.INPUT_RASTER = Raster
 
; Run the task
Task.Execute
 
; Display histogram results in a plot window
nbands = Task.INPUT_RASTER.nBands
color = [[!color.red],[!color.green],[!color.blue],[!color.violet]]
for band=0, nbands-1 do $
  p = plot(findgen(task.Output_nBins[band], Start=task.output_min[band], $
  increment=task.Output_BinSize[band]), (task.output_counts[band]), $
  /hist,buffer=buffer, /overplot, color=color[*,band], ytickformat='(g0)', $
  thick=2, clip=0)

Syntax


Result = ENVITask('RasterHistogram')

Input properties (Set, Get): INPUT_BINSIZE, INPUT_MAX, INPUT_MIN, INPUT_NBINS, INPUT_RASTER

Output properties (Get only): OUTPUT_BINSIZE, OUTPUT_COUNTS, OUTPUT_MAX, OUTPUT_MIN, OUTPUT_NBINS

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:

INPUT_BINSIZE (optional)

Specify a value for the bin size, to manage the resolution of the histogram. INPUT_BINSIZE is mutually exclusive from INPUT_NBINS.

INPUT_MAX (optional)

Specify the maximum value of the histogram for each band. Set to a scalar value that applies to all bands, or set to an array of values, one per band.

INPUT_MIN (optional)

Specify the minimum value of the histogram for each band. Set to a scalar value that applies to all bands, or set to an array of values, one per band.

INPUT_NBINS (optional)

Specify a value for the number of bins. INPUT_NBINS is mutually exclusive from INPUT_BINSIZE. If you do not specify either of these properties, a default value of 256 bins will be used for all bands.

INPUT_RASTER (required)

Specify a raster from which to generate histogram statistics.

OUTPUT_BINSIZE

This is the bin size of the histogram for each band.

OUTPUT_COUNTS

This is the pixel count of the histogram for each band.

OUTPUT_MAX

This is the maximum value of the histogram for each band.

OUTPUT_MIN

This is the minimum value of the histogram for each band.

OUTPUT_NBINS

This is the number of bins the histogram was limited to for each band.

Version History


ENVI 5.3

Introduced

API Version


4.2

See Also


ENVITask, ENVRasterStatistics, RasterStatistics Task