@@ -158,6 +158,7 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
158
158
requires = ['glt_sym' ])
159
159
160
160
161
+
161
162
class DeconvolveOutputSpec (TraitedSpec ):
162
163
pass
163
164
@@ -173,5 +174,38 @@ class Deconvolve(AFNICommand):
173
174
174
175
>>> from nipype.interfaces import afni
175
176
>>> deconvolve = afni.Deconvolve()
177
+ >>> deconvolve.inputs.in_file = 'functional.nii'
178
+ >>> deconvolve.inputs.bucket = 'output.nii'
179
+ >>> deconvolve.inputs.x1D = 'output.1D'
180
+ >>> stim_times = [(1, 'stims1.txt', 'SPMG1(4)'), (2, 'stims2.txt', 'SPMG2(4)')]
181
+ >>> deconvolve.inputs.stim_times = stim_times
182
+ >>> deconvolve.cmdline # doctest: +ALLOW_UNICODE
183
+ '3dDeconvolve -input functional.nii -bucket output.nii -x1D output.1D -stim_times 1 stims1.txt SPMG1(4) 2 stims2.txt SPMG2(4)'
184
+ >>> res = deconvolve.run() # doctest: +SKIP
176
185
"""
177
- pass
186
+
187
+ _cmd = '3dDeconvolve'
188
+ input_spec = DeconvolveInputSpec
189
+ output_spec = DeconvolveOutputSpec
190
+
191
+ def _list_outputs (self ):
192
+ outputs = self .output_spec ().get ()
193
+ if isdefined (self .inputs .x1D ):
194
+ if not self .inputs .x1D .endswith ('.xmat.1D' ):
195
+ outputs ['x1D' ] = outputs ['x1D' ] + '.xmat.1D'
196
+ return outputs
197
+
198
+ def _format_arg (self , name , trait_spec , value ):
199
+ """
200
+ Argument num_glt is defined automatically from the number of contrasts
201
+ desired (defined by the length of glt_sym). No effort has been made to
202
+ make this compatible with glt.
203
+ """
204
+ if name in ['stim_times' , 'stim_labels' ]:
205
+ arg = ''
206
+ for st in value :
207
+ arg += trait_spec .argstr % value
208
+ arg = arg .rstrip ()
209
+ return arg
210
+ elif name == 'glt_sym' :
211
+ self .inputs .num_glt = len (value )
0 commit comments