Skip to content

Commit 7c41d5d

Browse files
committed
fixed composeXfm naming; added tests for old interface names
1 parent cae974e commit 7c41d5d

16 files changed

+936
-6
lines changed

nipype/interfaces/dtitk/registration.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"""
2626

2727
from ..base import TraitedSpec, CommandLineInputSpec, traits, File, isdefined
28-
from ...utils.filemanip import fname_presuffix
28+
from ...utils.filemanip import fname_presuffix, split_filename
2929
from .base import CommandLineDtitk, DTITKRenameMixin
3030
import os
3131

@@ -166,8 +166,6 @@ class ComposeXfmInputSpec(CommandLineInputSpec):
166166
argstr="-aff %s", mandatory=True)
167167
out_file = File(desc='output path',
168168
argstr="-out %s", genfile=True)
169-
# keep_extension is keeping the .df but not .nii
170-
# need to fix when PR 2506 is done
171169

172170

173171
class ComposeXfmOutputSpec(TraitedSpec):
@@ -205,9 +203,12 @@ def _list_outputs(self):
205203
def _gen_filename(self, name):
206204
if name != 'out_file':
207205
return
208-
return fname_presuffix(os.path.basename(
209-
self.inputs.in_df).split('.')[0],
210-
suffix='_affdf.df.nii')
206+
path, base, ext = split_filename(self.inputs.in_df)
207+
suffix = '_affdf'
208+
if base.endswith('.df'):
209+
suffix += '.df'
210+
base = base[:-3]
211+
return fname_presuffix(base, suffix=suffix + ext, use_ext=False)
211212

212213

213214
class AffSymTensor3DVolInputSpec(CommandLineInputSpec):
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from __future__ import unicode_literals
3+
from ..registration import AffineTask
4+
5+
6+
def test_AffineTask_inputs():
7+
input_map = dict(
8+
args=dict(argstr='%s', ),
9+
environ=dict(
10+
nohash=True,
11+
usedefault=True,
12+
),
13+
fixed_file=dict(
14+
argstr='%s',
15+
mandatory=True,
16+
position=0,
17+
),
18+
ftol=dict(
19+
argstr='%g',
20+
mandatory=True,
21+
position=4,
22+
usedefault=True,
23+
),
24+
ignore_exception=dict(
25+
deprecated='1.0.0',
26+
nohash=True,
27+
usedefault=True,
28+
),
29+
moving_file=dict(
30+
argstr='%s',
31+
copyfile=False,
32+
mandatory=True,
33+
position=1,
34+
),
35+
sampling_xyz=dict(
36+
argstr='%g %g %g',
37+
mandatory=True,
38+
position=3,
39+
usedefault=True,
40+
),
41+
similarity_metric=dict(
42+
argstr='%s',
43+
mandatory=True,
44+
position=2,
45+
usedefault=True,
46+
),
47+
terminal_output=dict(
48+
deprecated='1.0.0',
49+
nohash=True,
50+
),
51+
use_in_trans=dict(
52+
argstr='1',
53+
position=5,
54+
),
55+
)
56+
inputs = AffineTask.input_spec()
57+
58+
for key, metadata in list(input_map.items()):
59+
for metakey, value in list(metadata.items()):
60+
assert getattr(inputs.traits()[key], metakey) == value
61+
def test_AffineTask_outputs():
62+
output_map = dict(
63+
out_file=dict(),
64+
out_file_xfm=dict(),
65+
)
66+
outputs = AffineTask.output_spec()
67+
68+
for key, metadata in list(output_map.items()):
69+
for metakey, value in list(metadata.items()):
70+
assert getattr(outputs.traits()[key], metakey) == value
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from __future__ import unicode_literals
3+
from ..utils import BinThreshTASK
4+
5+
6+
def test_BinThreshTASK_inputs():
7+
input_map = dict(
8+
args=dict(argstr='%s', ),
9+
environ=dict(
10+
nohash=True,
11+
usedefault=True,
12+
),
13+
ignore_exception=dict(
14+
deprecated='1.0.0',
15+
nohash=True,
16+
usedefault=True,
17+
),
18+
in_file=dict(
19+
argstr='%s',
20+
mandatory=True,
21+
position=0,
22+
),
23+
inside_value=dict(
24+
argstr='%g',
25+
mandatory=True,
26+
position=4,
27+
usedefault=True,
28+
),
29+
lower_bound=dict(
30+
argstr='%g',
31+
mandatory=True,
32+
position=2,
33+
),
34+
out_file=dict(
35+
argstr='%s',
36+
keep_extension=True,
37+
name_source='in_file',
38+
name_template='%s_thrbin',
39+
position=1,
40+
),
41+
outside_value=dict(
42+
argstr='%g',
43+
mandatory=True,
44+
position=5,
45+
usedefault=True,
46+
),
47+
terminal_output=dict(
48+
deprecated='1.0.0',
49+
nohash=True,
50+
),
51+
upper_bound=dict(
52+
argstr='%g',
53+
mandatory=True,
54+
position=3,
55+
),
56+
)
57+
inputs = BinThreshTASK.input_spec()
58+
59+
for key, metadata in list(input_map.items()):
60+
for metakey, value in list(metadata.items()):
61+
assert getattr(inputs.traits()[key], metakey) == value
62+
def test_BinThreshTASK_outputs():
63+
output_map = dict(out_file=dict(), )
64+
outputs = BinThreshTASK.output_spec()
65+
66+
for key, metadata in list(output_map.items()):
67+
for metakey, value in list(metadata.items()):
68+
assert getattr(outputs.traits()[key], metakey) == value
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from __future__ import unicode_literals
3+
from ..registration import ComposeXfmTask
4+
5+
6+
def test_ComposeXfmTask_inputs():
7+
input_map = dict(
8+
args=dict(argstr='%s', ),
9+
environ=dict(
10+
nohash=True,
11+
usedefault=True,
12+
),
13+
ignore_exception=dict(
14+
deprecated='1.0.0',
15+
nohash=True,
16+
usedefault=True,
17+
),
18+
in_aff=dict(
19+
argstr='-aff %s',
20+
mandatory=True,
21+
),
22+
in_df=dict(
23+
argstr='-df %s',
24+
copyfile=False,
25+
mandatory=True,
26+
),
27+
out_file=dict(
28+
argstr='-out %s',
29+
genfile=True,
30+
),
31+
terminal_output=dict(
32+
deprecated='1.0.0',
33+
nohash=True,
34+
),
35+
)
36+
inputs = ComposeXfmTask.input_spec()
37+
38+
for key, metadata in list(input_map.items()):
39+
for metakey, value in list(metadata.items()):
40+
assert getattr(inputs.traits()[key], metakey) == value
41+
def test_ComposeXfmTask_outputs():
42+
output_map = dict(out_file=dict(), )
43+
outputs = ComposeXfmTask.output_spec()
44+
45+
for key, metadata in list(output_map.items()):
46+
for metakey, value in list(metadata.items()):
47+
assert getattr(outputs.traits()[key], metakey) == value
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from __future__ import unicode_literals
3+
from ..registration import DiffeoTask
4+
5+
6+
def test_DiffeoTask_inputs():
7+
input_map = dict(
8+
args=dict(argstr='%s', ),
9+
environ=dict(
10+
nohash=True,
11+
usedefault=True,
12+
),
13+
fixed_file=dict(
14+
argstr='%s',
15+
position=0,
16+
),
17+
ftol=dict(
18+
argstr='%g',
19+
mandatory=True,
20+
position=5,
21+
usedefault=True,
22+
),
23+
ignore_exception=dict(
24+
deprecated='1.0.0',
25+
nohash=True,
26+
usedefault=True,
27+
),
28+
legacy=dict(
29+
argstr='%d',
30+
mandatory=True,
31+
position=3,
32+
usedefault=True,
33+
),
34+
mask_file=dict(
35+
argstr='%s',
36+
position=2,
37+
),
38+
moving_file=dict(
39+
argstr='%s',
40+
copyfile=False,
41+
position=1,
42+
),
43+
n_iters=dict(
44+
argstr='%d',
45+
mandatory=True,
46+
position=4,
47+
usedefault=True,
48+
),
49+
terminal_output=dict(
50+
deprecated='1.0.0',
51+
nohash=True,
52+
),
53+
)
54+
inputs = DiffeoTask.input_spec()
55+
56+
for key, metadata in list(input_map.items()):
57+
for metakey, value in list(metadata.items()):
58+
assert getattr(inputs.traits()[key], metakey) == value
59+
def test_DiffeoTask_outputs():
60+
output_map = dict(
61+
out_file=dict(),
62+
out_file_xfm=dict(),
63+
)
64+
outputs = DiffeoTask.output_spec()
65+
66+
for key, metadata in list(output_map.items()):
67+
for metakey, value in list(metadata.items()):
68+
assert getattr(outputs.traits()[key], metakey) == value
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from __future__ import unicode_literals
3+
from ..registration import RigidTask
4+
5+
6+
def test_RigidTask_inputs():
7+
input_map = dict(
8+
args=dict(argstr='%s', ),
9+
environ=dict(
10+
nohash=True,
11+
usedefault=True,
12+
),
13+
fixed_file=dict(
14+
argstr='%s',
15+
mandatory=True,
16+
position=0,
17+
),
18+
ftol=dict(
19+
argstr='%g',
20+
mandatory=True,
21+
position=4,
22+
usedefault=True,
23+
),
24+
ignore_exception=dict(
25+
deprecated='1.0.0',
26+
nohash=True,
27+
usedefault=True,
28+
),
29+
moving_file=dict(
30+
argstr='%s',
31+
copyfile=False,
32+
mandatory=True,
33+
position=1,
34+
),
35+
sampling_xyz=dict(
36+
argstr='%g %g %g',
37+
mandatory=True,
38+
position=3,
39+
usedefault=True,
40+
),
41+
similarity_metric=dict(
42+
argstr='%s',
43+
mandatory=True,
44+
position=2,
45+
usedefault=True,
46+
),
47+
terminal_output=dict(
48+
deprecated='1.0.0',
49+
nohash=True,
50+
),
51+
use_in_trans=dict(
52+
argstr='1',
53+
position=5,
54+
),
55+
)
56+
inputs = RigidTask.input_spec()
57+
58+
for key, metadata in list(input_map.items()):
59+
for metakey, value in list(metadata.items()):
60+
assert getattr(inputs.traits()[key], metakey) == value
61+
def test_RigidTask_outputs():
62+
output_map = dict(
63+
out_file=dict(),
64+
out_file_xfm=dict(),
65+
)
66+
outputs = RigidTask.output_spec()
67+
68+
for key, metadata in list(output_map.items()):
69+
for metakey, value in list(metadata.items()):
70+
assert getattr(outputs.traits()[key], metakey) == value

0 commit comments

Comments
 (0)