Using Freesurfer

FreeSurfer is a software package for the analysis and visualization of structural and functional neuroimaging data from cross-sectional or longitudinal studies. It is developed by the Laboratory for Computational Neuroimaging at the Athinoula A. Martinos Center for Biomedical Imaging. FreeSurfer is the structural MRI analysis software of choice for the Human Connectome Project. See for more info.

Audience: Faculty, Guests, Researchers and Staff

This KB Article References:
This Information is Intended for: Faculty, Guests, Researchers, Staff
Last Updated: October 13, 2017

Current Version

While only parts of Freesurfer 6.0.0 are parallelized, we have found optimal performance within a single node using 28 cores. A basic overview of a Freesurfer workload can be found here:

These steps have been modified for use on SeaWulf with a sample batch submission script available in /gpfs/projects/samples/freesurfer.

FreeSurfer Examples

First make a new directory and copy the example pbs script and data file from the samples folder:

module load freesurfer/6.0.0

mkdir -p $HOME/freesurfer_example
cp * $HOME/freesurfer_example && cd $_

Then load the torque module and submit the job script to the scheduler:

module load torque/6.0.2
qsub freesurfer.pbs

The submission script, freesurfer.pbs, converts the sample file sample-001.mgz to nifti format and performs a full recon-all on the file.


#PBS -j oe
#PBS -l nodes=1:ppn=28,walltime=48:00:00
#PBS -N freesurfer_example2
#PBS -q long

module load freesurfer/6.0.0

cd $HOME/freesurfer_example


mri_convert sample-001.mgz sample-001.nii.gz

recon-all -openmp 28 -i sample-001.nii.gz -s bert -all > out.txt

After completion a directory called bert/mri and bert/surf should have been created containing the results. Along with these directories a file, out.txt, should contain a record of the job.

Visualizing the Results

After completion the results can be visualized through an interactive job and the freeview  command:

module load torque/6.0.2

qsub -I -X -l nodes=1:ppn=28,walltime=08:00:00 -q long

module load freesurfer/6.0.0

cd $HOME/freesurfer_example

freeview -v \
    bert/mri/T1.mgz \
    bert/mri/wm.mgz \
    bert/mri/brainmask.mgz \
    bert/mri/aseg.mgz:colormap=lut:opacity=0.2 \
    -f \
    bert/surf/lh.white:edgecolor=blue \
    bert/surf/lh.pial:edgecolor=red \
    bert/surf/rh.white:edgecolor=blue \

Additional Information

There are no additional resources available for this article.

Getting Help

The Division of Information Technology provides support on all of our services. If you require assistance please submit a support ticket through the IT Service Management system.

Submit A Ticket

Supported By