Skip to content

Commit 168dfee

Browse files
authored
Merge pull request #2396 from VisionandCognition/afni_volreg_inweightvol
ENH Allow input weight for AFNI's volreg.
2 parents 872d749 + d59a09c commit 168dfee

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,6 +2483,12 @@ class VolregInputSpec(AFNICommandInputSpec):
24832483
mandatory=True,
24842484
exists=True,
24852485
copyfile=False)
2486+
in_weight_volume = traits.Either(
2487+
traits.Tuple(File(exists=True), traits.Int),
2488+
File(exists=True),
2489+
desc='weights for each voxel specified by a file with an '
2490+
'optional volume number (defaults to 0)',
2491+
argstr="-weight '%s[%d]'")
24862492
out_file = File(
24872493
name_template='%s_volreg',
24882494
desc='output image file name',
@@ -2575,6 +2581,11 @@ class Volreg(AFNICommand):
25752581
input_spec = VolregInputSpec
25762582
output_spec = VolregOutputSpec
25772583

2584+
def _format_arg(self, name, trait_spec, value):
2585+
if name == 'in_weight_volume' and not isinstance(value, tuple):
2586+
value = (value, 0)
2587+
return super(Volreg, self)._format_arg(name, trait_spec, value)
2588+
25782589

25792590
class WarpInputSpec(AFNICommandInputSpec):
25802591
in_file = File(

nipype/interfaces/afni/tests/test_auto_Volreg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def test_Volreg_inputs():
2626
mandatory=True,
2727
position=-1,
2828
),
29+
in_weight_volume=dict(argstr="-weight '%s[%d]'", ),
2930
interp=dict(argstr='-%s', ),
3031
md1d_file=dict(
3132
argstr='-maxdisp1D %s',

0 commit comments

Comments
 (0)