In order for Freesurfer to work, the followings environment variables need to be set:
$ export FREESURFER_HOME=/apps/freesurfer $ source $FREESURFER_HOME/SetUpFreeSurfer.sh
$ setenv FREESURFER_HOME /apps/freesurfer $ source $FREESURFER_HOME/SetUpFreeSurfer.csh
In fact, you are going to have to grab the SetUpFreeSurfer script and copy it to your home directory so that it can be modified, as we do not have space in the installation area of the software for you to copy your image files to.
It is recommended that you copy your image files over to /scratch/ufhpc/$username and work on the files there, as that is where the fastest filesystem is located.
Optional Configuration Settings
The defaults declared in the SetUpFreeSurfer.csh script should work for most installations. However, users should feel free to edit this file to customize certain environment variables:
1. Your declaration of the FREESURFER_HOME variable could be moved within the SetUpFreeSurfer.csh script.
2. The default SUBJECTS_DIR, which is $FREESURFER_HOME/subjects, is most likely the first variable that you will want to customize, as you may keep different groups of subjects in different directories. You may include the following either directly in the SetUpFreeSurfer.csh script, or prior to calling it:
setenv SUBJECTS_DIR <full path to subject dir>
3. If you do NOT intend to use the functional tools, then add the following line to the additional configuration section:
If you do intend to use the functional tools, then add these lines to your ~/matlab/startup.m file:
fsfasthome = getenv('FSFAST_HOME'); fsfasttoolbox = sprintf('%s/toolbox',fsfasthome); path(path,fsfasttoolbox);
4. You may also wish to declare a path to an FSL installation you might have:
setenv FSL_DIR /usr/local/fsl
5. Save the file. You will need to source this file (SetUpFreeSurfer.csh) every time you want to use Freesurfer.
Sample PBS Job Script
#!/bin/tcsh -f # #PBS -N freesurfer #PBS -r n #PBS -o dnet.out #PBS -e dnet.err #PBS -j oe #PBS -m abe #PBS -M <email address> #PBS -q firstname.lastname@example.org #PBS -l nodes=1:ppn=1 #PBS -l pmem=400mb setenv FREESURFER_HOME /apps/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.csh setenv EXE /apps/freesurfer/bin/recon-all $EXE -s bert -all