Getting Started

Add mrTools to your matlab path

At the Matlab prompt, type


Where folderWhereYouInstalled should be replaced with the name of the folder in which you have downloaded the svn or cvs repository.

Quick overview

The best way to get started using MLR is to go through the Retinotopy Tutorial. In the tutorial you will learn the basic steps of setting up an MLR session which are as follows:

  1. Make the directory structure for MLR.
    1. Anatomy contains the inplane and any other anatomy file used by MLR.
    2. Raw/TSeries contains the epi images of each scan.
    3. Etc Contains supplementary files like stimulus timing files.
  2. Run mrInit or mrInitRet.
  3. Run mrAlign and align your inplane anatomy to your “canonical” volume anatomy. Then align your epi images to the inplane anatomy and export to mrLoadRet-4.5.

Note: To run mrTools, you need the following MATLAB toolboxes: Optimization, Statistics and Image Processing.

Compiling MEX files

MEX files (Matlab C code) for several functions are pre-compiled to improve performance – you should not need to do anything if you want to use them on the following platforms: MacIntel (.mexmaci), PowerPC Mac (.mexmac) and 64-bit Linux (.mexa64). The following is a list of the mex files used in MLR:

  • mrAlign/regHistogram.c
  • mrUtilities/ImageProcessing/myCinterp3.c
  • mrUtilities/MatlabUtilities/mrDisp.c
  • mrUtilities/mrFlatMesh/assignToNearest.c
  • mrUtilities/mrFlatMesh/dijkstra.cpp

If you have trouble with any of these functions, you may want to recompile them. This can be done by calling the function mlrMake (which will try to remake all .c and .cpp files in the mrTools repository). This can also be done by cd'ing to the directory where the function lives, and typing (e.g.):

mex mrDisp.c

Note that to compile these functions on a Mac you will need to have Xcode installed on your computer. On other platforms you will need to have the gcc compiler.

If compilation fails it may be because we use some c++ syntax in the files (comments that begin with // and variables not declared at the top of functions) and gcc is interpreting the .c file as ANSI c. You can override the ANSI c compilation and force a c++ compilation on most systems by doing:

mex CC=g++ mrDisp.c

If you need to re-compile any mex functions for a 64bit platform, here are some things you should watch out for:

  • to compile MEX files (usually .c or .cpp) on Matlab version 7.3 and later, you should make sure you have GCC version 4.0 or later installed. Some *nix distributions still have GCC3.3, which will not work
  • if the c/c++ code includes sparse matrix operations (like e.g. dijkstra.cpp) you should be aware that The Mathworks has changed indeces into these matrices from type int to mwIndex
  • to make use of larger array sizes allowed by 64 bits you need to compile the mex files with the option -largeArrayDims , e.g.
>> mex -largeArrayDims dijkstra.cpp

Printing this manual

If you wish to print out this manual, you can view it as a single page and print from there.

Compatibility with latest MAC OS and Matlab versions

We stay reasonably up-to-date with OS and Matlab versions. As of this writing (12/08/2014) we are using mrTools on Mac OS 10.9.5 and Matlab 8.2 on 64 bit.

Note, at this time (12/8/2014) Yosemite and Matlab (particularly older versions) do not play well together. There are some patches, but we are staying away until Mathworks cleans things up.

Mailing List

If you want to subscribe to an email list which will make (very infrequent) announcements about major changes to mrTools, you can do so from Note that this is a moderated email list to which you will not be able to make posts, only receive announcements.