Skip to content

Use MrTrix with vistasoft

Hiromasa Takemura edited this page Jan 30, 2016 · 15 revisions

This page describes how to use MrTrix with vistasoft.

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 MRTrix examples on local data.

We often use MRtrix along with the [http://white.stanford.edu/~brian/papers/mri/2014-Life-Pestilli-Wandell.pdf Linear Fascicle Evaluation (LiFE) technology]. We describe how to run LiFE .

= Install MRtrix =

If you are running Ubuntu, mrtrix is part of the neurodebian command set. You should check to see that the [http://neuro.debian.net/# neurodebian repo] is installed, and then use that to install the mrtrix package.

MRtrix can also be downloaded from [https://www.nitrc.org/projects/mrtrix/ this site].

There is a github repository for the [https://github.com/jdtournier/mrtrix3 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)" == "azure.stanford.edu" ]; 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)" == "peach.stanford.edu" ]; 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 else export PATH=/usr/lib/mrtrix/bin:$PATH fi

*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 [http://www.nitrc.org/projects/mrtrix/ NITRC].

*If you are lucky enough to be running Ubuntu, you can simply install the [http://neuro.debian.net/# neurodebian repo] and install the mrtrix package through that. *There is a WINDOWS exe, which you can download from [http://www.nitrc.org/projects/mrtrix/ 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

'''Build'''

Unpack archive and compile:

tar xjf mrtrix-0.2.9.tar.bz2

cd mrtrix-0.2.9/ ./build

'''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 /&lt;edit as appropriate&gt;/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 [http://www.brain.org.au/software/mrtrix/install/unix.html MRtrix documentation] for more info.

= Running the program =

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

mrview

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

Clone this wiki locally