# average-images¶

## Synopsis¶

average-images <output> -images <images.lst> [options]
average-images <output> -image <image1> [<w1>] [-dof <dof1>...] -image <image2> [<w2>] [-dof <dof2>...]... [options]
average-images <output> <image1> [<dof1>...] <image2> [<dof2>...]... [options]
average-images <output> <sequence> [options]


## Description¶

Computes voxel-wise average image of the given (transformed) input images.

The input images are optionally transformed by one or more image-to-average space transformation (average-images -dof) or its inverse (average-images -dof_i), respectively. When more than one transformation is given, these are concatenated via funtion composition.

## Arguments¶

output

Voxel-wise average image. When the -label is used multiple times, a unique file path is created for each fuzzy output segmentation.

## Input options¶

-image <file> [<w>]

A single input image.

-images <file>

Text file with N lines containing the file name of each input image, optionally a transformation file name (see -dof and -dof_i), followed by an optional weight for a weighted output average (default weight is 1). The first line of the text file must specify the common base directory of all relative image and transformation file paths occurring on the subsequent N lines. A path starting with ‘./’ must be relative to the directory containing the input text file itself. Each transformation file path may be prefixed with ‘inv:’ or ‘dof:’ to indicate whether the inverse of the given transformation file maps points from the image world space to the common average world space or not. When omitted from a file path, ‘dof:’ is implied, i.e., the transformation is assumed to map points from input image to average image world space (see -dof).

-delim, -delimiter <c>

Delimiter used in -images file. (default: ‘,’ for .csv, ‘t’ for .tsv, and ‘ ‘ otherwise)

-invert

Invert transformations specified in -images file.

-dof <file>

Specifies a transformation to be applied to the preceeding image. (default: none)

-dof_i <file>

Specifies a transformation whose inverse is to be applied to the preceeding image similar to -dof. (default: none)

## Command options¶

-reference, -target <file>|max-size|max-space|average

When <file> name specified, use the attributes of this reference image for average image. When “max-size” is specified, the input image with the most number of voxels is used as reference, whereas “max-space” selects the image which occupies the largest amount world space. By default, an “average” voxel size and image orientation is computed from the input images and the image size adjusted such that the image bounding boxes of all (affinely transformed) input images are contained within the average image space. (default: average)

-voxel-size, -spacing, -size <dx> [<dy> [<dz>]]

Voxel size of intensity average image. (default: -reference)

-padding <value>

Input padding and output background value. No input padding if not specified. Output background value zero by default or minimum average intensity minus 1. (default: 0)

-threshold <value>

Replace average value by -padding value when cumulative normalized weight is below the specified threshold in [0, 1). (default: 0)

-normalize, -normalization <mode>

Input intensity normalization:

• none: Use input intensities unmodified. (default)
• mean: Divide by mean foreground value.
• median: Divide by median foreground value.
• z-score: Subtract mean and divide by standard deviation.
• unit: Rescale input intensities to [0, 1].
• dist: Rescale input intensities to average mean and standard deviation of input images.
-rescale, -rescaling <mode>|<min> <max>

Linear rescaling of average intensity values:

• none: No rescaling of averaged intensities. (default)
• unit: Rescale average intensities to [0, 1].
• dist: Rescale average intensities to average mean and standard deviation of input images.
• <min> <max>: Rescale average intensities to specified output range.
-margin <n>

Crop/pad average image and ensure a margin of <n> voxels at each boundary. (default: -1/off)

-interpolation, -interp <mode>

Interpolation mode, e.g., NN, Linear, BSpline, Cubic, Sinc. (default: Linear)

-label, -labels [<path>|<value>|<from>..<to>...]

Segmentation label(s) of which to create an average probability map. When multiple labels are given, the corresponding segments are merged. This option can be given multiple times to create more than one average image for each segment. When only one <output> file name is given, it is modified to include the index of the segment corresponding to the order of the -label(s) options. Otherwise, specify a different output <path> as argument. A suffix corresponding to the respective label is appended to the output file path before the file name extension. When no argument is given the <output> path is used.

-datatype, -dtype, -type char|uchar|short|float|double

Data type of output image. The intermediate average image always has floating point data type. When this option is given, this average is cast to the respective output type before writing the result to the output image file. (default: float)

## Standard options¶

-v, -verbose [n]

Increase/Set verbosity of output messages. (default: 0)

-debug [level]

Increase/Set debug level for output of intermediate results. (default: 0)

-version [major.minor]

Print version and exit or set version to emulate.

-revision

Print revision (or version) number only and exit.

-h, -help

Print help and exit.

## Terminal options¶

-color, -nocolor

Enable/disable colored output. (default: off)

## Parallelization options¶

-threads <n>

Use maximal <n> threads for parallel execution. (default: automatic)