Skip to content

Commit d240443

Browse files
committed
Rigid registration node tested and works
1 parent af96a0b commit d240443

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

nipype/interfaces/dtitk/registration.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ class RigidInputSpec(CommandLineInputSpec):
1414
similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True,
1515
mandatory=True, position=2, argstr="%s",
1616
desc="similarity metric")
17+
samplingX = traits.Float(mandatory=True, position=3, argstr="%s",
18+
desc="dist between samp points (mm)",
19+
default_value=4)
20+
samplingY = traits.Float(mandatory=True, position=4, argstr="%s",
21+
desc="dist between samp points (mm)",
22+
default_value=4)
23+
samplingZ = traits.Float(mandatory=True, position=5, argstr="%s",
24+
desc="dist between samp points (mm)",
25+
default_value=4)
26+
ftol = traits.Float(mandatory=True, position=6, argstr="%s",
27+
desc="cost function tolerance", default_value=0.01)
28+
useInTrans = traits.Float(mandatory=False, position=7, argstr="%s",
29+
desc="to initialize with existing xfm set as 1",
30+
default_value=1)
1731

1832

1933
class RigidOutputSpec(TraitedSpec):
@@ -33,23 +47,30 @@ class RigidTask(CommandLineDtitk):
3347
>>> node.inputs.fixed_file = 'diffusion.nii'
3448
>>> node.inputs.moving_file = 'diffusion.nii'
3549
>>> node.inputs.similarity_metric = 'EDS'
50+
>>> node.inputs.samplingX = 4
51+
>>> node.inputs.samplingY = 4
52+
>>> node.inputs.samplingZ = 4
53+
>>> node.inputs.ftol = 0.01
54+
>>> node.inputs.useInTrans = 1
3655
>>> node.run() # doctest: +SKIP
3756
"""
3857
input_spec = RigidInputSpec
3958
output_spec = RigidOutputSpec
40-
_cmd = 'dti_rigid_sn'
59+
_cmd = 'dti_rigid_reg'
4160

4261
def _gen_outfilename(self):
43-
out_file = self.inputs.out_file
44-
if not isdefined(out_file) and isdefined(self.inputs.in_file):
45-
out_file = self._gen_fname(self.inputs.in_file,
46-
suffix='.aff', change_ext=False)
62+
# out_file = self.inputs.out_file
63+
# if not isdefined(out_file) and isdefined(self.inputs.in_file):
64+
out_file = self._gen_fname(self.inputs.in_file,
65+
suffix='.aff', change_ext=False)
66+
return out_file
4767

4868
def _list_outputs(self):
4969
outputs = self.output_spec().get()
50-
outputs['out_file_xfm'] = self._gen_outfilename()
51-
outputs['out_file'] = self.inputs.in_file.replace('.nii.gz',
52-
'_aff.nii.gz')
70+
outputs['out_file_xfm'] = self.inputs.moving_file.replace('.nii.gz',
71+
'.aff')
72+
outputs['out_file'] = self.inputs.moving_file.replace('.nii.gz',
73+
'_aff.nii.gz')
5374
return outputs
5475

5576
def _gen_fname(self, name):

0 commit comments

Comments
 (0)