Skip to content

Commit e679215

Browse files
authored
Merge pull request #2471 from fepegar/add-interp-to-niftyreg-regtools
ENH: Add interpolation order parameter to NiftyReg's RegTools
2 parents 6ca791d + e34c662 commit e679215

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

.zenodo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@
558558
"name": "Flandin, Guillaume"
559559
},
560560
{
561-
"affiliation": "Stereotaxy Core, Brain & Spine Institute",
561+
"affiliation": "University College London",
562562
"name": "P\u00e9rez-Garc\u00eda, Fernando",
563563
"orcid": "0000-0001-9090-3024"
564564
},

nipype/interfaces/niftyreg/regutils.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class RegResample(NiftyRegCommand):
122122
# Need this overload to properly constraint the interpolation type input
123123
def _format_arg(self, name, spec, value):
124124
if name == 'inter_val':
125-
inter_val = {'NN': 0, 'LIN': 1, 'CUB': 3, 'SINC': 5}
125+
inter_val = {'NN': 0, 'LIN': 1, 'CUB': 3, 'SINC': 4}
126126
return spec.argstr % inter_val[value]
127127
else:
128128
return super(RegResample, self)._format_arg(name, spec, value)
@@ -295,6 +295,15 @@ class RegToolsInputSpec(NiftyRegCommandInputSpec):
295295
desc=desc,
296296
argstr='-smoG %f %f %f')
297297

298+
# Interpolation type
299+
inter_val = traits.Enum(
300+
'NN',
301+
'LIN',
302+
'CUB',
303+
'SINC',
304+
desc='Interpolation order to use to warp the floating image',
305+
argstr='-interp %d')
306+
298307

299308
class RegToolsOutputSpec(TraitedSpec):
300309
""" Output Spec for RegTools. """
@@ -326,6 +335,14 @@ class RegTools(NiftyRegCommand):
326335
output_spec = RegToolsOutputSpec
327336
_suffix = '_tools'
328337

338+
# Need this overload to properly constraint the interpolation type input
339+
def _format_arg(self, name, spec, value):
340+
if name == 'inter_val':
341+
inter_val = {'NN': 0, 'LIN': 1, 'CUB': 3, 'SINC': 4}
342+
return spec.argstr % inter_val[value]
343+
else:
344+
return super(RegTools, self)._format_arg(name, spec, value)
345+
329346

330347
class RegAverageInputSpec(NiftyRegCommandInputSpec):
331348
""" Input Spec for RegAverage. """

nipype/interfaces/niftyreg/tests/test_auto_RegTools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def test_RegTools_inputs():
2424
argstr='-in %s',
2525
mandatory=True,
2626
),
27+
inter_val=dict(argstr='-interp %d', ),
2728
iso_flag=dict(argstr='-iso', ),
2829
mask_file=dict(argstr='-nan %s', ),
2930
mul_val=dict(argstr='-mul %s', ),

0 commit comments

Comments
 (0)