diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index ec54118d78..2929531b62 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -28,27 +28,27 @@ class DeconvolveInputSpec(AFNICommandInputSpec): in_files = InputMultiPath( File( exists=True), - desc='Filenames of 3D+time input datasets. More than one filename can ' + desc='filenames of 3D+time input datasets. More than one filename can ' 'be given and the datasets will be auto-catenated in time. ' 'You can input a 1D time series file here, but the time axis ' 'should run along the ROW direction, not the COLUMN direction as ' 'in the \'input1D\' option.', argstr='-input %s', - mandatory=True, copyfile=False, - sep=" ") + sep=" ", + position=0) sat = traits.Bool( - desc='Check the dataset time series for initial saturation transients,' + desc='check the dataset time series for initial saturation transients,' ' which should normally have been excised before data analysis.', argstr='-sat', xor=['trans']) trans = traits.Bool( - desc='Check the dataset time series for initial saturation transients,' + desc='check the dataset time series for initial saturation transients,' ' which should normally have been excised before data analysis.', argstr='-trans', xor=['sat']) noblock = traits.Bool( - desc='Normally, if you input multiple datasets with \'input\', then ' + desc='normally, if you input multiple datasets with \'input\', then ' 'the separate datasets are taken to be separate image runs that ' 'get separate baseline models. Use this options if you want to ' 'have the program consider these to be all one big run.' @@ -58,11 +58,11 @@ class DeconvolveInputSpec(AFNICommandInputSpec): 'has no effect, no how, no way.', argstr='-noblock') force_TR = traits.Int( - desc='Use this value of TR instead of the one in the \'input\' ' - 'dataset. (It\'s better to fix the input using 3drefit.)', + desc='use this value instead of the TR in the \'input\' ' + 'dataset. (It\'s better to fix the input using Refit.)', argstr='-force_TR %d') input1D = File( - desc='Filename of single (fMRI) .1D time series where time runs down ' + desc='filename of single (fMRI) .1D time series where time runs down ' 'the column.', argstr='-input1D %s', exists=True) @@ -71,37 +71,71 @@ class DeconvolveInputSpec(AFNICommandInputSpec): 'not also use \'input1D\'.', argstr='-TR_1D %f') legendre = traits.Bool( - desc='Use Legendre polynomials for null hypothesis (baseline model)', + desc='use Legendre polynomials for null hypothesis (baseline model)', argstr='-legendre') nolegendre = traits.Bool( - desc='Use power polynomials for null hypotheses. Don\'t do this ' + desc='use power polynomials for null hypotheses. Don\'t do this ' 'unless you are crazy!', argstr='-nolegendre') + nodmbase = traits.Bool( + desc='don\'t de-mean baseline time series', + argstr='-nodmbase') + dmbase = traits.Bool( + desc='de-mean baseline time series (default if \'polort\' >= 0)', + argstr='-dmbase') + svd = traits.Bool( + desc='use SVD instead of Gaussian elimination (default)', + argstr='-svd') + nosvd = traits.Bool( + desc='use Gaussian elimination instead of SVD', + argstr='-nosvd') + rmsmin = traits.Float( + desc='minimum rms error to reject reduced model (default = 0; don\'t ' + 'use this option normally!)', + argstr='-rmsmin %f') + nocond = traits.Bool( + desc='DON\'T calculate matrix condition number', + argstr='-nocond') + singvals = traits.Bool( + desc='print out the matrix singular values', + argstr='-singvals') + goforit = traits.Int( + desc='use this to proceed even if the matrix has bad problems (e.g., ' + 'duplicate columns, large condition number, etc.).', + argstr='-GOFORIT %i') + allzero_OK = traits.Bool( + desc='don\'t consider all zero matrix columns to be the type of error ' + 'that \'gotforit\' is needed to ignore.', + argstr='-allzero_OK') + dname = traits.Tuple( + Str, Str, + desc='set environmental variable to provided value', + argstr='-D%s=%s') mask = File( - desc='Filename of 3D mask dataset; only data time series from within ' + desc='filename of 3D mask dataset; only data time series from within ' 'the mask will be analyzed; results for voxels outside the mask ' 'will be set to zero.', argstr='-mask %s', exists=True) automask = traits.Bool( - desc='Build a mask automatically from input data (will be slow for ' + desc='build a mask automatically from input data (will be slow for ' 'long time series datasets)', argstr='-automask') STATmask = File( - desc='Build a mask from input file, and use this mask for the purpose ' - 'of reporting truncation-to float issues AND for computing the ' - 'FDR curves. The actual results ARE not masked with this option ' - '(only with \'mask\' or \'automask\' options).', + desc='build a mask from provided file, and use this mask for the ' + 'purpose of reporting truncation-to float issues AND for ' + 'computing the FDR curves. The actual results ARE not masked ' + 'with this option (only with \'mask\' or \'automask\' options).', argstr='-STATmask %s', exists=True) censor = File( - desc='Filename of censor .1D time series. This is a file of 1s and ' + desc='filename of censor .1D time series. This is a file of 1s and ' '0s, indicating which time points are to be included (1) and ' 'which are to be excluded (0).', argstr='-censor %s', exists=True) polort = traits.Int( - desc='Degree of polynomial corresponding to the null hypothesis ' + desc='degree of polynomial corresponding to the null hypothesis ' '[default: 1]', argstr='-polort %d') ortvec = traits.Tuple( @@ -110,91 +144,93 @@ class DeconvolveInputSpec(AFNICommandInputSpec): exists=True), Str( desc='label'), - desc='This option lets you input a rectangular array of 1 or more ' + desc='this option lets you input a rectangular array of 1 or more ' 'baseline vectors from a file. This method is a fast way to ' 'include a lot of baseline regressors in one step. ', argstr='ortvec %s') x1D = File( - desc='Save out X matrix', + desc='specify name for saved X matrix', argstr='-x1D %s') x1D_stop = traits.Bool( - desc='Stop running after writing .xmat.1D file', + desc='stop running after writing .xmat.1D file', argstr='-x1D_stop') out_file = File( - 'Decon.nii', - desc='Output statistics file', + desc='output statistics file', argstr='-bucket %s') jobs = traits.Int( - desc='Run the program with provided number of sub-processes', + desc='run the program with provided number of sub-processes', argstr='-jobs %d') fout = traits.Bool( - desc='Output F-statistic for each stimulus', + desc='output F-statistic for each stimulus', argstr='-fout') rout = traits.Bool( - desc='Output the R^2 statistic for each stimulus', + desc='output the R^2 statistic for each stimulus', argstr='-rout') tout = traits.Bool( - desc='Output the T-statistic for each stimulus', + desc='output the T-statistic for each stimulus', argstr='-tout') vout = traits.Bool( - desc='Output the sample variance (MSE) for each stimulus', + desc='output the sample variance (MSE) for each stimulus', argstr='-vout') global_times = traits.Bool( - desc='Use global timing for stimulus timing files', + desc='use global timing for stimulus timing files', argstr='-global_times', xor=['local_times']) local_times = traits.Bool( - desc='Use local timing for stimulus timing files', + desc='use local timing for stimulus timing files', argstr='-local_times', xor=['global_times']) num_stimts = traits.Int( - desc='Number of stimulus timing files', + desc='number of stimulus timing files', argstr='-num_stimts %d', - position=0) + position=-6) stim_times = traits.List( traits.Tuple(traits.Int(desc='k-th response model'), File(desc='stimulus timing file',exists=True), Str(desc='model')), - desc='Generate a response model from a set of stimulus times' + desc='generate a response model from a set of stimulus times' ' given in file.', - argstr='-stim_times %d %s \'%s\'...') + argstr='-stim_times %d %s \'%s\'...', + position=-5) stim_label = traits.List( traits.Tuple(traits.Int(desc='k-th input stimulus'), Str(desc='stimulus label')), - desc='Label for kth input stimulus', + desc='label for kth input stimulus (e.g., Label1)', argstr='-stim_label %d %s...', - requires=['stim_times']) + requires=['stim_times'], + position=-4) stim_times_subtract = traits.Float( - desc='This option means to subtract specified seconds from each time ' + desc='this option means to subtract specified seconds from each time ' 'encountered in any \'stim_times\' option. The purpose of this ' 'option is to make it simple to adjust timing files for the ' 'removal of images from the start of each imaging run.', argstr='-stim_times_subtract %f') num_glt = traits.Int( - desc='Number of general linear tests (i.e., contrasts)', + desc='number of general linear tests (i.e., contrasts)', argstr='-num_glt %d', - position=1) + position=-3) gltsym = traits.List( Str(desc='symbolic general linear test'), - desc='General linear tests (i.e., contrasts) using symbolic ' + desc='general linear tests (i.e., contrasts) using symbolic ' 'conventions (e.g., \'+Label1 -Label2\')', - argstr='-gltsym \'SYM: %s\'...') + argstr='-gltsym \'SYM: %s\'...', + position=-2) glt_label = traits.List( traits.Tuple(traits.Int(desc='k-th general linear test'), Str(desc='GLT label')), - desc='General linear test (i.e., contrast) labels', + desc='general linear test (i.e., contrast) labels', argstr='-glt_label %d %s...', - requires=['gltsym']) + requires=['gltsym'], + position=-1) class DeconvolveOutputSpec(TraitedSpec): out_file = File( - desc='output statistics file', - exists=True) + desc='output statistics file', exists=True) reml_script = File( - desc='Autogenerated script for 3dREML') + desc='automatical generated script to run 3dREMLfit', exists=True) x1D = File( - desc='save out X matrix') + desc='save out X matrix', exists=True) class Deconvolve(AFNICommand): @@ -211,13 +247,13 @@ class Deconvolve(AFNICommand): >>> deconvolve.inputs.in_files = ['functional.nii', 'functional2.nii'] >>> deconvolve.inputs.out_file = 'output.nii' >>> deconvolve.inputs.x1D = 'output.1D' - >>> stim_times = [(1, 'timeseries.txt', 'SPMG1(4)'), (2, 'timeseries.txt', 'SPMG2(4)')] + >>> stim_times = [(1, 'timeseries.txt', 'SPMG1(4)')] >>> deconvolve.inputs.stim_times = stim_times - >>> deconvolve.inputs.stim_label = [(1, 'Houses'), (2, 'Apartments')] - >>> deconvolve.inputs.gltsym = [('+Houses -Apartments')] - >>> deconvolve.inputs.glt_label = [(1, 'Houses_Apartments')] + >>> deconvolve.inputs.stim_label = [(1, 'Houses')] + >>> deconvolve.inputs.gltsym = ['SYM: +Houses'] + >>> deconvolve.inputs.glt_label = [(1, 'Houses')] >>> deconvolve.cmdline # doctest: +ALLOW_UNICODE - "3dDeconvolve -num_stimts 2 -num_glt 1 -glt_label 1 Houses_Apartments -gltsym 'SYM: +Houses -Apartments' -input functional.nii functional2.nii -bucket output.nii -stim_label 1 Houses -stim_label 2 Apartments -stim_times 1 timeseries.txt 'SPMG1(4)' -stim_times 2 timeseries.txt 'SPMG2(4)' -x1D output.1D" + "3dDeconvolve -input functional.nii functional2.nii -bucket output.nii -x1D output.1D -num_stimts 1 -stim_times 1 timeseries.txt 'SPMG1(4)' -stim_label 1 Houses -num_glt 1 -gltsym 'SYM: +Houses' -glt_label 1 Houses" >>> res = deconvolve.run() # doctest: +SKIP """ @@ -225,6 +261,14 @@ class Deconvolve(AFNICommand): input_spec = DeconvolveInputSpec output_spec = DeconvolveOutputSpec + def _format_arg(self, name, trait_spec, value): + if name == 'gltsym': + for n, val in enumerate(value): + if val.startswith('SYM: '): + value[n] = val.lstrip('SYM: ') + + return super(Deconvolve,self)._format_arg(name, trait_spec, value) + def _parse_inputs(self, skip=None): if skip is None: skip = [] @@ -232,23 +276,29 @@ def _parse_inputs(self, skip=None): self.inputs.num_stimts = len(self.inputs.stim_times) if len(self.inputs.gltsym) and not isdefined(self.inputs.num_glt): self.inputs.num_glt = len(self.inputs.gltsym) + if not isdefined(self.inputs.out_file): + self.inputs.out_file = 'Decon.nii' + return super(Deconvolve, self)._parse_inputs(skip) def _list_outputs(self): outputs = self.output_spec().get() + + _gen_fname_opts = {} + _gen_fname_opts['basename'] = self.inputs.out_file + _gen_fname_opts['cwd'] = os.getcwd() + if isdefined(self.inputs.x1D): if not self.inputs.x1D.endswith('.xmat.1D'): outputs['x1D'] = os.path.abspath(self.inputs.x1D + '.xmat.1D') else: outputs['x1D'] = os.path.abspath(self.inputs.x1D) + else: + outputs['x1D'] = self._gen_fname(suffix='.xmat.1D', **_gen_fname_opts) - _gen_fname_opts = {} - _gen_fname_opts['basename'] = self.inputs.out_file - _gen_fname_opts['cwd'] = os.getcwd() - _gen_fname_opts['suffix'] = '.REML_cmd' - - outputs['reml_script'] = self._gen_fname(**_gen_fname_opts) + outputs['reml_script'] = self._gen_fname(suffix='.REML_cmd', **_gen_fname_opts) outputs['out_file'] = os.path.abspath(self.inputs.out_file) + return outputs @@ -263,40 +313,110 @@ class RemlfitInputSpec(AFNICommandInputSpec): copyfile=False, sep=" ") matrix = File( - desc='Read the design matrix, which should have been output from ' - '3dDeconvolve via the \'-x1D\' option', + desc='the design matrix file, which should have been output from ' + 'Deconvolve via the \'x1D\' option', argstr='-matrix %s', mandatory=True) # "Semi-Hidden Alternative Ways to Define the Matrix" polort = traits.Int( - desc='If no -matrix option is given, AND no -matim option, ' + desc='if no \'matrix\' option is given, AND no \'matim\' option, ' 'create a matrix with Legendre polynomial regressors' - 'up to order P. The default value is P=0, which' + 'up to the specified order. The default value is 0, which' 'produces a matrix with a single column of all ones', argstr='-polort %d', xor=['matrix']) matim = traits.File( - desc='Read a standard .1D file as the matrix.' - '** N.B.: You can use only Col as a name in GLTs' - 'with these nonstandard matrix input methods,' - 'since the other names come from the -matrix file.' - ' ** These mutually exclusive options are ignored if -matrix' + desc='read a standard file as the matrix. You can use only Col as ' + 'a name in GLTs with these nonstandard matrix input methods, ' + 'since the other names come from the \'matrix\' file. ' + 'These mutually exclusive options are ignored if \'matrix\' ' 'is used.', argstr='-matim %s', xor=['matrix']) # Other arguments mask = File( - desc='filename of 3D mask dataset; ' - 'Only data time series from within the mask ' - 'will be analyzed; results for voxels outside ' - 'the mask will be set to zero.', + desc='filename of 3D mask dataset; only data time series from within ' + 'the mask will be analyzed; results for voxels outside the mask ' + 'will be set to zero.', argstr='-mask %s', exists=True) automask = traits.Bool( usedefault=True, argstr='-automask', - desc='Build a mask automatically from input data ' - '(will be slow for long time series datasets)') + desc='build a mask automatically from input data (will be slow for ' + 'long time series datasets)') + STATmask = File( + desc='filename of 3D mask dataset to be used for the purpose ' + 'of reporting truncation-to float issues AND for computing the ' + 'FDR curves. The actual results ARE not masked with this option ' + '(only with \'mask\' or \'automask\' options).', + argstr='-STATmask %s', + exists=True) + addbase = InputMultiPath( + File( + exists=True, + desc='file containing columns to add to regression matrix'), + desc='file(s) to add baseline model columns to the matrix with this ' + 'option. Each column in the specified file(s) will be appended ' + 'to the matrix. File(s) must have at least as many rows as the ' + 'matrix does.', + exists=True, + copyfile=False, + sep=" ", + argstr='-addbase %s') + slibase = InputMultiPath( + File( + exists=True, + desc='file containing columns to add to regression matrix'), + desc='similar to \'addbase\' in concept, BUT each specified file ' + 'must have an integer multiple of the number of slices ' + 'in the input dataset(s); then, separate regression ' + 'matrices are generated for each slice, with the ' + 'first column of the file appended to the matrix for ' + 'the first slice of the dataset, the second column of the file ' + 'appended to the matrix for the first slice of the dataset, ' + 'and so on. Intended to help model physiological noise in FMRI, ' + 'or other effects you want to regress out that might ' + 'change significantly in the inter-slice time intervals. This ' + 'will slow the program down, and make it use a lot more memory ' + '(to hold all the matrix stuff).', + argstr='-slibase %s') + slibase_sm = InputMultiPath( + File( + exists=True, + desc='file containing columns to add to regression matrix'), + desc='similar to \'slibase\', BUT each file much be in slice major ' + 'order (i.e. all slice0 columns come first, then all slice1 ' + 'columns, etc).', + argstr='-slibase_sm %s') + usetemp = traits.Bool( + desc='write intermediate stuff to disk, to economize on RAM. ' + 'Using this option might be necessary to run with ' + '\'slibase\' and with \'Grid\' values above the default, ' + 'since the program has to store a large number of ' + 'matrices for such a problem: two for every slice and ' + 'for every (a,b) pair in the ARMA parameter grid. Temporary ' + 'files are written to the directory given in environment ' + 'variable TMPDIR, or in /tmp, or in ./ (preference is in that ' + 'order)', + argstr='-usetemp') + nodmbase = traits.Bool( + desc='by default, baseline columns added to the matrix via ' + '\'addbase\' or \'slibase\' or \'dsort\' will each have their ' + 'mean removed (as is done in Deconvolve); this option turns this ' + 'centering off', + argstr='-nodmbase', + requires=['addbase','dsort']) + dsort = File( + desc='4D dataset to be used as voxelwise baseline regressor', + exists=True, + copyfile=False, + argstr='-dsort %s') + dsort_nods = traits.Bool( + desc='if \'dsort\' option is used, this command will output ' + 'additional results files excluding the \'dsort\' file', + argstr='-dsort_nods', + requires=['dsort']) fout = traits.Bool( desc='output F-statistic for each stimulus', argstr='-fout') @@ -304,17 +424,130 @@ class RemlfitInputSpec(AFNICommandInputSpec): desc='output the R^2 statistic for each stimulus', argstr='-rout') tout = traits.Bool( - desc='output the T-statistic for each stimulus' - '[if you use -Rbuck and do not give any of -fout, -tout,]' - 'or -rout, then the program assumes -fout is activated.]', + desc='output the T-statistic for each stimulus; if you use ' + '\'out_file\' and do not give any of \'fout\', \'tout\',' + 'or \'rout\', then the program assumes \'fout\' is activated.', argstr='-tout') nofdr = traits.Bool( - desc='do NOT add FDR curve data to bucket datasets ' - '[FDR curves can take a long time if -tout is used]', + desc='do NOT add FDR curve data to bucket datasets; FDR curves can ' + 'take a long time if \'tout\' is used', argstr='-noFDR') + nobout = traits.Bool( + desc='do NOT add baseline (null hypothesis) regressor betas ' + 'to the \'rbeta_file\' and/or \'obeta_file\' output datasets.', + argstr='-nobout') + gltsym = traits.List( + traits.Either(traits.Tuple(File(exists=True), Str()), + traits.Tuple(Str(), Str())), + desc='read a symbolic GLT from input file and associate it with a ' + 'label. As in Deconvolve, you can also use the \'SYM:\' method ' + 'to provide the definition of the GLT directly as a string ' + '(e.g., with \'SYM: +Label1 -Label2\'). Unlike Deconvolve, you ' + 'MUST specify \'SYM: \' if providing the GLT directly as a ' + 'string instead of from a file', + argstr='-gltsym "%s" %s...') out_file = File( - desc='output statistics file', + desc='output dataset for beta + statistics from the REML estimation; ' + 'also contains the results of any GLT analysis requested ' + 'in the Deconvolve setup, similar to the \'bucket\' output ' + 'from Deconvolve. This dataset does NOT get the betas ' + '(or statistics) of those regressors marked as \'baseline\' ' + 'in the matrix file.', argstr='-Rbuck %s') + var_file = File( + desc='output dataset for REML variance parameters', + argstr='-Rvar %s') + rbeta_file = File( + desc='output dataset for beta weights from the REML estimation, ' + 'similar to the \'cbucket\' output from Deconvolve. This dataset ' + 'will contain all the beta weights, for baseline and stimulus ' + 'regressors alike, unless the \'-nobout\' option is given -- ' + 'in that case, this dataset will only get the betas for the ' + 'stimulus regressors.', + argstr='-Rbeta %s') + glt_file = File( + desc='output dataset for beta + statistics from the REML estimation, ' + 'but ONLY for the GLTs added on the REMLfit command line itself ' + 'via \'gltsym\'; GLTs from Deconvolve\'s command line will NOT ' + 'be included.', + argstr='-Rglt %s') + fitts_file = File( + desc='ouput dataset for REML fitted model', + argstr='-Rfitts %s') + errts_file = File( + desc='output dataset for REML residuals = data - fitted model', + argstr='-Rerrts %s') + wherr_file = File( + desc='dataset for REML residual, whitened using the estimated ' + 'ARMA(1,1) correlation matrix of the noise', + argstr='-Rwherr %s') + quiet = traits.Bool( + desc='turn off most progress messages', + argstr='-quiet') + verb = traits.Bool( + desc='turns on more progress messages, including memory usage ' + 'progress reports at various stages', + argstr='-verb') + ovar = File( + desc='dataset for OLSQ st.dev. parameter (kind of boring)', + argstr='-Ovar %s') + obeta = File( + desc='dataset for beta weights from the OLSQ estimation', + argstr='-Obeta %s') + obuck = File( + desc='dataset for beta + statistics from the OLSQ estimation', + argstr='-Obuck %s') + oglt = File( + desc='dataset for beta + statistics from \'gltsym\' options', + argstr='-Oglt %s') + ofitts = File( + desc='dataset for OLSQ fitted model', + argstr='-Ofitts %s') + oerrts = File( + desc='dataset for OLSQ residuals (data - fitted model)', + argstr='-Oerrts %s') + + +class RemlfitOutputSpec(AFNICommandOutputSpec): + out_file = File( + desc='dataset for beta + statistics from the REML estimation (if ' + 'generated') + var_file = File( + desc='dataset for REML variance parameters (if generated)') + rbeta_file = File( + desc='dataset for beta weights from the REML estimation (if ' + 'generated)') + rbeta_file = File( + desc='output dataset for beta weights from the REML estimation (if ' + 'generated') + glt_file = File( + desc='output dataset for beta + statistics from the REML estimation, ' + 'but ONLY for the GLTs added on the REMLfit command ' + 'line itself via \'gltsym\' (if generated)') + fitts_file = File( + desc='ouput dataset for REML fitted model (if generated)') + errts_file = File( + desc='output dataset for REML residuals = data - fitted model (if ' + 'generated') + wherr_file = File( + desc='dataset for REML residual, whitened using the estimated ' + 'ARMA(1,1) correlation matrix of the noise (if generated)') + ovar = File( + desc='dataset for OLSQ st.dev. parameter (if generated)') + obeta = File( + desc='dataset for beta weights from the OLSQ estimation (if ' + 'generated)') + obuck = File( + desc='dataset for beta + statistics from the OLSQ estimation (if ' + 'generated)') + oglt = File( + desc='dataset for beta + statistics from \'gltsym\' options (if ' + 'generated') + ofitts = File( + desc='dataset for OLSQ fitted model (if generated)') + oerrts = File( + desc='dataset for OLSQ residuals = data - fitted model (if ' + 'generated') class Remlfit(AFNICommand): @@ -333,14 +566,15 @@ class Remlfit(AFNICommand): >>> remlfit.inputs.in_files = ['functional.nii', 'functional2.nii'] >>> remlfit.inputs.out_file = 'output.nii' >>> remlfit.inputs.matrix = 'output.1D' + >>> remlfit.inputs.gltsym = [('SYM: +Lab1 -Lab2', 'TestSYM'), ('timeseries.txt', 'TestFile')] >>> remlfit.cmdline # doctest: +ALLOW_UNICODE - '3dREMLfit -input "functional.nii functional2.nii" -matrix output.1D -Rbuck output.nii' + '3dREMLfit -gltsym "SYM: +Lab1 -Lab2" TestSYM -gltsym "timeseries.txt" TestFile -input "functional.nii functional2.nii" -matrix output.1D -Rbuck output.nii' >>> res = remlfit.run() # doctest: +SKIP """ _cmd = '3dREMLfit' input_spec = RemlfitInputSpec - output_spec = AFNICommandOutputSpec + output_spec = RemlfitOutputSpec def _parse_inputs(self, skip=None): if skip is None: @@ -349,5 +583,9 @@ def _parse_inputs(self, skip=None): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_file + + for key in outputs.keys(): + if isdefined(self.inputs.get()[key]): + outputs[key] = os.path.abspath(self.inputs.get()[key]) + return outputs diff --git a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py index 635c0359a4..0dfbec8deb 100644 --- a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py +++ b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py @@ -8,12 +8,18 @@ def test_Deconvolve_inputs(): ), TR_1D=dict(argstr='-TR_1D %f', ), + allzero_OK=dict(argstr='-allzero_OK', + ), args=dict(argstr='%s', ), automask=dict(argstr='-automask', ), censor=dict(argstr='-censor %s', ), + dmbase=dict(argstr='-dmbase', + ), + dname=dict(argstr='-D%s=%s', + ), environ=dict(nohash=True, usedefault=True, ), @@ -25,16 +31,20 @@ def test_Deconvolve_inputs(): xor=['local_times'], ), glt_label=dict(argstr='-glt_label %d %s...', + position=-1, requires=['gltsym'], ), gltsym=dict(argstr="-gltsym 'SYM: %s'...", + position=-2, + ), + goforit=dict(argstr='-GOFORIT %i', ), ignore_exception=dict(nohash=True, usedefault=True, ), in_files=dict(argstr='-input %s', copyfile=False, - mandatory=True, + position=0, sep=' ', ), input1D=dict(argstr='-input1D %s', @@ -50,13 +60,19 @@ def test_Deconvolve_inputs(): ), noblock=dict(argstr='-noblock', ), + nocond=dict(argstr='-nocond', + ), + nodmbase=dict(argstr='-nodmbase', + ), nolegendre=dict(argstr='-nolegendre', ), + nosvd=dict(argstr='-nosvd', + ), num_glt=dict(argstr='-num_glt %d', - position=1, + position=-3, ), num_stimts=dict(argstr='-num_stimts %d', - position=0, + position=-6, ), ortvec=dict(argstr='ortvec %s', ), @@ -65,18 +81,26 @@ def test_Deconvolve_inputs(): outputtype=dict(), polort=dict(argstr='-polort %d', ), + rmsmin=dict(argstr='-rmsmin %f', + ), rout=dict(argstr='-rout', ), sat=dict(argstr='-sat', xor=['trans'], ), + singvals=dict(argstr='-singvals', + ), stim_label=dict(argstr='-stim_label %d %s...', + position=-4, requires=['stim_times'], ), stim_times=dict(argstr="-stim_times %d %s '%s'...", + position=-5, ), stim_times_subtract=dict(argstr='-stim_times_subtract %f', ), + svd=dict(argstr='-svd', + ), terminal_output=dict(nohash=True, ), tout=dict(argstr='-tout', diff --git a/nipype/interfaces/afni/tests/test_auto_Remlfit.py b/nipype/interfaces/afni/tests/test_auto_Remlfit.py index 9d561762a8..8e216aa01d 100644 --- a/nipype/interfaces/afni/tests/test_auto_Remlfit.py +++ b/nipype/interfaces/afni/tests/test_auto_Remlfit.py @@ -4,16 +4,37 @@ def test_Remlfit_inputs(): - input_map = dict(args=dict(argstr='%s', + input_map = dict(STATmask=dict(argstr='-STATmask %s', + ), + addbase=dict(argstr='-addbase %s', + copyfile=False, + exists=True, + sep=' ', + ), + args=dict(argstr='%s', ), automask=dict(argstr='-automask', usedefault=True, ), + dsort=dict(argstr='-dsort %s', + copyfile=False, + ), + dsort_nods=dict(argstr='-dsort_nods', + requires=['dsort'], + ), environ=dict(nohash=True, usedefault=True, ), + errts_file=dict(argstr='-Rerrts %s', + ), + fitts_file=dict(argstr='-Rfitts %s', + ), fout=dict(argstr='-fout', ), + glt_file=dict(argstr='-Rglt %s', + ), + gltsym=dict(argstr='-gltsym "%s" %s...', + ), ignore_exception=dict(nohash=True, usedefault=True, ), @@ -30,20 +51,53 @@ def test_Remlfit_inputs(): matrix=dict(argstr='-matrix %s', mandatory=True, ), + nobout=dict(argstr='-nobout', + ), + nodmbase=dict(argstr='-nodmbase', + requires=['addbase', 'dsort'], + ), nofdr=dict(argstr='-noFDR', ), + obeta=dict(argstr='-Obeta %s', + ), + obuck=dict(argstr='-Obuck %s', + ), + oerrts=dict(argstr='-Oerrts %s', + ), + ofitts=dict(argstr='-Ofitts %s', + ), + oglt=dict(argstr='-Oglt %s', + ), out_file=dict(argstr='-Rbuck %s', ), outputtype=dict(), + ovar=dict(argstr='-Ovar %s', + ), polort=dict(argstr='-polort %d', xor=['matrix'], ), + quiet=dict(argstr='-quiet', + ), + rbeta_file=dict(argstr='-Rbeta %s', + ), rout=dict(argstr='-rout', ), + slibase=dict(argstr='-slibase %s', + ), + slibase_sm=dict(argstr='-slibase_sm %s', + ), terminal_output=dict(nohash=True, ), tout=dict(argstr='-tout', ), + usetemp=dict(argstr='-usetemp', + ), + var_file=dict(argstr='-Rvar %s', + ), + verb=dict(argstr='-verb', + ), + wherr_file=dict(argstr='-Rwherr %s', + ), ) inputs = Remlfit.input_spec() @@ -53,7 +107,19 @@ def test_Remlfit_inputs(): def test_Remlfit_outputs(): - output_map = dict(out_file=dict(), + output_map = dict(errts_file=dict(), + fitts_file=dict(), + glt_file=dict(), + obeta=dict(), + obuck=dict(), + oerrts=dict(), + ofitts=dict(), + oglt=dict(), + out_file=dict(), + ovar=dict(), + rbeta_file=dict(), + var_file=dict(), + wherr_file=dict(), ) outputs = Remlfit.output_spec()