Index of /examples/imaging/freesurfer

Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [   ] intro2fs.pptx 27-Jun-2018 17:35 4.8M [   ] recon-all.qsub 09-Nov-2018 13:06 1.1K [   ] freesurfer_commands 15-Feb-2019 14:18 1.4K

RCS FreeSurfer Usage and Examples


FreeSurfer Software Suite is an open source software suite for processing and analyzing (human) brain MRI images. FreeSurfer applications include: Skullstripping, Image Regisitration, Subcortical Segmentation, Cortical Surface Reconstruction, Cortical Segmentatoin, Cortical Thickness Estimation, Longitudinal Processing, fMRI Analysis, Tractography, FreeView Visualization GUI, and much more!

This page is designed to show users how to submit batch jobs on the SCC for the FreeSurfer reconstruction application recon-all and how to access the FreeView GUI for viewing/editing brains. For further instructions on FreeSurfer processing pipelines, please see the tutorial materials on the Developer Site.

Developer Site:

Usage Notes

FreeSurfer versions 4.5, 5.1, 5.3, and 6.0 are available on SCC and scc-lite through BU ENG-IT software distribution. Batch processing is only accessible on SCC (not scc-lite). The FreeView GUI works best when using VNC with OpenGL on SCC (details below).


Recon-all performs all, or any part of, the FreeSurfer cortical reconstruction process. In order to call recon-all on multiple subjects in parallel on SCC, a starter script recon-all.qsub has been provided and should be called as:

[clarkdc@scc1:scv]$ qsub recon-all.qsub sessid

where sessid is a text file containing a list of subject IDs:

[clarkdc@scc1:scv]$ cat sessid

Please make sure to open recon-all.qsub and edit your Project (line 5), number of subjects (line 21), and SUBJECTS_DIR (line 28) before submitting.

[clarkdc@scc1:scv]$ vim recon-all.qsub
1 #!/bin/bash -l
4 # Set SCC project
5 #$ -P scv
7 # Request a node with minimum 4 GB of memory per core as recommended by freesurfer
8 #$ -l mem_per_core=4G
10 # Send an email when the job finishes or if it is aborted (by default no email is sent).
11 #$ -m ea
13 # Give job a name
14 #$ -N recon-all
16 # Combine output and error files into a single file
17 #$ -j y
20 # Submit an array job with N tasks
21 #$ -t 1-2
23 # Load desired version of freesurfer
24 module load freesurfer/6.0
27 # Set environment variables
28 export SUBJECTS_DIR=/usr3/bustaff/clarkdc/freesurfer/SUBJECTS_DIR/

Note: This script calls recon-all from FreeSurfer 6.0. In order to change versions, please change the module load freesurfer/6.0 command to the appropriate version.


  1. Create a VNC Password
  2. If you have not used VNC on SCC, you must create a password.

    [clarkdc@scc1:scv]$ vncpasswd

  3. Create a VNC with OpenGL Session
  4. From SCC, run the "qvgl" command to create VNC with OpenGL session. Read the instructions and take special note of the command printed under "on your local workstation run:" to be run in the next step.

    [clarkdc@scc1:scv]$ qvgl

    Waiting for immediate job to be scheduled. on your local workstation run: ssh -L XXXX:localhost:5911 then execute vncviewer to connect to localhost port XXXX vncviewer localhost:XXXX to run an OpenGL application on a hardware GPU use vglrun command for example: vglrun glxinfo to quit the job please run: qdel 2105135

  5. Forward the VNC Port
  6. From a local computer, open a new terminal and setup port forwarding for the hostname and port advertised in the VirtualGL session info. Note that for the local port, I have choosen port 7000 in place of "XXXX".

    [clarkdc@IST-RC-WL-0009:~]$ ssh -L 7000:localhost:5911

  7. Open VNC with OpenGL Session
  8. From your local computer, use a VNC client to connect to the forwarded port. Use the password you created with "vncpasswd" in step 1 as the password. The image below is "MobaXterm VNC" on Windows, but any standard client should work with similar settings.


  9. Launch FreeView
  10. In the VNC window, open "Terminal", load the FreeSurfer module to set up the FreeSurfer environment, and use vglrun to run FreeView.
    "Terminal" can be found in Applications > System Tools > Terminal

    [clarkdc@scc-v03:~]$ module load freesurfer/6.0
    [clarkdc@scc-v03:~]$ vglrun freeview


  11. Close The Session
  12. Close everything and disconnect the VNC client.

  13. Terminate the VNC Session
  14. Terminate the VNC session when finshed, as described in the vnc session info from step 2. The job number was displayed in the initial qvgl request but can also be found with the username command.

    [clarkd@scc1:~]$ qdel 2105135


Document written by Dustin Clark on 10/13/2017. Last modified on 10/13/2017.

Note: Research Computing Services (RCS) example programs are provided "as is" without any warranty of any kind. The user assumes the entire risk of quality, performance, and repair of any defects. You are encouraged to copy and modify any of the given examples for your own use.