Main Content Region



FreeSurfer is a set of automated tools for the reconstruction of the brain's cortical surface from structural MRI data, and overlay of functional MRI data onto the ronconstructed surface.

FreeSurfer at TCHPC

Before running FreeSurfer on our TCHPC clusters, please become familiar with the methods for connecting to our systems, and for transferring files.

Loading the FreeSurfer Environment

A module file has been created to set up your environment for FreeSurfer

module load tcin freesurfer

The latest version is currently freesurfer/6.0.

The SUBJECTS_DIR variable

FreeSurfer requires a special environment variable to tell it where the subject data is kept. This may be different for each user, and can be set with the following command :

export SUBJECTS_DIR=[path to your subjects]

For example

export SUBJECTS_DIR=/home/users/neil/freesurfer/my_subjects

Batch analysis

For lengthy and intensive analysis it is preferable to use the batch submission system. This will add your analysis job to the queue, and when the resources are available, the job will be executed on a dedicated cluster node. You will receive an email update on the job status.

Each job will require a 'batch' submission file. An example is given here for the batch submission of a FreeSurfer job :

# -- Request ONE node in the cluster

# -- Request a node in the 'compute' partition
#SBATCH -p compute

# -- Request 96 hours of time
#SBATCH -t 96:00:00

# -- Give the job a name for identification
#SBATCCH -J FS_Subject_1

# -- Optional: Ask for an email at beginning and end of job
#SBATCH --mail-type ALL

# -- Optional: Send the email to 
#SBATCH --mail-user your@email.address

# -- Now we can run the commands we would like.
# -- Set the SUBJECTS_DIR variable
export SUBJECTS_DIR=/home/trhpc/neil/freesurfer/my_subjects/

# -- Load the correct modules
. /etc/profile.d/ 
module load tcin freesurfer

# -- Run the FreeSurfer job
# -- In this example, subject 'bert', all recon stages.
recon-all -subjid bert -autorecon-all

Save this file as

Submit the job to the queue with the following command :


Your job is now in the queue and will run when the necessary resources are available. You will receive an email when the job starts, and again on completion.

Job output

Each job submitted to the batch queue is given an ID number. The output from the job will be placed in a file named slurm-NNN.out (where NNN is the job ID).