Skip to content

Commit 898db0c

Browse files
committed
made files save to node working directories
1 parent 5df307c commit 898db0c

File tree

5 files changed

+40
-23
lines changed

5 files changed

+40
-23
lines changed

nipype/interfaces/dtitk/registration.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
class RigidInputSpec(CommandLineInputSpec):
3636
fixed_file = File(desc="fixed tensor volume", exists=True,
37-
mandatory=True, position=0, argstr="%s")
37+
mandatory=True, position=0, argstr="%s", copyfile=False)
3838
moving_file = File(desc="moving tensor volume", exists=True,
3939
mandatory=True, position=1, argstr="%s", copyfile=False)
4040
similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI',
@@ -46,8 +46,13 @@ class RigidInputSpec(CommandLineInputSpec):
4646
ftol = traits.Float(mandatory=True, position=4, argstr="%g",
4747
desc="cost function tolerance", default_value=0.01,
4848
usedefault=True)
49-
use_in_trans = traits.Bool(position=5, argstr="1",
50-
desc="initialize with existing transform")
49+
# use_in_trans = traits.Bool(position=5, argstr="1",
50+
# desc="initialize with existing transform")
51+
initialize_xfm = File(desc="DTITK-FORMAT transform ",
52+
copyfile=False, position=5, argstr="%s")
53+
# need to enforce DTITK format or it's a silent failure
54+
# (can we search the stderr for keywords to error if not found?)
55+
# stderr: filename.aff doesn't exist or can't be opened
5156

5257

5358
class RigidOutputSpec(TraitedSpec):
@@ -68,15 +73,19 @@ class Rigid(CommandLineDtitk):
6873
>>> node.inputs.similarity_metric = 'EDS'
6974
>>> node.inputs.sampling_xyz = (4,4,4)
7075
>>> node.inputs.ftol = 0.01
71-
>>> node.inputs.use_in_trans = True
7276
>>> node.cmdline
73-
'dti_rigid_reg im1.nii im2.nii EDS 4 4 4 0.01 1'
77+
'dti_rigid_reg im1.nii im2.nii EDS 4 4 4 0.01'
7478
>>> node.run() # doctest: +SKIP
7579
"""
7680
input_spec = RigidInputSpec
7781
output_spec = RigidOutputSpec
7882
_cmd = 'dti_rigid_reg'
7983

84+
'''def _format_arg(self, name, spec, value):
85+
if name == 'initialize_xfm':
86+
value = 1
87+
return super(Rigid, self)._format_arg(name, spec, value)'''
88+
8089
def _list_outputs(self):
8190
outputs = self.output_spec().get()
8291
moving = self.inputs.moving_file
@@ -99,9 +108,9 @@ class Affine(Rigid):
99108
>>> node.inputs.similarity_metric = 'EDS'
100109
>>> node.inputs.sampling_xyz = (4,4,4)
101110
>>> node.inputs.ftol = 0.01
102-
>>> node.inputs.use_in_trans = True
111+
>>> node.inputs.initialize_xfm = 'im_affine.aff'
103112
>>> node.cmdline
104-
'dti_affine_reg im1.nii im2.nii EDS 4 4 4 0.01 1'
113+
'dti_affine_reg im1.nii im2.nii EDS 4 4 4 0.01 im_affine.aff'
105114
>>> node.run() # doctest: +SKIP
106115
"""
107116
_cmd = 'dti_affine_reg'

nipype/interfaces/dtitk/tests/test_auto_Affine.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def test_Affine_inputs():
1212
),
1313
fixed_file=dict(
1414
argstr='%s',
15+
copyfile=False,
1516
mandatory=True,
1617
position=0,
1718
),
@@ -26,6 +27,11 @@ def test_Affine_inputs():
2627
nohash=True,
2728
usedefault=True,
2829
),
30+
initialize_xfm=dict(
31+
argstr='%s',
32+
copyfile=False,
33+
position=5,
34+
),
2935
moving_file=dict(
3036
argstr='%s',
3137
copyfile=False,
@@ -48,10 +54,6 @@ def test_Affine_inputs():
4854
deprecated='1.0.0',
4955
nohash=True,
5056
),
51-
use_in_trans=dict(
52-
argstr='1',
53-
position=5,
54-
),
5557
)
5658
inputs = Affine.input_spec()
5759

nipype/interfaces/dtitk/tests/test_auto_AffineTask.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def test_AffineTask_inputs():
1212
),
1313
fixed_file=dict(
1414
argstr='%s',
15+
copyfile=False,
1516
mandatory=True,
1617
position=0,
1718
),
@@ -26,6 +27,11 @@ def test_AffineTask_inputs():
2627
nohash=True,
2728
usedefault=True,
2829
),
30+
initialize_xfm=dict(
31+
argstr='%s',
32+
copyfile=False,
33+
position=5,
34+
),
2935
moving_file=dict(
3036
argstr='%s',
3137
copyfile=False,
@@ -48,10 +54,6 @@ def test_AffineTask_inputs():
4854
deprecated='1.0.0',
4955
nohash=True,
5056
),
51-
use_in_trans=dict(
52-
argstr='1',
53-
position=5,
54-
),
5557
)
5658
inputs = AffineTask.input_spec()
5759

nipype/interfaces/dtitk/tests/test_auto_Rigid.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def test_Rigid_inputs():
1212
),
1313
fixed_file=dict(
1414
argstr='%s',
15+
copyfile=False,
1516
mandatory=True,
1617
position=0,
1718
),
@@ -26,6 +27,11 @@ def test_Rigid_inputs():
2627
nohash=True,
2728
usedefault=True,
2829
),
30+
initialize_xfm=dict(
31+
argstr='%s',
32+
copyfile=False,
33+
position=5,
34+
),
2935
moving_file=dict(
3036
argstr='%s',
3137
copyfile=False,
@@ -48,10 +54,6 @@ def test_Rigid_inputs():
4854
deprecated='1.0.0',
4955
nohash=True,
5056
),
51-
use_in_trans=dict(
52-
argstr='1',
53-
position=5,
54-
),
5557
)
5658
inputs = Rigid.input_spec()
5759

nipype/interfaces/dtitk/tests/test_auto_RigidTask.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def test_RigidTask_inputs():
1212
),
1313
fixed_file=dict(
1414
argstr='%s',
15+
copyfile=False,
1516
mandatory=True,
1617
position=0,
1718
),
@@ -26,6 +27,11 @@ def test_RigidTask_inputs():
2627
nohash=True,
2728
usedefault=True,
2829
),
30+
initialize_xfm=dict(
31+
argstr='%s',
32+
copyfile=False,
33+
position=5,
34+
),
2935
moving_file=dict(
3036
argstr='%s',
3137
copyfile=False,
@@ -48,10 +54,6 @@ def test_RigidTask_inputs():
4854
deprecated='1.0.0',
4955
nohash=True,
5056
),
51-
use_in_trans=dict(
52-
argstr='1',
53-
position=5,
54-
),
5557
)
5658
inputs = RigidTask.input_spec()
5759

0 commit comments

Comments
 (0)