Sunday, August 4, 2013

AFNI Command: 3dSynthesize (First Step on the Road Towards Glory)

Before we get into full-blown functional connectivity mode, we need to get acquainted with a command called 3dSynthesize. This will create a fitted time series based on selected regressors from your model, and will be used for subtracting out effects of no interest - that is, things like drift correction and motion regressors - so that the correlation we observe is protected from systematic differences in things like head motion, which can be particularly problematic in patient populations and children.

3dSynthesize requires a bucket dataset only containing coefficients from your model; therefore, you may need to go back and rerun 3dDeconvolve with the -cbucket option to make that magic happen. Once done, feed 3dSynthesize the coefficient bucket, the X matrix from 3dDeconvolve, and a selection of columns that you want for a fitted time series, e.g.:

3dSynthesize -prefix effectsNoInterest -cbucket CStats.FT+orig -matrix X.xmat.1D -select 0 1 2 3 4 5 6 7 8 9 10 11 14 15 16 17 18 19

The columns I've selected here are based on the dataset in AFNI_data6; obviously, yours will probably differ. The columns can be selected based on number, as above, or the actual label names, which can be retrieved from the X matrix with the grep command:

grep ColumnLabels X.xmat.1D

In any case, check the X matrix with either aiv or 1dplot to make sure that the columns you are extracting are indeed the effects that you want.

Hit the video for a brief demonstration, as well as a 30-second monologue to get you pumped up to use 3dSynthesize.


  1. how to do a 1dplot command to plot the whole matrix and see the regressors?

    1. Hey there,

      You should just be able to run a command like 1dplot -sepscl X.xmat.


  2. Hi Andrew,

    I am a beginner in FSL, for my research I need a time series of all voxels of brain fMRI image as a .im file.
    I have read lots of things about that but because of being short of knowledge in this area I could not do that and I got confused. would you please guide me about that.

    many thanks in advance

    1. Hi Narges,

      Can you be more specific about what you want? What do you mean by a time series of all voxels? Is it an average of all of them? Are you averaging over the whole brain, or over an ROI?

      If you need help with the basics, I'm available for tutoring over Skype. I can be reached at for more details.