Registration Issue - Preprocessing Functional


We are trying to preprocess our data and have completed the resting state pipeline. There seems to be something wrong during the registration process which we noticed when we tried to QC the results.

We are running the following for motion correction:

echo "Processing functional for ${subj}… "

echo "Motion correction..."
cd ${subjectsDirectory}/${subj}/rest
mkdir motion
3dvolreg -zpad 4 -tshift 0 -base 90 \
	-1Dmatrix_save motion/${subj}_vr -nomaxdisp -1Dfile motion/${subj}_vr_motion.1D \
	-prefix ${subj}_resting_moco.nii.gz rest.nii.gz[/b]

For registration, we are running the following:

echo "Coregistering EPI to anatomical..."
cd ${subjectsDirectory}/${subj}/rest

3dcalc -a ${subj}_resting_moco.nii.gz'[0]' -prefix coreg_slice.nii.gz -expr "a"
flirt -ref ${subjectsDirectory}/${subj}/anat/${subj}_anat_biascorr_brain.nii.gz -in coreg_slice.nii.gz -out coreg_slice_e2a.nii.gz -omat epi2anat.1D -cost corratio -dof 6 -interp trilinear[/b]

Any suggestions on why our generated files are shifted?

Please advise.

Thank you!


AFNI’s 3dvolreg is typically used to estimate subject motion in time during the collection of EPI volumes. One picks a particular volume in time (specified through its index, from 0 to N-1, if N is the total number of time points), and that is the argument for the ‘-base …’ option here. So, your command shows the volume with index 90 has been selected.

The 3dcalc command below selects out one particular volume from the input EPI time series— the index 0 volume—and uses just that to create a new dataset. 3dcalc is an AFNI program. In this case, you have selected the volume from what should be the motion corrected output from 3dvolreg, so each of those output volumes should theoretically be in the same place in space.

Finally, FSL’s flirt command was used, which is typically for affine registration of an EPI volume to a subject’s volume. NB: that is a program from different software, and I don’t know its details very well or best options for use. If the output of this is the registration process you were referring to, I don’t really know what to advise, because I don’t know the program options well enough.

One thing I would typically recommend is using the same ‘-base …’ volume in 3dvolreg that you use to align to the anatomical (here, different volumes are selected—0th and 90th, respectively). However, that doesn’t sound like the issue here.

I don’t know what the rest of the processing pipeline looks like, but it would be quite useful to estimate each transformation step individually, and then concatenate the transforms when they are all known, and apply that single transform to the original data—otherwise, it will get a little blurred by each new regridding along the way. Perhaps you are doing this already. But I would encourage you to consider using to set up your processing: it handles important details like that for users, allowing them to focus on the “higher level” options (like which template to use, how much blurring to apply, what kind of regressors to use, whether to bandpass or not, etc.) instead of the internal scripting details. There are several help examples for both task and resting state FMRI processing, see the helpfile here: