Index of /examples/imaging/freesurfer

Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [   ] scc-recon-all.qsub 13-Oct-2017 16:34 1.2K

RCS FreeSurfer Usage and Examples

Overview

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: https://surfer.nmr.mgh.harvard.edu/

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

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 scc-recon-all.qsub has been provided and should be called as:

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

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

[clarkdc@scc1:scv]$ cat sessid
subject_001
subject_002
subject_003

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

[clarkdc@scc1:scv]$ vim scc-recon-all.qsub
1 #!/bin/bash -l
2
3 #<-- MANDATORY USER EDIT HERE -->
4 # Set SCC project
5 #$ -P scv
6
7 # Specify hard time limit for the job. 
8 #   The job will be aborted if it runs longer than this time.
9 #   The default time is 12 hours
10 #$ -l h_rt=15:00:00
11
12 # Request a node with minimum 4 GB of memory per core as recommended by freesurfer
13 #$ -l mem_per_core=4G
14
15 # Send an email when the job finishes or if it is aborted (by default no email is sent).
16 #$ -m ea
17
18 # Give job a name
19 #$ -N recon-all
20
21 # Combine output and error files into a single file
22 #$ -j y
23
24 #<-- MANDATORY USER EDIT HERE -->
25 # Submit an array job with N tasks
26 #$ -t 1-2
27
28 # Load desired version of freesurfer
29 module load freesurfer/6.0
30
31 # <--- MANDATORY USER EDIT HERE --->
32 # Set environment variables
33 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.

FreeView

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

    [clarkdc@scc1:scv]$ vncpasswd
    Password:
    Verify:

  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 clarkdc@scc-v03.bu.edu -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 clarkdc@scc-v03.bu.edu -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.

    mobaxterm_vnc



  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
    


    freeview_qvgl

  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


BU RCS: help@scc.bu.edu


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.