Skip to content

Commit b3eb47b

Browse files
committed
Some advances to implement all the interfaces
1 parent 38b2e6f commit b3eb47b

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

nipype/interfaces/elastix/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# @Author: oesteban - [email protected]
77
# @Date: 2014-06-02 12:06:07
88
# @Last Modified by: oesteban
9-
# @Last Modified time: 2014-06-03 14:06:18
9+
# @Last Modified time: 2014-06-03 15:21:55
1010
"""Top-level namespace for elastix."""
1111

12-
from registration import Registration, ApplyWarp
12+
from registration import Registration, ApplyWarp, AnalyzeWarp

nipype/interfaces/elastix/registration.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# @Author: oesteban - [email protected]
77
# @Date: 2014-06-02 12:06:50
88
# @Last Modified by: oesteban
9-
# @Last Modified time: 2014-06-03 14:17:08
9+
# @Last Modified time: 2014-06-03 15:30:38
1010
"""The :py:mod:`nipype.interfaces.elastix` provides the interface to
1111
the elastix registration software.
1212
@@ -162,6 +162,43 @@ class ApplyWarp(CommandLine):
162162
def _list_outputs(self):
163163
outputs = self._outputs().get()
164164
out_dir = op.abspath(self.inputs.output_path)
165-
outputs['out_file'] = op.join(out_dir,'result.nii.gz')
165+
outputs['warped_file'] = op.join(out_dir,'result.nii.gz')
166166
return outputs
167167

168+
169+
class AnalyzeWarpInputSpec(ElastixBaseInputSpec):
170+
transform_file = File(exists=True, mandatory=True, argstr='-tp %s',
171+
desc='transform-parameter file, only 1')
172+
173+
174+
class AnalyzeWarpOutputSpec(TraitedSpec):
175+
disp_field = File(exists=True, desc='displacements field')
176+
jacdet_map = File(exists=True, desc='det(Jacobian) map')
177+
jacmat_map = File(exists=True, desc='Jacobian matrix map')
178+
179+
class AnalyzeWarp(CommandLine):
180+
"""Use `transformix` to get details from the input transform (generate
181+
the corresponding deformation field, generate the determinant of the
182+
Jacobian map or the Jacobian map itself)
183+
184+
Example::
185+
186+
>>> from nipype.interfaces.elastix import ApplyWarp
187+
>>> reg = ApplyWarp()
188+
>>> reg.inputs.moving_image = 'moving1.nii'
189+
>>> reg.inputs.transform_file = 'TransformParameters.0.txt'
190+
>>> reg.cmdline
191+
'transformix -def all -jac all -jacmat all -out ./ -tp TransformParameters.0.txt'
192+
"""
193+
194+
_cmd = 'transformix -def all -jac all -jacmat all'
195+
input_spec = AnalyzeWarpInputSpec
196+
output_spec = AnalyzeWarpOutputSpec
197+
198+
def _list_outputs(self):
199+
outputs = self._outputs().get()
200+
out_dir = op.abspath(self.inputs.output_path)
201+
outputs['disp_field'] = op.join(out_dir,'deformationField.nii.gz')
202+
outputs['jacdet_map'] = op.join(out_dir,'spatialJacobian.nii.gz')
203+
outputs['jacmat_map'] = op.join(out_dir,'fullSpatialJacobian.nii.gz')
204+
return outputs

0 commit comments

Comments
 (0)