FreeSurfer
Prerequisites¶
- You will be required to obtain a license (it's free) from http://surfer.nmr.mgh.harvard.edu/registration.html
- Once obtained, save it as license.txt ( original filename ) and save it anywhere in the filesystem. ( ideally, home or project directory)
Slurm template to run FreeSurfer¶
- FreeSurfer container/s is/are stored in
/opt/nesi/container/FreeSurfer
( this is an image pulled from https://hub.docker.com/r/freesurfer/freesurfer) - We provide a sample dataset which can be used for a test run. This is stored in
/opt/nesi/container/FreeSurfer/data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
# Set up FreeSurfer environment variables
export SUBJECTS_DIR=$PWD/subjects_dir
mkdir -p $SUBJECTS_DIR
# Path to your FreeSurfer license file
export FS_LICENSE=${PWD}/license.txt
SUBJECTS_DIR
: This environment variable tells FreeSurfer where to store and find subject data. In this script, it's set to a directory named "subjects_dir" in the current working directory.FS_LICENSE
: FreeSurfer requires a license file to run. This environment variable points to that file, which in this case is expected to be in the current working directory.
Apptainer Options
exec
: Runs a command within the container--env VARIABLE=VALUE
: Passes environment variables into the container- Both
SUBJECTS_DIR
andFS_LICENSE
are passed so FreeSurfer knows where to find subjects and the license
- Both
--bind SOURCE:DESTINATION
: Mounts a directory from the host into the container- Three bind mounts are used:
- The subjects directory
- The directory containing the input data
- The directory containing the license file
- The
$(dirname $PATH)
syntax extracts the directory portion of a file path
- Three bind mounts are used: