3. Installation - Stereo-Boy/Pipeline_AS GitHub Wiki

Pipeline_JAS

Freesurfer v5.3

  • Download it from http://freesurfer.net/fswiki/DownloadAndInstall. Because of its size, downloading gave me trouble so I recommend to use the command line in a terminal:

    curl -O ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.3.0/freesurfer-Darwin-lion-stable-pub-v5.3.0.dmg
    
  • Install with the steps here: https://surfer.nmr.mgh.harvard.edu/fswiki/MacOsInstall (install xquartz if necessary - you do not need to source the freesurfer environment because we will make it automatic with bash_profile and matlab startup files)

  • Open the writing rights for yourself to the folder (replacing applications with your path to freesurfer) /Applications/freesurfer/subjects

MRIcroGL

This is necessary to get functions like dcn2niix for pre-processing.

  • Download here (be very careful to scroll down the correct mac files in the menu – not the source – in the screens that will follow each other, otherwise it won’t work- if you are correct; your folder should contain a executable dcm2niix and an executable MRIcroGL).

SPM 12

Download it here. This is useful for precise automatic alignment and other neat functions.

FSL v5

  • Get the fslinstaller.py from http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation

  • Open a terminal, move the path to the function and run: sudo python fslinstaller.py. When it asks where to install it, leave the default (user/local/fsl/). You may need to install xQuartz.

  • If after installation, you do not have FSL configuration infos inyour /etc/bashrc, i run this in a terminal:

    editDate=’/bin/date +%Y%m%d’

    editTime=$(date +%k%M)

    sudo tee -a /etc/bashrc >/dev/null <<EOF

    #------------------------------------------

    # on ${editDate} at ${editTime}, $USER

    # added some FSL setup:

    FSLDIR=/usr/local/fsl

    PATH=\${FSLDIR}/bin:\${PATH} export FSLDIR PATH . \${FSLDIR}/etc/fslconf/fsl.sh

    #------------------------------------------

    EOF

    cat /etc/bashrc

Update the matlab path

Add the path (using addpath, for example) to Freesurfer, pipeline_AS, spm, MRIcroGL and FSL. Make sure your user folder is higher in the path. In matlabrc.m, matlab first loads on top its own libraries. We want ours to be on top, otherwise it will generate tons of errors because the 2014b version use functions having the same names as vistasoft functions. Therefore, I strongly recommend to download the startup_template.m file in Pipeline_AS/configuration folder, rename it startup.m and drop it in ~/Documents/MATLAB, and edit with your paths. That way, it will be loaded at each matlab startup. The file also sources the FSL and Freesurfer environments. It is important that the pipeline_AS folder is added on top of vistasoft folder in path.

Update the bash_profile

The .bash_profile is a file loaded when you open your terminal, it defines the search path for it. We will use the terminal through matlab so you want to do the following:

  • I recommend copying the .bash_profile (file hidden in configuration folder) to your home folder (finder> go to> ~), after correcting the paths to your programs. If you cannot see hidden files, use the command in a terminal:

            defaults write com.apple.finder AppleShowAllFiles 
    
  • Open a terminal and see what are the errors to correct

Update the matlab intern file

To command the terminal from matlab, you need to add something special in it.

  • Go to Finder>Applications>[your version of matlab program]

  • Ctr+click on it to allow showing its content

  • Go to /bin/matlab and open this file in TextEdit

  • In a terminal, show your path and copy it (for that, write echo $PATH )

  • At the beginning of the matlab file, after #!/bin/sh, copy these lines not commented (replacing the path you copied from the terminal, in the first line, removing the β€œ ):

     export PATH=${PATH}:paste/your/path/here/
     . /usr/local/fsl/etc/fslconf/fsl.sh
     export FSLDIR=usr/local/fsl 
    

Make sure there is a space between the dot and the rest

  • if you cannot edit it, open it using the terminal with command:

     sudo -b /Applications/TextEdit.app/Contents/MacOS/TextEdit /Applications/MATLAB_R2014a.app/bin/matlab
    
  • If you still cannot edit it after executing the command above, then Ctr+click on the matlab /bin/ folder and select 'Get Info.' On the window that opens, click on the lock symbol in the bottom right hand corner to unlock the Sharing and Permissions. Change the Priviliges to 'Read & Write' for all accounts.

  • Save matlab file

  • Try to execute Matlab without error