MGH Install

This information is very old...most machines where this stuff were installed are gone...still, it is a lot of information, so I'd hate to just delete it when it might be useful to someone, somewhere.  Dianne Patterson 10/25/2006

The new MGH Software package includes several components: the fsfast tools, afni, fsl and freesurfer (note: freesurfer does not require matlab at all. The fsfast tools require only the basic matlab (no toolboxes required). It is freely available for download as several tar files. Portions of the MGH software require Matlab. The package is a work in progress, runs only on linux and requires considerable perseverance to install and run.


Below I chronicle of installation for the March 4, 2002 distribution of fsa.tar.gz and associated tar files (the minc and talairach files). Because the package is changing rapidly, I cannot vouch for these as a set of instructions that will solve problems for different distributions or different machines. However, I hope they may provide some useful leads for troubleshooting.

We set up the fsa tools on Redhat Linux 7.2 (full installation of the OS). We had Matlab 6.0 installed, a 900 Mhz Duron processor, 256 mb of PC 133 RAM, and a 20 gb hard drive.

We had people with decent unix troubleshooting skills and a user who knew what the tools should do. This combination of skills was pretty crucial to successful setup.

To set up the tools on a Redhat distribution later than 6.1, you need two c-libraries that are not included (at least in the RH7.2 distribution). These are and libc-5.3.12-31.i386.rpm. We installed fsa.tar.gz (the main distribution, including fsl, afni, fsfast tools and freesurfer), minc.tar.gz (the minc tools--minc is a file format), the bert data (3 big tar files) and talairach.tar.gz (see Download the Distribution). We also needed an up-to-date license file (see License and Registration Form), as some older license files fail with the newer distribution of the mgh tools. You'll need about 1 gb for fsa and the talairach files, and ~1/2 gb for the bert data and ~80 mb for the minc directory.

  1. Begin by untarring fsa.tar.gz. It will create a directory freesurfer_alpha.
  2. Under freesurfer_alpha, you will find a subdirectory, "subjects". It will be empty. You should put talairach.tar.gz into the subjects direcory and untar it. If you wish, untar the 3 bert tar files here as well.
  3. Put the minc.tar.gz directory in /usr and untar it there. It will create a subdirectory pubsw. Find perl (a language) on your system (i.e., type >whereis perl or >which perl) ...Perl is pretty commonly installed to support all kinds of stuff. Because many of the minc tools are perl scripts, they need to be able to find the copy of perl on your machine. These scripts are written to expect perl to be in /usr/pubsw/bin. We found we didn't even have a bin directory under pubsw, so we created it, cd'd to it, and made a link to our machine's copy of the perl language:
    >ln -s /usr/bin/perl perl
  4. fsa.tar.gz contained distributions for all supported operating systems....we removed directories for SunOS, Solaris and IRIX wherever we found them. This is not necessary, but certainly saves some space.
  5. You must set up paths for Matlab. The install instructions included with the distribution give directions for older versions of Matlab. For our 6.0 version, simply start the Matlab gui as root and choose file-->set path. We set the path to the two places we found matlab files, e.g., /data/freesurfer_alpha/afni and /data/freesurfer_alpha/fsfast-20020304/toolbox.
  6. When you run func2tal or func2tal-sess, there is a bug in stat_normalize which causes it to write a warning over and over again to a log file...creating a huge log file and potentially filling the available space. You must get the corrected binary for your OS if you wish to use func2tal.
  7. In the main freesurfer_alpha directory, we found and modified three script files that set up environment variables for the system. The three files we modified were: a) FreeSurferDefs.csh, b) FreeSurferEnv.csh and c) nmr-std-env
    • In FreeSurferDefs.csh we set CSURF_DIR (e.g., we modified an line near the top of the script to point to our copy of freesurfer: setenv CSURF_DIR /data/freesurfer_alpha).
    • Similarly, in nmr-std-env we set FREESURFER_HOME, SUBJECTS_DIR, FSFAST_HOME and MINC_DIR to point to the correct directories on our machine for each of those (e.g., FREESURFER_HOME is /data/freesurfer_alpha; SUBJECTS_DIR is /data/freesurfer_alpha/subjects etc.).
    • Note that there are "working paths" defined in the nmr-std-env and FreeSurferEnv.csh and they seem to overwrite the path in our .cshrc when the scripts are sourced. One can add to these paths without doing any apparent harm.
  8. We found that we could not run the FSL tools because the MGH scripts all setenv to FSL_DIR, whereas the FSL scripts assumed the environment variable FSLDIR. The line setenv FSLDIR $FSL_DIR seems to have solved that problem.
  9. To set all this up, one must set environment variables, source FreeSurferDefs.csh and nmr-std-env. To save individual users the hassle, we created a simple file, mgh.csh in the freesurfer_alpha directory. This file sets the environment variables and sources whatever is necessary. Users simply source this one file and it takes care of everthing.

    setenv FREESURFER_HOME /data/freesurfer_alpha
    source $FREESURFER_HOME/FreeSurferDefs.csh
    source $FREESURFER_HOME/nmr-std-env
    setenv FSLDIR $FSL_DIR

    You can even create an alias in your .cshrc so the users only have to type a single simple command to set everything up (this has been done on charlie for all users):
    alias mgh 'source /data/freesurfer_alpha/mgh.csh'

  10. Talairach Link: In addition, if the user's subjects are in a different directory than the standard subjects directory, then they need to create a link from their subject directory (cd to that directory and create the link) to the talairach directory, e.g
  11. >ln -s /data/freesurfer_alpha/subjects/talairach talairach

    Before they actually run the MGH programs, they should reset the subjects dir to their subject dir, e.g.

    >setenv SUBJECTS_DIR /data/video

    (User-specific stuff like the subjects dir can be added to the user's .cshrc as part of the alias that sets up the mgh environment, if that is more convenient. So, our users merely type mgh when they are ready to work with the programs, and everything, including their subject directory, is set up.)

  12. It is a good idea to try to start fsl (>fsl) and afni (>afni) and freesurfer (>csurf) after you think you have this stuff set up.
  13. Paths: We added paths to fsl and afni to the .cshrc files...this should allow access to programs like afni without sourcing all the mgh stuff.