How to Install Freesurfer and FSL into your own workspace

Posted: June 15, 2010 in Basic UNIX tutorials, HOW-TO's

Environment variables are place holders where UNIX keeps important information. Programs such as FSL and Freesurfer use them extensively as they are very configurable and have endless uses. They are usually store as capital letters with a “$” attached to their front. For example, if you want to see what the “$FSL_DIR” variable holds, just type:

echo $FSL_DIR

This should show you what is in the variable. If it returns an error message, or an empty line, it is not defined! Not to worry though, as it is fairly simple to change them. How you change them, depends on which “shell” you are working in. So how do you find this out? Type:

echo “$SHELL”

It should return something like:

/bin/bash

The rest of this tutorial assumes you are using the “bash” shell. Most of the information your bash shell needs to work, is contained in the .profile script in your home directory. To tell Freesurfer and FSL where they are going to work, add the following to your .profile by typing:

Here is how to install fsl and freesurfer into your own home directory:

mkdir /SCRATCH4/cubic/YOURUSERNAME
cp -vr /SCRATCH4/cubic/freesurfer-Linux-centos4_x86_64-stable-pub-v4.5.0-full.tar.gz /SCRATCH4/cubic/YOURUSERNAME
cd /SCRATCH4/cubic/YOURUSERNAME
tar vxfz freesurfer-Linux-centos4_x86_64-stable-pub-v4.5.0-full.tar.gz
cp -vr /SCRATCH4/cubic/fsl-Linux-ubuntu_x86_64-CHPC.tar.gz .
tar vxfz fsl-Linux-ubuntu_x86_64-CHPC.tar.gz

emacs ~/.profile

Now copy/paste the following into the emacs window at the end of the file using either Ctrl-C Ctrl-V or highlighting the text and pressing the middle mouse button.

Remember to replace YOURUSERNAME with your own username!

FSLDIR=/SCRATCH4/cubic/YOURUSERNAME/fsl
source ${FSLDIR}/etc/fslconf/fsl.sh
PATH=${FSLDIR}/bin:${PATH}

export FSLDIR PATH
export FREESURFER_HOME=/SCRATCH4/cubic/YOURUSERNAME/freesurfer
source $FREESURFER_HOME/SetUpFreeSurfer.sh

To save in emacs, press Ctrl-X Ctrl-S, then to exit press Ctrl-X Ctrl-C.

To make your life easier, should you choose to use emacs as your editor, at these lines to the .emacs file by typing:

emacs ~/.emacs

… and paste the following at the end of the file:

(setq-default auto-fill-function ‘do-auto-fill)
(global-font-lock-mode 1)

To check if you have done everything correctly, type:
. ~/.profile
The following should appear on your screen:

——– freesurfer-Linux-centos4_x86_64-stable-pub-v4.5.0 ——–
Setting up environment for FreeSurfer/FS-FAST (and FSL)
FREESURFER_HOME /SCRATCH4/cubic/YOURUSERNAME/freesurfer
FSFAST_HOME /SCRATCH4/cubic/YOURUSERNAME/freesurfer/fsfast
FSF_OUTPUT_FORMAT nii
SUBJECTS_DIR /SCRATCH4/cubic/YOURUSERNAME/freesurfer/subjects
MNI_DIR /SCRATCH4/cubic/YOURUSERNAME/freesurfer/mni
FSL_DIR /SCRATCH4/cubic/YOURUSERNAME/fsl

Advertisements
Comments
  1. […] Next you must setup your “enviroment variables.” To do this, follow this link: How to Install Freesurfer> […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s