Differences between revisions 18 and 19
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The [[https://surfer.nmr.mgh.harvard.edu/fswiki/BrainstemSubstructures|brainstem]] and [[https://surfer.nmr.mgh.harvard.edu/fswiki/HippocampalSubfields|hippocampal subfield]] modules in FreeSurfer 6.0 and the development version require the Matlab R2012b (v8.0) runtime (note that development versions from January 2018 onwards require the Matlab R2014b - v8.4 - runtime instead). This runtime is free, and therefore '''NO MATLAB LICENSES ARE REQUIRED TO USE THESE PACKAGES'''. A few freesurfer modules, like fsfast and the subfield/nuclei segmentation tools, require the matlab runtime package (MCR). The MCR allows users to run distributed matlab-compiled programs '''without paying for a matlab license'''. The freesurfer command `fs_install_mcr` can be used to install this package. MCR version requirements are as follows.
Line 5: Line 5:
The runtime is installed as follows (note that some commands might require root permissions - i.e., prepend them by '''sudo''' - if FreeSurfer is installed in a system directory such as /usr/local/): '''To download the runtime for FS version 7''', please install MCR 8.4 (R2014b) by running:
Line 7: Line 7:
 * First, we will define the environment variable FREESURFER_HOME the same way as above. For example, in tcsh or csh:
Line 9: Line 8:
setenv FREESURFER_HOME /usr/local/freesurfer
}}}
Or, in bash:
{{{
export FREESURFER_HOME=/usr/local/freesurfer
fs_install_mcr R2014b
Line 16: Line 11:
 * Second, change directory to your FreeSurfer directory: '''To download the runtime for FS version 6''', please install MCR 8.0 (R2012b) by running:
Line 18: Line 14:
cd $FREESURFER_HOME fs_install_mcr R2012b
Line 21: Line 17:
 * Next, download the runtime as follows: '''NOTE:''' If the `fs_install_mcr` script is not available in your freesurfer distribution, it can be download by running the following command:
Line 23: Line 19:
In linux, for FreeSurfer 6.0 or development versions from 2017:
Line 25: Line 20:
curl "https://surfer.nmr.mgh.harvard.edu/fswiki/MatlabRuntime?action=AttachFile&do=get&target=runtime2012bLinux.tar.gz" -o "runtime.tar.gz"
}}}
or for development versions from January 2018 onwards:
{{{
curl "https://surfer.nmr.mgh.harvard.edu/fswiki/MatlabRuntime?action=AttachFile&do=get&target=runtime2014bLinux.tar.gz" -o "runtime.tar.gz"
}}}
or for Matlab v8.3 (for FSFAST):
{{{
curl "https://surfer.nmr.mgh.harvard.edu/pub/dist/mcr/MCRv83_linux.tar.gz" -o "runtime.tar.gz"
cd $FREESURFER_HOME/bin && curl https://raw.githubusercontent.com/freesurfer/freesurfer/dev/scripts/fs_install_mcr -o fs_install_mcr && chmod +x fs_install_mcr
Line 36: Line 23:
In MAC, for FreeSurfer 6.0 or development versions from 2017: === If the programs produce missing library errors... ===

If any of the matlab binaries error due to missing system libraries, try ensuring that the following are installed on your system.

 * on ubuntu: {{{apt-get -y install libxt-dev}}}
 * on centos: {{{yum -y install libXt libXext ncurses-compat-libs}}}

=== If you already have matlab installed... ===

If you already have matlab 2012b/2014b installed on your system, you do not need to install the runtime. Keep in mind that the matlab version must match the freesurfer requirement defined above. All you need to do is create a symbolic link named MCRv80/MCRv84 in your FreeSurfer directory that points to the main matlab install directory. The matlab root directory can be easily obtained by executing the matlab command {{{matlabroot}}}. It typically looks like {{{/Applications/MATLAB_R2014b.app}}} in OSX and "/usr/local/matlab/8.4" in Linux. For example, if you already have matlab 2014b, just run the following to make it visible to freesurfer:
Line 38: Line 35:
curl "https://surfer.nmr.mgh.harvard.edu/fswiki/MatlabRuntime?action=AttachFile&do=get&target=runtime2012bMAC.tar.gz" -o "runtime.tar.gz" cd <FreeSurferRootDirectory> && ln -s <MatlabRootDirectory> MCRv84
Line 40: Line 37:
or for development versions from January 2018 onwards:
{{{
curl "https://surfer.nmr.mgh.harvard.edu/fswiki/MatlabRuntime?action=AttachFile&do=get&target=runtime2014bMAC.tar.gz" -o "runtime.tar.gz"
}}}

 * Finally, unpack it with:
{{{
tar xvf runtime.tar.gz
}}}

You are now done! The brainstem and/or hippocampal subfield modules should now work fine. If that is the case, you can delete the packed runtime file with:
{{{
rm $FREESURFER_HOME/runtime.tar.gz
}}}


=== Frequently asked questions (FAQ) ===

 * '''I already have Matlab 2012b/2014b installed on my system. Do I really need to download and install the runtime?'''

If you already have the right version of Matlab installed on your system, there is no need to dowload the runtime. '''Note that it has to be the specific version of Matlab, depending on your FreeSurfer version: Matlab R2012b for FreeSurfer 6.0 or dev versions from 2017, and Matlab R2014b for dev versions from 2018 on'''; if you do not have the exact version installed, you need to download the runtime as described above. If it is indeed 2012b/2014b, all you need to do is to create a symbolic link named MCRv80/MCRv84 in your FreeSurfer directory that points to the main Matlab directory.

First, we will define the environment variable FREESURFER_HOME. In tcsh or csh:
{{{
setenv FREESURFER_HOME /usr/local/freesurfer
}}}
Or, in bash:
{{{
export FREESURFER_HOME=/usr/local/freesurfer
}}}

Second, change directory to your FreeSurfer directory:
{{{
cd $FREESURFER_HOME
}}}

Finally, create the symbolic link. For FreeSurfer 6.0 and dev versions from 2017:
{{{
ln -s <MatlabRootDirectory> ./MCRv80
}}}
And, for dev versions from 2018:
{{{
ln -s <MatlabRootDirectory> ./MCRv84
}}}
The matlab root directory can be easily obtained by executing the command "matlabroot" in Matlab. It typically looks like "/Applications/MATLAB_R201Xb.app/" in MAC, and "/usr/local/matlab/8.X" in Linux.

Matlab Runtime

A few freesurfer modules, like fsfast and the subfield/nuclei segmentation tools, require the matlab runtime package (MCR). The MCR allows users to run distributed matlab-compiled programs without paying for a matlab license. The freesurfer command fs_install_mcr can be used to install this package. MCR version requirements are as follows.

To download the runtime for FS version 7, please install MCR 8.4 (R2014b) by running:

fs_install_mcr R2014b

To download the runtime for FS version 6, please install MCR 8.0 (R2012b) by running:

fs_install_mcr R2012b

NOTE: If the fs_install_mcr script is not available in your freesurfer distribution, it can be download by running the following command:

cd $FREESURFER_HOME/bin && curl https://raw.githubusercontent.com/freesurfer/freesurfer/dev/scripts/fs_install_mcr -o fs_install_mcr && chmod +x fs_install_mcr

If the programs produce missing library errors...

If any of the matlab binaries error due to missing system libraries, try ensuring that the following are installed on your system.

  • on ubuntu: apt-get -y install libxt-dev

  • on centos: yum -y install libXt libXext ncurses-compat-libs

If you already have matlab installed...

If you already have matlab 2012b/2014b installed on your system, you do not need to install the runtime. Keep in mind that the matlab version must match the freesurfer requirement defined above. All you need to do is create a symbolic link named MCRv80/MCRv84 in your FreeSurfer directory that points to the main matlab install directory. The matlab root directory can be easily obtained by executing the matlab command matlabroot. It typically looks like /Applications/MATLAB_R2014b.app in OSX and "/usr/local/matlab/8.4" in Linux. For example, if you already have matlab 2014b, just run the following to make it visible to freesurfer:

cd <FreeSurferRootDirectory> && ln -s <MatlabRootDirectory> MCRv84

MatlabRuntime (last edited 2021-03-06 11:56:05 by AndrewHoopes)