FreeSurfer
Freesurfer is a surface-based fMRI processing and analysis package written for the Unix environment (including Mac OS X, which is based on Unix). The neuroanatomical organization of the brain has the grey matter on the outside surface of the cortex. Aside from the ventral/medial subcortical structures, the interior volume of the brain is predominately white matter axonal tracts. Because neurons metabolize in the cell body, rather than along the axons, we can focus on the grey matter found in the cortical surface because any fMRI signal changes detected in the white matter should theoretically be noise. This is the motivation for surface-based analyses of fMRI.
Freesurfer has a rigid set of assumptions concerning how the input data is organized and labeled. The following instructions will help avoid any violations of these assumptions that might derail your Freesurfer fMRI processing pipeline.
These instructions assume that Freesurfer has already been installed and configured on your workstation.
Organization
Freesurfer data for a collection of subjects is organized into a single project directory, called $SUBJECTS_DIR. Try this in the Linux terminal:
echo $SUBJECTS_DIR
It is likely that you will see something like the following, which is the sample 'bert' dataset that comes with a Freesurfer installation:
/usr/local/freesurfer/subjects
Let us assume that you have been collecting data for some lexical decision task experiment. All the data for all subjects should be stored in a single directory, which you will set as your $SUBJECTS_DIR variable. For example, if we keep all our data in ~/ubfs/cpmcnorg/openfmri/LDT, then we would type the following:
SUBJECTS_DIR=~/~/ubfs/cpmcnorg/openfmri/LDT
Subject directory organization
Data for each subject should be kept in their own directory. Moreover, different types of data (i.e., anatomical/structural or bold/functional) are kept in separate subdirectories. Assuming your raw data are in the .nii format, the basic directory structure for each participant ('session' in Freesurfer terminology) looks like this:
- SUBJECTS_DIR
- Subject_001
- mri
- orig.nii
- bold
- 001/f.nii
- 002/f.nii
- 003/f.nii
- etc.
- mri
- Subject_002
- mri
- orig.nii
- bold
- 001/f.nii
- 002/f.nii
- 003/f.nii
- etc.
- mri
- Subject_001
Note that all the functional data (in the 'bold' subdirectory) are stored in sequentially numbered folders (3-digits), and all are called 'f.nii'. This seems to be a requirement. It may be possible to circumvent this requirement, but this is a relatively minor concern at this time.
Structural Preprocessing
The structural mri file (orig.nii) is transformed over a series of computationally-intensive steps invoked by the recon-all Freesurfer program. Recon-all is designed to execute all the steps in series without intervention, however in practice it seems preferable to execute the process in a series of smaller groups of steps and check the output in between. This is because the process is automated using computational algorithms, but if one step doesn't execute correctly, everything that follows will be compromised. The steps take many hours to complete, so by inspecting the progress along the way can save many hours of processing time redoing steps that had been done incorrectly.
The first thing that you will need to do is convert the orig.nii file to .mgz format using Slicer. Though Freesurfer is capable of reading .nii files, it natively uses .mgz files, and so this conversion step will ensure that the structural data file has all the information that Freesurfer expects.