Skip to content

Commit 035c308

Browse files
committed
AverageAffineTransform cleanup.
1 parent e51dc98 commit 035c308

File tree

2 files changed

+16
-57
lines changed

2 files changed

+16
-57
lines changed
Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
"""
2+
Change directory to provide relative paths for doctests
3+
>>> import os
4+
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
5+
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
6+
>>> os.chdir(datadir)
7+
8+
"""
19
# Standard library imports
210
import os
311

412
# Local imports
5-
from ..base import (TraitedSpec, File, traits, InputMultiPath, OutputMultiPath, isdefined)
6-
from ...utils.filemanip import split_filename
13+
from ..base import TraitedSpec, File, traits, InputMultiPath
714
from .base import ANTSCommand, ANTSCommandInputSpec
815

916
class AverageAffineTransformInputSpec(ANTSCommandInputSpec):
@@ -18,7 +25,13 @@ class AverageAffineTransform(ANTSCommand):
1825
"""
1926
Examples
2027
--------
21-
>>>
28+
>>> from nipype.interfaces.ants.AverageAffineTransform import AverageAffineTransform
29+
>>> avg = AverageAffineTransform()
30+
>>> avg.inputs.dimension = 3
31+
>>> avg.inputs.transforms = ['trans.mat', 'func_to_struct.mat']
32+
>>> avg.inputs.output_affine_transform = 'MYtemplatewarp.mat'
33+
>>> avg.cmdline
34+
'AverageAffineTransform 3 MYtemplatewarp.mat trans.mat func_to_struct.mat'
2235
"""
2336
_cmd = 'AverageAffineTransform'
2437
input_spec = AverageAffineTransformInputSpec
@@ -31,32 +44,3 @@ def _list_outputs(self):
3144
outputs = self._outputs().get()
3245
outputs['affine_transform'] = os.path.abspath(self.inputs.output_affine_transform)
3346
return outputs
34-
35-
"""
36-
Usage:
37-
38-
AverageAffineTransform ImageDimension output_affine_transform [-R reference_affine_transform] {[-i] affine_transform_txt [weight(=1)] ]}
39-
40-
Compute weighted average of input affine transforms.
41-
For 2D and 3D transform, the affine transform is first decomposed into scale x shearing
42-
x rotation. Then these parameters are averaged, using the weights if they provided. For
43-
3D transform, the rotation component is the quaternion. After averaging, the quaternion
44-
will also be normalized to have unit norm. For 2D transform, the rotation component is
45-
the rotation angle. The weight for each transform is a non-negative number. The sum of
46-
all weights will be normalized to 1 before averaging. The default value for each weight
47-
is 1.0.
48-
49-
All affine transforms is a "centerd" transform, following ITK convention. A
50-
reference_affine_transform defines the center for the output transform. The first provided
51-
transform is the default reference transform
52-
53-
Output affine transform is a MatrixOffsetBaseTransform.
54-
55-
-i option takes the inverse of the affine mapping.
56-
57-
For example:
58-
59-
2 output_affine.txt -R A.txt A1.txt 1.0 -i A2.txt 2.0 A3.txt A4.txt 6.0 A5.txt
60-
61-
This computes: (1*A1 + 2*(A2)^-1 + A3 + A4*6 + A5 ) / (1+2+1+6+5)
62-
"""

nipype/interfaces/ants/tests/test_AverageAffineTransform.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)