Skip to content

Afni deconvolve #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 127 additions & 1 deletion nipype/interfaces/afni/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,132 @@
AFNICommandBase, AFNICommand, AFNICommandInputSpec, AFNICommandOutputSpec)

class DeconvolveInputSpec(AFNICommandInputSpec):
pass
in_files = InputMultiPath(
File(
exists=True),
desc='fname = filename of 3D+time input dataset '
' [more than one filename can be given] '
' here, and these datasets will be] '
' [auto-catenated in time; if you do this,] '
' [\'-concat\' is not needed and is ignored.] '
'** 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. You can automatically '
' transpose a 1D file on input using the \\\' '
' operator at the end of the filename, as in '
' -input fred.1D\\\' '
' * This is the only way to use 3dDeconvolve '
' with a multi-column 1D time series file.',
argstr='-input %s',
mandatory=True,
copyfile=False)
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.',
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)')
censor = File(
desc=' cname = 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). '
'* Option \'-censor\' can only be used once!',
argstr='-censor %s',
exists=True)
polort = traits.Int(
desc='pnum = degree of polynomial corresponding to the '
' null hypothesis [default: pnum = 1]',
argstr='-polort %d')
ortvec = traits.Tuple(
File(
desc='filename',
exists=True),
Str(
desc='label'),
desc='This option lets you input a rectangular array '
'of 1 or more baseline vectors from file \'fff\', '
'which will get the label \'lll\'. Functionally, '
'it is the same as using \'-stim_file\' on each '
'column of \'fff\' separately (plus \'-stim_base\'). '
'This method is just a faster and simpler way to '
'include a lot of baseline regressors in one step. ',
argstr='ortvec %s')
x1d = File(
desc='save out X matrix',
argstr='-x1D %s')
x1d_stop = traits.Bool(
desc='stop running after writing .xmat.1D file',
argstr='-x1D_stop')
bucket = File(
desc='output statistics file',
argstr='-bucket %s')
jobs = traits.Int(
desc='run the program with given number of sub-processes',
argstr='-jobs %d')
stim_times_subtract = traits.Float(
desc='This option means to subtract \'SS\' 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_stimts = traits.Int(
desc='number of stimulus timing files',
argstr='-num_stimts %d')
num_glt = traits.Int(
desc='number of general linear tests (i.e., contrasts)',
argstr='-num_glt %d')
global_times = traits.Bool(
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',
argstr='-local_times',
xor=['global_times'])
fout = traits.Bool(
desc='output F-statistic for each stimulus',
argstr='-fout')
rout = traits.Bool(
desc='output the R^2 statistic for each stimulus',
argstr='-rout')
tout = traits.Bool(
desc='output the T-statistic for each stimulus',
argstr='-tout')
vout = traits.Bool(
desc='output the sample variance (MSE) for each stimulus',
argstr='-vout')
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 the k-th response model from a set of stimulus times'
' given in file \'tname\'.',
argstr='-stim_times %d %s %s')
stim_label = traits.List(
traits.Tuple(traits.Int(desc='k-th input stimulus'),
Str(desc='stimulus label')),
desc='label for kth input stimulus',
argstr='-stim_label %d %s',
requires=['stim_times'])
gltsym = traits.List(
Str(desc='symbolic general linear test'),
desc='general linear tests (i.e., contrasts) using symbolic '
'conventions',
argstr='-gltsym %s')
glt_labels = traits.List(
traits.Tuple(traits.Int(desc='k-th general linear test'),
Str(desc='GLT label')),
desc='general linear test (i.e., contrast) labels',
argstr='-glt_label %d %s',
requires=['glt_sym'])


class DeconvolveOutputSpec(TraitedSpec):
Expand All @@ -57,6 +182,7 @@ class Deconvolve(AFNICommand):
'3dDeconvolve -input functional.nii -bucket output.nii -x1D output.1D -stim_times 1 stims1.txt SPMG1(4) 2 stims2.txt SPMG2(4)'
>>> res = deconvolve.run() # doctest: +SKIP
"""

_cmd = '3dDeconvolve'
input_spec = DeconvolveInputSpec
output_spec = DeconvolveOutputSpec
Expand Down