@@ -49,7 +49,8 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
49
49
' with a multi-column 1D time series file.' ,
50
50
argstr = '-input %s' ,
51
51
mandatory = True ,
52
- copyfile = False )
52
+ copyfile = False ,
53
+ sep = " " )
53
54
mask = File (
54
55
desc = 'filename of 3D mask dataset; '
55
56
'Only data time series from within the mask '
@@ -88,13 +89,13 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
88
89
'This method is just a faster and simpler way to '
89
90
'include a lot of baseline regressors in one step. ' ,
90
91
argstr = 'ortvec %s' )
91
- x1d = File (
92
+ x1D = File (
92
93
desc = 'save out X matrix' ,
93
94
argstr = '-x1D %s' )
94
- x1d_stop = traits .Bool (
95
+ x1D_stop = traits .Bool (
95
96
desc = 'stop running after writing .xmat.1D file' ,
96
97
argstr = '-x1D_stop' )
97
- bucket = File (
98
+ out_file = File (
98
99
desc = 'output statistics file' ,
99
100
argstr = '-bucket %s' )
100
101
jobs = traits .Int (
@@ -138,24 +139,24 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
138
139
Str (desc = 'model' )),
139
140
desc = 'Generate the k-th response model from a set of stimulus times'
140
141
' given in file \' tname\' .' ,
141
- argstr = '-stim_times %d %s %s' )
142
+ argstr = '-stim_times %d %s %s... ' )
142
143
stim_label = traits .List (
143
144
traits .Tuple (traits .Int (desc = 'k-th input stimulus' ),
144
145
Str (desc = 'stimulus label' )),
145
146
desc = 'label for kth input stimulus' ,
146
- argstr = '-stim_label %d %s' ,
147
+ argstr = '-stim_label %d %s... ' ,
147
148
requires = ['stim_times' ])
148
149
gltsym = traits .List (
149
150
Str (desc = 'symbolic general linear test' ),
150
151
desc = 'general linear tests (i.e., contrasts) using symbolic '
151
152
'conventions' ,
152
- argstr = '-gltsym %s' )
153
+ argstr = '-gltsym %s... ' )
153
154
glt_labels = traits .List (
154
155
traits .Tuple (traits .Int (desc = 'k-th general linear test' ),
155
156
Str (desc = 'GLT label' )),
156
157
desc = 'general linear test (i.e., contrast) labels' ,
157
- argstr = '-glt_label %d %s' ,
158
- requires = ['glt_sym ' ])
158
+ argstr = '-glt_label %d %s... ' ,
159
+ requires = ['gltsym ' ])
159
160
160
161
161
162
class Deconvolve (AFNICommand ):
@@ -169,20 +170,29 @@ class Deconvolve(AFNICommand):
169
170
170
171
>>> from nipype.interfaces import afni
171
172
>>> deconvolve = afni.Deconvolve()
172
- >>> deconvolve.inputs.in_file = 'functional.nii'
173
- >>> deconvolve.inputs.bucket = 'output.nii'
173
+ >>> deconvolve.inputs.in_files = [ 'functional.nii', 'functional2.nii']
174
+ >>> deconvolve.inputs.out_file = 'output.nii'
174
175
>>> deconvolve.inputs.x1D = 'output.1D'
175
- >>> stim_times = [(1, 'stims1 .txt', 'SPMG1(4)'), (2, 'stims2 .txt', 'SPMG2(4)')]
176
+ >>> stim_times = [(1, 'timeseries .txt', 'SPMG1(4)'), (2, 'timeseries .txt', 'SPMG2(4)')]
176
177
>>> deconvolve.inputs.stim_times = stim_times
177
178
>>> deconvolve.cmdline # doctest: +ALLOW_UNICODE
178
- '3dDeconvolve -input functional.nii - bucket output.nii -x1D output - stim_times 1 stims1 .txt SPMG1(4) 2 stims2 .txt SPMG2(4)'
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 '
179
180
>>> res = deconvolve.run() # doctest: +SKIP
180
181
"""
181
182
182
183
_cmd = '3dDeconvolve'
183
184
input_spec = DeconvolveInputSpec
184
185
output_spec = AFNICommandOutputSpec
185
186
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
+
186
196
def _list_outputs (self ):
187
197
outputs = self .output_spec ().get ()
188
198
if isdefined (self .inputs .x1D ):
@@ -191,23 +201,5 @@ def _list_outputs(self):
191
201
else :
192
202
outputs ['x1D' ] = self .inputs .x1D
193
203
194
- outputs ['bucket ' ] = self .inputs .bucket
204
+ outputs ['out_file ' ] = self .inputs .out_file
195
205
return outputs
196
-
197
- def _format_arg (self , name , trait_spec , value ):
198
- """
199
- Argument num_glt is defined automatically from the number of contrasts
200
- desired (defined by the length of glt_sym). No effort has been made to
201
- make this compatible with glt.
202
- """
203
- if name in ['stim_times' , 'stim_labels' ]:
204
- arg = ''
205
- for st in value :
206
- arg += trait_spec .argstr % value
207
- arg = arg .rstrip ()
208
- return arg
209
-
210
- if name == 'stim_times' :
211
- self .inputs .num_stimts = len (value )
212
- elif name == 'glt_sym' :
213
- self .inputs .num_glt = len (value )
0 commit comments