Mrtrix version am i using?


I am trying to do segmentation I downloaded mrtrix3 obviously, but now my teacher told me mrtrix2 is better for segmentation and creating masks. So i downloaded and installed mrtrix2 (or so I think) and open it, problem is it (layout) looks exactly like mrtrix3. How do I know am I using mrtrix2 or 3 for sure?

Really…? What exactly did they mean by that? I’m pretty sure everything works better in MRtrix3, if there’s something that isn’t up to standard, please let us know so we can fix that - or more likely suggest a better way within MRtrix3.

Simply invoke the command with the -version option:

$ mrconvert -version 
== mrconvert 0.3.13-920-g45673184 ==
64 bit release version, built Apr  7 2016, using Eigen 3.2.8

And if you want a mixed workflow, I recommend you don’t add the MRtrix 0.2 folder to your PATH. That way you know that any command you invoke can only be the MRtrix3 version - unless you specifically asked for the MRtrix 0.2 version with something like this (assuming your MRtrix 0.2 installation is in ~/mrtrix2:

$ mrconvert DICOM DWI.mif                   # <- invokes MRtrix3 version
$ ~/mrtrix2/bin/mrconvert DICOM/ DWI.mif    # <- invokes MRtrix 0.2 version

If you’ve installed MRtrix 0.2 via e.g. NeuroDebian, and it’s therefore already in your default PATH, just make sure the MRtrix3 folder is listed first in your PATH - i.e. it would look something like:

$ echo $PATH

This means if the command exists within MRtrix3, that version will be used. Those commands that only exist in MRtrix 0.2 will also be directly accessible. Any MRtrix 0.2 commands you want to invoke directly can be accessed using the same trick as above, but since they’ll now reside in /usr/bin (most likely), you’d need to type:

$ /usr/bin/mrconvert ...

Again, you can always verify which version is actually invoked using the -version option. Another command that comes in handy is which: this tells you the exact location of the executable that would be invoked if you typed it, e.g.:

$ which mrconvert

This can be handy to figure out any issues with your PATH, etc.

Hey thanks a lot. Turned out when I tried to check which version of i am using and its 3.0. Also turns out the installation during mrtrix 2 went wrong. This is the error message I get. Its a mrtrix2 error. Not sure if you can help me with this as its a mrtrix 2 problem. But thanks again if i do get the mrtrix2 working I will use the trick you mentioned to overwrite mrtrix3.

Meanwhile this is the error I get during installation

The error is ‘permission denied’: this is because you’re trying to install into system locations (/usr/local/bin). You’ll need to run this as super-user (or preferably using sudo).

However, I recommend you don’t try to install system-wide. Keep it where it is, and either add the ~/mrtrix-0.2.12/bin folder to your PATH, or (my preference) just invoke the commands you need directly by providing their fully-resolved filename (e.g. ~/mrtrix-0.2.12/bin/mrconvert), which keeps your PATH clean and unambiguous: you can’t invoke MRtrix 0.2 commands by mistake that way.

But ultimately, what I’d really like to know is what operation you think works better in MRtrix 0.2…?

I am just trying to install turns out I havent installed mrtrix2 yet I am having trouble with “./build install” as it gives me the error I wrote above.

Can I just go as you said ~/mrtrix-0.2.12/bin/./build install according to your formula?


I switched to bin folder and now heres what it shows

-bash: ./build: No such file or directory

No, what I meant is you can issue a simple ./build to compile the executables - I assumed you’d already done this. The subsequent ./build install step merely copies these executables into a system-wide location - but there’s no need for them to be there for you to use them. You can just leave them where they are, and either add that location to your PATH (as is actually done for MRtrix3), or invoke the commands directly. In that last case, you just need to tell the system exactly where they are, since they’re not in the PATH. Does that make any more sense…?

OK now mrtrix3 is not loading, it was working before.

but Now its giving this error message

bash-3.2$ mrview
dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /usr/local/mrtrix/lib/libmrtrix-0_2_12.dylib
Reason: image not found
Trace/BPT trap: 5

WHat is happening???

I think mrtrix2 is overriding mrtrix3 but not sure.

OK I fixed it by typing this

Not sure how it works, but works,

same with fsl

I type some export command

and they work.

But neither fsl and mrtrix work by themselves. I have to type the commands I said above to make the programs start. Why is that? Why cant i jsut open termina> type cd mrtrix3 and mrview and it opens, but I need to type the commands.

I think the error you posted earlier is the problem:

bash: /Users/ssl/.bash_profile: line 58: unexpected EOF while looking for matching `''

Sounds like there is a typo in that file at the line specified - a missing "

OK cheers. Anyway back to the original topic, I have attached pictures of what I amm trying to segment. These are all ex vivo data.

The aims is to create a mask of the inner layer of the cortex.

And this is the result I get in mrtrix3.

I want to try to get a good contrast between grey and white matter (inner cortex) to be able to extract the white matter, I used the dwi2mask with the relevant gradient encoding file. As you can see no good.

Wonder if theres matlab programs on the net for segementation.

Wow. No, there’s nothing in any version of MRtrix that would allow you to do this automatically. In fact, given what your images look like, I’d be very surprised if there was anything out there that can do - maybe some atlas-based segmentation software dedicated for mouse imaging, but I don’t know of any. What is available in MRtrix is the ability to delineate ROIs manually - and the editor in MRtrix3 is now much better than it was in MRtrix 0.2. But I’ve no idea where your teacher would have got the impression that MRtrix 0.2 was better for segmentation - there was never anything within any version of MRtrix to do segmentation…

Hi so essentially I want to create a mask of the region inside the red area (and preferably automatically), so you are saying mrtrix3 wont be able to create this well. Is there any other programs like brain voyager etc. that can do the trick for me? can someone direct me to a program?


The only one I can think of right now is ITKsnap - it’s really handy to draw ROIs, but it’s still manual…

For clarity: dwi2mask is intended to derive a whole brain mask automatically. But even that process is difficult in the case of your images: the contrast between brain and background is quite poor (compared to typical human in vivo imaging), and there’s a strong bias field as well. To then derive a mask of just the inner cortex layer would be even more difficult, and would require an approach that incorporates some sort of prior information and is dedicated to that sort of task (e.g. template-based registration & segmentation), which we don’t currently have.