Skip to content

Commit f3839ae

Browse files
committed
Added input parsing Deconvolve
Forces num_stimts and num_glt if stim_times and gltsym are provided
1 parent e7a9882 commit f3839ae

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

nipype/interfaces/afni/model.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
5050
argstr='-input %s',
5151
mandatory=True,
5252
copyfile=False,
53-
position=0,
5453
sep=" ")
5554
mask = File(
5655
desc='filename of 3D mask dataset; '
@@ -177,14 +176,23 @@ class Deconvolve(AFNICommand):
177176
>>> stim_times = [(1, 'timeseries.txt', 'SPMG1(4)'), (2, 'timeseries.txt', 'SPMG2(4)')]
178177
>>> deconvolve.inputs.stim_times = stim_times
179178
>>> deconvolve.cmdline # doctest: +ALLOW_UNICODE
180-
'3dDeconvolve -input functional.nii functional2.nii -bucket output.nii -stim_times 1 timeseries.txt SPMG1(4) -stim_times 2 timeseries.txt SPMG2(4) -x1D output.1D'
179+
'3dDeconvolve -input functional.nii functional2.nii -num_stimts 2 -bucket output.nii -stim_times 1 timeseries.txt SPMG1(4) -stim_times 2 timeseries.txt SPMG2(4) -x1D output.1D'
181180
>>> res = deconvolve.run() # doctest: +SKIP
182181
"""
183182

184183
_cmd = '3dDeconvolve'
185184
input_spec = DeconvolveInputSpec
186185
output_spec = AFNICommandOutputSpec
187186

187+
def _parse_inputs(self, skip=None):
188+
if skip is None:
189+
skip = []
190+
if len(self.inputs.stim_times) and not isdefined(self.inputs.num_stimts):
191+
self.inputs.num_stimts = len(self.inputs.stim_times)
192+
if len(self.inputs.gltsym) and not isdefined(self.inputs.num_glt):
193+
self.inputs.num_glt = len(self.inputs.gltsym)
194+
return super(Deconvolve, self)._parse_inputs(skip)
195+
188196
def _list_outputs(self):
189197
outputs = self.output_spec().get()
190198
if isdefined(self.inputs.x1D):

0 commit comments

Comments
 (0)