# The ImageStat Module

This module calculates global statistics for an image, or a region of an image.

## Functions

### Stat (class)

`Stat(image [,mask])`. Calculates statistics for the give image. If a mask is included, only the regions covered by that mask are included in the statistics.

`Stat(list)`. Same, but calculates statistics for a previously calculated histogram.

## Attributes

The following attributes contain a sequence with one element for each layer in the image. All attributes are lazily evaluated; if you don't need a value, it won't be calculated.

### extrema

`extrema` (attribute). Get min/max values for each band in the image.

### count

`count` (attribute). Get total number of pixels.

### sum

`sum` (attribute). Get sum of all pixels.

### sum2

`sum2` (attribute). Squared sum of all pixels.

### mean

`mean` (attribute). Average pixel level.

### median

`median` (attribute). Median pixel level.

### rms

`rms` (attribute). RMS (root-mean-square).

### var

`var` (attribute). Variance.

### stddev

`stddev` (attribute). Standard deviation.