Name

avgvar - Calculates average and variance for an image series.

Usage

Calculate average and variance of image stack without using current alignment parameters:

Calculate average and variance of image stack using current alignment parameters:

Calculate average and variance of only the even numbered images without using current alignment parameters:

Calculate average and variance of only the odd numbered images between images 3 and 57, inclusive, using current alignment parameters:

Input

data
image stack, can be 2D or 3D, must be in real space
mode
whether to apply alignment parameters. Default mode='a' means apply parameters
ali_params
name of the attribute alignment parameters are stored under in image headers
rot_method
specifies the function by which images are rotated/shifted if alignment parameters are to be applied. This is only relevant for the case where images are 2D, in which case rot_method can be either rot_shift2D or rotshift2dg, with the default being rot_shift2D. If images are 3D, rot_shift3D will be used to rotate/shift the images.
interp
interpolation method to use for rot_method when applying alignment parameters.
i1
index of first image to be used.
i2
index of last image to be used. If i2 = 0, then i2 defaults to one less than number of images in the data
use_odd
images with indices between i1 and i2 which are odd are used if and only if use_odd is set to True. Default is True.
use_even
images with indices between i1 and i2 which are even are used if and only if use_even is set to True. Default is True.

Output

ave
the average of the image series in real space
var
the variance of the image series in real space

Description

The output average is calculated as the sum of the images divided by the number of images used in the calculation (as determined by i1, i2, use_even and use_odd). If mode='a', the average is calculated from the images after alignment parameters have been applied.

The variance is calculated as: ` (sum_i O_i^2 - ave*ave*n)/(n-1) `, where the sum ranges over all images used in the calculations, n is the number of images used in the calculations, and O_i denotes the i-th image.

Author / Maintainer

Jia Fang

Keywords

category 1
UTILITIES

Files

statistics.py

See also

mad_scalar, mul_scalar, add_img2, sub_img, mul_img

Maturity

Bugs

avgvar (last edited 2013-07-01 13:12:49 by localhost)