AverageAffineTransform - part of ANTS registration suite

AverageAffineTransform ImageDimension output_affine_transform [-R
reference_affine_transform] {[-i] affine_transform_txt [weight(=1)] ]}

- Usage: Compute weighted average of input affine
transforms.

For 2D and 3D transform, the affine transform is first decomposed into scale x
shearing x rotation. Then these parameters are averaged, using the weights if
they provided. For 3D transform, the rotation component is the quaternion.
After averaging, the quaternion will also be normalized to have unit norm. For
2D transform, the rotation component is the rotation angle. The weight for
each transform is a non-negative number. The sum of all weights will be
normalized to 1 before averaging. The default value for each weight is 1.0.

All affine transforms is a "centerd" transform, following ITK
convention. A reference_affine_transform defines the center for the output
transform. The first provided transform is the default reference transform
Output affine transform is a MatrixOffsetBaseTransform.

**-i**
option takes the inverse of the affine mapping.

- For example: 2 output_affine.txt
**-R** A.txt A1.txt 1.0
**-i** A2.txt 2.0 A3.txt A4.txt 6.0 A5.txt

This computes: (1*A1 + 2*(A2)^-1 + A3 + A4*6 + A5 ) / (1+2+1+6+5)