Skip to main content

AFNI class 6//2016:

Quick Note on afni_proc.py

You can set put your regression in after building as below, one nice afni_proc.py feature is the use of 1d_tool.py to build censors.

-regress_censor_motion 0.3 [.3mm motion max]
-regress_censor_outliers 0.1 [10% volume max]
-regress_censor_first_trs 3 [remove first 3]
-regress_censor_extern CENSOR.1D -regress_opts_3dD OPTS ... : specify extra options for 3dDeconvolve

3dDeconvolve: time series linear regression
3dNLfim: time series non-linear regression
3dREMLfit : removes temporal autocorrelation from time series regression
3dLSS
: useful as a lead into 3dsvm

3dsvm
: AFNI does multivoxel pattern analysis (MVPA)

3dDeconvolve command-line-arguments ... See bottom of page for 3 examples.

-input fname fname = filename of 3D+time input dataset
-input1D dname dname = filename of single (fMRI) .1D time series
-TR_1D tr1d tr1d = TR for .1D time series [default 1.0 sec].
-mask mname mname = filename of 3D mask dataset
-automask Build a mask automatically from input data; some masking done as default. -censor cname cname = filename of censor .1D time series
-CENSORTR clist clist = list of strings that specify time indexes
-concat rname rname = filename for list of concatenated runs Or '1D: 0 100 200 300'
-nfirst fnum fnum = trims front; number of first dataset image [default = max maxlag]
-nlast lnum lnum = end trim; number of last dataset image [default = last point]
-polort pnum pnum = degree of polynomial to regress out [A=automatic]
-singvals Print out the matrix singular values
-GOFORIT [g] Use this to proceed even if the matrix has
-allzero_OK Don't error all zero matrix columns
-num_stimts num num = number of input stimulus time series

Inputting regressors (k is enumeration of stimli):

Traditional pre wavered:

-stim_file k sname sname = filename of kth time series input stimulus

-stim_label k slabel slabel = label for kth input stimulus
-stim_nptr k p p = number of stimulus function points per TR

Modeled in deconvolution [Preferred]:

-stim_times k tname Rmodel is the general format
-stim_times_AM1 k tname Rmodel provides mean amplitude
-stim_times_AM2 k tname Rmodel provies mean and difference from mean; preferred model in most instances
-stim_times_FSL k tname Rmodel 3 column [s d p] s=start, d=duration, p=peak [afni dislikes]
-stim_times_IM k tname Rmodel individually modulated

Picking a Rmodel please note:

ALWAYS convolved: BLOCK dmBLOCK MION MIONN
NEVER convolved: TENT CSPLIN POLY SIN EXPR
OPTIONALLY convolved: GAM SPMGx WAV

Rmodel details:

'BLOCK(d,p)' d=duration p=amplitude (default=1)
'dmUBLOCK(q)' q = norm at time point
'TENT(b,c,n)' n = samples in time range, b= start, c=end
'CSPLIN(b,c,n)' as above different wave form
'TENTzero' and 'CSPLINzero' forces HRF to be zero at t=b and t=c
'GAM(p,q,[d])' p=8.6 q=0.547 if only 'GAM' is used; d = an optional duration of stimulus
'SPMG1([d])' 1 parameter SPM gamma variate basis function; d= optional duration of stimulus
'SPMG2([d])' 2 parameter SPM: gamma variate + d/dt derivative; d= optional duration of stimulus
'SPMG3([d])' 3 parameter SPM basis function set; d= optional duration of stimulus
'POLY(b,c,n)' n = number of polynomials, b= start, c=end
'SIN(b,c,n)' n = number of sine waves, b= start, c=end
'WAV(d)' same as waver (cox) d= duration can add;
'WAV(d,2,4,6,0.2,2)' with delay time , rise time , fall time , undershoot fraction, undershoot restore time
'EXPR(b,c) exp1 ... expn' b= start, c=end
'MION(d)' d = duration, a gamma with a long tail
'MIONN(d)' d = duration, a gamma with a long tail; flipped to address negative betas

Note on stim files:

Can be a binary stim list by TR, can be a wavered stim list by TR, can be made of the fly : '1D: 3.2 7.9 | 8.2 16.2 23.7' ['|' = run cat point][doesn’t work with stim_times_*]

-basis_normall a norm all to following singular peak

-TR_times dt change dt for response functions

GLTs:

-num_glt num num = number of general linear tests (GLTs)
-glt_label k glabel glabel = label for kth general linear test
-gltsym gltname Read the GLT with symbolic names from the file or ‘SYM: ….’

Output stats:

-fout f stat
-rout R^2
-tout t stat
-vout variance
-bout Flag to turn on output of baseline coefs and stats.
-nofull_first Flag to specify that full model statistics go last

Output BRIKS:

-bucket bprefix big output file
-iresp k iprefix iprefix = output brik of response function for kth labeled stim
-sresp k sprefix sprefix = output brik of SD function for kth labeled stim
-fitts fprefix fprefix = output brik of R (from regression)
-errts eprefix eprefix = outpu of error

Files:

-xsave Flag to save X matrix into file bprefix.xsave
-xrestore f.xsave so you can add new glts [other commands ignored
-short Write output as scaled shorts [default=float]
-jobs J J = number of processors

Testing things out:

-nodata [NT [TR]] Evaluate experimental design only (no input data) NT=reps, TR=TR sec

Examples:

No data: nodata

Traditional: Traditional

Using R model: Rmodel