@@ -245,3 +245,109 @@ def _list_outputs(self):
245245 outputs ['reml_script' ] = self ._gen_fname (suffix = '.REML_cmd' , ** _gen_fname_opts )
246246 outputs ['out_file' ] = self .inputs .out_file
247247 return outputs
248+
249+
250+ class RemlfitInputSpec (AFNICommandInputSpec ):
251+ # mandatory files
252+ in_files = InputMultiPath (
253+ File (
254+ exists = True ),
255+ desc = 'Read time series dataset' ,
256+ argstr = '-input %s' ,
257+ mandatory = True ,
258+ copyfile = False ,
259+ sep = " " )
260+ matrix = File (
261+ desc = 'Read the design matrix, which should have been output from '
262+ '3dDeconvolve via the \' -x1D\' option' ,
263+ argstr = '-matrix %s' ,
264+ mandatory = True )
265+ # "Semi-Hidden Alternative Ways to Define the Matrix"
266+ polort = traits .Int (
267+ desc = 'If no -matrix option is given, AND no -matim option, '
268+ 'create a matrix with Legendre polynomial regressors'
269+ 'up to order P. The default value is P=0, which'
270+ 'produces a matrix with a single column of all ones' ,
271+ argstr = '-polort %d' ,
272+ xor = ['matrix' ])
273+ matim = traits .File (
274+ desc = 'Read a standard .1D file as the matrix.'
275+ '** N.B.: You can use only Col as a name in GLTs'
276+ 'with these nonstandard matrix input methods,'
277+ 'since the other names come from the -matrix file.'
278+ ' ** These mutually exclusive options are ignored if -matrix'
279+ 'is used.' ,
280+ argstr = '-matim %s' ,
281+ xor = ['matrix' ])
282+ # Other arguments
283+ mask = File (
284+ desc = 'filename of 3D mask dataset; '
285+ 'Only data time series from within the mask '
286+ 'will be analyzed; results for voxels outside '
287+ 'the mask will be set to zero.' ,
288+ argstr = '-mask %s' ,
289+ exists = True )
290+ automask = traits .Bool (
291+ usedefault = True ,
292+ argstr = '-automask' ,
293+ desc = 'Build a mask automatically from input data '
294+ '(will be slow for long time series datasets)' )
295+ fout = traits .Bool (
296+ desc = 'output F-statistic for each stimulus' ,
297+ argstr = '-fout' )
298+ rout = traits .Bool (
299+ desc = 'output the R^2 statistic for each stimulus' ,
300+ argstr = '-rout' )
301+ tout = traits .Bool (
302+ desc = 'output the T-statistic for each stimulus'
303+ '[if you use -Rbuck and do not give any of -fout, -tout,]'
304+ 'or -rout, then the program assumes -fout is activated.]' ,
305+ argstr = '-tout' )
306+ nofdr = traits .Bool (
307+ desc = 'do NOT add FDR curve data to bucket datasets '
308+ '[FDR curves can take a long time if -tout is used]' ,
309+ argstr = '-noFDR' )
310+ out_file = File (
311+ desc = 'output statistics file' ,
312+ argstr = '-Rbuck %s' )
313+
314+
315+ class Remlfit (AFNICommand ):
316+ """Performs Generalized least squares time series fit with Restricted
317+ Maximum Likelihood (REML) estimation of the temporal auto-correlation
318+ structure.
319+
320+ For complete details, see the `3dREMLfit Documentation.
321+ <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dREMLfit.html>`_
322+
323+ Examples
324+ ========
325+
326+ >>> from nipype.interfaces import afni
327+ >>> remlfit = afni.Remlfit()
328+ >>> remlfit.inputs.in_files = ['functional.nii', 'functional2.nii']
329+ >>> remlfit.inputs.out_file = 'output.nii'
330+ >>> remlfit.inputs.matrix = 'output.1D'
331+ >>> remlfit.cmdline # doctest: +ALLOW_UNICODE
332+ '3dREMLfit -input "functional.nii functional2.nii" -matrix output.1D -Rbuck output.nii'
333+ >>> res = remlfit.run() # doctest: +SKIP
334+ """
335+
336+ _cmd = '3dREMLfit'
337+ input_spec = RemlfitInputSpec
338+ output_spec = AFNICommandOutputSpec
339+
340+ def _parse_inputs (self , skip = None ):
341+ if skip is None :
342+ skip = []
343+ skip += ['in_files' ]
344+ # we'll have to deal with input ourselves because AFNI might want
345+ # everything into double quotes
346+ inputs = super (Remlfit , self )._parse_inputs (skip )
347+ inputs = [u'-input "{0}"' .format (' ' .join (self .inputs .in_files ))] + inputs
348+ return inputs
349+
350+ def _list_outputs (self ):
351+ outputs = self .output_spec ().get ()
352+ outputs ['out_file' ] = self .inputs .out_file
353+ return outputs
0 commit comments