Skip to content

Commit ff4d855

Browse files
committed
wrapped ANTs function CreateJacobianDeterminantImage
1 parent c4c724b commit ff4d855

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

nipype/interfaces/ants/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
from .visualization import ConvertScalarImageToRGB, CreateTiledMosaic
2020

2121
# Utility Programs
22-
from .utils import AverageAffineTransform, AverageImages, MultiplyImages, JacobianDeterminant
22+
from .utils import AverageAffineTransform, AverageImages, MultiplyImages, JacobianDeterminant, CreateJacobianDeterminantImage

nipype/interfaces/ants/utils.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,46 @@ def _list_outputs(self):
199199
outputs['jacobian_image'] = os.path.abspath(
200200
self._gen_filename('output_prefix') + 'jacobian.nii.gz')
201201
return outputs
202+
203+
204+
class CreateJacobianDeterminantImageInputSpec(ANTSCommandInputSpec):
205+
imageDimension = traits.Enum(3, 2, argstr='%d', usedefault=False, mandatory=True,
206+
position=0, desc='image dimension (2 or 3)')
207+
deformationField = File(argstr='%s', exists=True, mandatory=True,
208+
position=1, desc='deformation transformation file')
209+
outputImage = File(argstr='%s', mandatory=True,
210+
position=2,
211+
desc='output filename')
212+
doLogJacobian = traits.Enum(0, 1, argstr='%d', mandatory=False, position=3,
213+
desc='return the log jacobian')
214+
useGeometric = traits.Enum(0, 1, argstr='%d', mandatory=False, position=4,
215+
desc='return the geometric jacobian')
216+
217+
class CreateJacobianDeterminantImageOutputSpec(TraitedSpec):
218+
jacobian_image = File(exists=True, desc='jacobian image')
219+
220+
class CreateJacobianDeterminantImage(ANTSCommand):
221+
"""
222+
Examples
223+
--------
224+
>>> from nipype.interfaces.ants import CreateJacobianDeterminantImage
225+
>>> jacobian = CreateJacobianDeterminantImage()
226+
>>> jacobian.inputs.imageDimension = 3
227+
>>> jacobian.inputs.warp_file = 'ants_Warp.nii.gz'
228+
>>> jacobian.inputs.outputImage = 'out_name.nii.gz'
229+
>>> jacobian.cmdline # doctest: +IGNORE_UNICODE
230+
'CreateJacobianDeterminantImage 3 ants_Warp.nii.gz out_name.nii.gz'
231+
"""
232+
233+
_cmd = 'CreateJacobianDeterminantImage'
234+
input_spec = CreateJacobianDeterminantImageInputSpec
235+
output_spec = CreateJacobianDeterminantImageOutputSpec
236+
237+
def _format_arg(self, opt, spec, val):
238+
return super(CreateJacobianDeterminantImage, self)._format_arg(opt, spec, val)
239+
240+
def _list_outputs(self):
241+
outputs = self._outputs().get()
242+
outputs['jacobian_image'] = os.path.abspath(
243+
self.inputs.outputImage)
244+
return outputs

0 commit comments

Comments
 (0)