Repository: nipy/nipype

Issue:
NiftyReg's RegTools is missing interpolation order argument

Discussion:

Patch:
diff --git a/.zenodo.json b/.zenodo.json
index 1058e3b15..29e7f047a 100644
--- a/.zenodo.json
+++ b/.zenodo.json
@@ -558,7 +558,7 @@
       "name": "Flandin, Guillaume"
     },
     {
-      "affiliation": "Stereotaxy Core, Brain & Spine Institute",
+      "affiliation": "University College London",
       "name": "P\u00e9rez-Garc\u00eda, Fernando",
       "orcid": "0000-0001-9090-3024"
     },
diff --git a/nipype/interfaces/niftyreg/regutils.py b/nipype/interfaces/niftyreg/regutils.py
index 7c3ed28ea..0910b7d65 100644
--- a/nipype/interfaces/niftyreg/regutils.py
+++ b/nipype/interfaces/niftyreg/regutils.py
@@ -122,7 +122,7 @@ warpfield.nii -res im2_res.nii.gz'
     # Need this overload to properly constraint the interpolation type input
     def _format_arg(self, name, spec, value):
         if name == 'inter_val':
-            inter_val = {'NN': 0, 'LIN': 1, 'CUB': 3, 'SINC': 5}
+            inter_val = {'NN': 0, 'LIN': 1, 'CUB': 3, 'SINC': 4}
             return spec.argstr % inter_val[value]
         else:
             return super(RegResample, self)._format_arg(name, spec, value)
@@ -295,6 +295,15 @@ class RegToolsInputSpec(NiftyRegCommandInputSpec):
         desc=desc,
         argstr='-smoG %f %f %f')
 
+    # Interpolation type
+    inter_val = traits.Enum(
+        'NN',
+        'LIN',
+        'CUB',
+        'SINC',
+        desc='Interpolation order to use to warp the floating image',
+        argstr='-interp %d')
+
 
 class RegToolsOutputSpec(TraitedSpec):
     """ Output Spec for RegTools. """
@@ -326,6 +335,14 @@ class RegTools(NiftyRegCommand):
     output_spec = RegToolsOutputSpec
     _suffix = '_tools'
 
+    # Need this overload to properly constraint the interpolation type input
+    def _format_arg(self, name, spec, value):
+        if name == 'inter_val':
+            inter_val = {'NN': 0, 'LIN': 1, 'CUB': 3, 'SINC': 4}
+            return spec.argstr % inter_val[value]
+        else:
+            return super(RegTools, self)._format_arg(name, spec, value)
+
 
 class RegAverageInputSpec(NiftyRegCommandInputSpec):
     """ Input Spec for RegAverage. """


Test patch:
diff --git a/nipype/interfaces/niftyreg/tests/test_auto_RegTools.py b/nipype/interfaces/niftyreg/tests/test_auto_RegTools.py
index 97ea5e6c9..f0f66083c 100644
--- a/nipype/interfaces/niftyreg/tests/test_auto_RegTools.py
+++ b/nipype/interfaces/niftyreg/tests/test_auto_RegTools.py
@@ -24,6 +24,7 @@ def test_RegTools_inputs():
             argstr='-in %s',
             mandatory=True,
         ),
+        inter_val=dict(argstr='-interp %d', ),
         iso_flag=dict(argstr='-iso', ),
         mask_file=dict(argstr='-nan %s', ),
         mul_val=dict(argstr='-mul %s', ),