Jump to: navigation, search

MRtrix is a set of tools to perform diffusion-weighted MR white-matter tractography in a manner robust to crossing fibers, using constrained spherical deconvolution (CSD) and probabilistic streamlines. This page describes how to install and use this package with our Fedora machines and data in the VISTA laboratory.

Elsewhere, we describe how to run MRtrix on local data.

We often use MRtrix along with the Linear Fascicle Evaluation (LiFE) technology. We describe how to run LiFE on a separate page .


Install MRtrix

If you are running Ubuntu, mrtrix is part of the neurodebian command set. You should check to see that the neurodebian repo is installed, and then use that to install the mrtrix package.

MRtrix can also be downloaded from this site.

There is a github repository for the developmental versions.

See Michael Perry about dockerization.

VistaLab users can simply add the MRtrix direcotry to their bash path in bashrc.

 # For MRTRIX 
if [ "$(hostname)" == "" ]; then
    export PATH=/white/local/mrtrix/v0.2.7/bin:$PATH
    export LD_LIBRARY_PATH=/white/local/mrtrix/v0.2.7/lib:$LD_LIBRARY_PATH
elif [ "$(hostname)" == "" ]; then
    export PATH=/white/local/mrtrix/v0.2.10/bin:$PATH
    export LD_LIBRARY_PATH=/white/local/mrtrix/v0.2.10/lib:$LD_LIBRARY_PATH
    export PATH=/usr/lib/mrtrix/bin:$PATH
  • Note that azure will only run v2.7 while peach runs v2.10. All other machines run the up-to-date Neurodebian version.
  • If you're using Fedora 12 use the following line instead of the one just above
  export PATH=/white/local/mrtrix/v0.2.10_fc12/bin:$PATH
 export LD_LIBRARY_PATH=/white/local/mrtrix/v0.2.10_fc12/lib/

Build MRtrix

If you would prefer to download/build/configure the latest version of MRtrix for your machine, keep reading...

Download:: The tar-ball can be downloaded from NITRC.

  • If you are lucky enough to be running Ubuntu, you can simply install the neurodebian repo and install the mrtrix package through that.
  • There is a WINDOWS exe, which you can download from NITRC.

Install required Libs: Before you can build the program for linux you need to install some libraries:

  • g++ - the GNU C++ compiler (version > 4.0.0 recommended)
  • python (version > 2.5 recommended)
  • glib (version > 2.16)
  • gtk+ (version > 2.12)
  • glibmm (version > 2.16)
  • gtkmm (version > 2.12)
  • gtkglext (version > 1.0)
  • GSL (GNU Scientific Library; version > 1.8)
  • OpenGL implementation (version > 1.2)

On 64-bit Fedora you can install these packages using the following command (if you don't have sudo on your machine, find someone who does):

 sudo yum install glibmm24.x86_64 gtkmm24.x86_64 glib.x86_64 glib2-devel.x86_64 glib2.x86_64 gtkmm-utils.x86_64 gtkmm24-devel.x86_64 gtkglext-devel.x86_64 gtkglext-libs.x86_64 gtkglextmm-devel.x86_64 gtkglextmm.x86_64 gsl-devel.x86_64 gsl.x86_64 compat-libstdc++-33.x86_64 libstdc++-devel.x86_64 libstdc++.x86_64


Unpack archive and compile:

   tar xjf mrtrix-0.2.9.tar.bz2
  cd mrtrix-0.2.9/

Set the Path in .bashrc:

Set appropriate environment variables:

Bash shell:

   export PATH=/<edit as appropriate>/mrtrix-0.2.9/bin:$PATH
  export LD_LIBRARY_PATH=/<edit as appropriate>/mrtrix-0.2.9/lib

C shell:

   setenv PATH /<edit as appropriate>/mrtrix-0.2.9/bin:$PATH
  setenv LD_LIBRARY_PATH /<edit as appropriate>/mrtrix-0.2.9/lib
  • Note: You have to open a new shell before these changes will take effect.

Enable Multi-Threading

By default MRtrix will read a configuration file for additional options. Among those options is Multi-Threading.
The configuration file (.mrtrix.conf) should be stored in your home directory.

Run the following command in your shell to enable the multi-threading option in MRtrix - you can adjust the number of threads as you like.

 echo "NumberOfThreads: 4" > $HOME/.mrtrix.conf

Setting the number of threads to a large value (e.g., 130) will use all the available cores on the current machine without crashing. See the MRtrix documentation for more info.

Running the program

To check that you can run MRtrix (ie that the install went ok) try:


If you get a window, relax, everything worked out just fine.

Personal tools