Histogram

This tool can be used to generate histogram data (i.e. data about the statistical distribution) of the values in an image. Notice that the output of this tool is text, which can be readily copied and pasted into a spreadsheet program for graphing. The user must specify the size of the bins used to aggregate the data. The default value is 1, however, this is heavily dependent on the characteristic of the input image and should be adjusted accordingly. A bin size that is too large will result in too few bins and therefore a poor representation of the histogram. It is recommended that the range of values in the image (determined by examining the display minimum and maximum values) guide the setting of this parameter. The user can optionally specify the bin starting and ending values. If these two parameters are not set, the algorithm will assume values of the display minimum and maximum values. If the parameters are set, any grid cells containing values either less than the starting bin or higher than the ending bin, will not be included in the histogram. Thus, setting these values can be an effective way of 1) ensuring logically-valued bin ranges, and 2) excluding values that may represent undesirable extremes of the statistical distribution.

The user may also optionally choose to have the cumulative probability distribution (cpd) generated rather than the normal histogram. In this case, the value assigned to each bin represents the cumulative probability. This is a very useful function for comparing the statistical distributions of multiple images.

NoData values in the input image are ignored during the generation of the histogram or cpd.

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
inputFile = wd + "input.dep"
binSize = "10.0"
startBin = "0.0"
endBin = "not specified"
cumulative = "false"
args = [inputFile, binSize, startBin, endBin, cumulative]
pluginHost.runPlugin("Histogram", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "input.dep"
def binSize = "10.0"
def startBin = "0.0"
def endBin = "100.0"
def cumulative = "true"
String[] args = [inputFile, binSize, startBin, endBin, cumulative]
pluginHost.runPlugin("Histogram", args, false)

Credits: