5ttgen fsl ERROR - Solved

Dear mrtrix developers,

While trying to run 5ttgen in a HCP subject (100307) I ran into the following issue:

5ttgen fsl ERROR: only 0 of 10 structures were segmented successfully

By searching the error on the forum, I discovered a post, which guided me to look into the error files. One of the files contained the following error:

Image Exception : #22 :: ERROR: Could not open image first_all_none_origsegs

Following this new error I ended up in another post which provided no solution to my problem.

By taking a closer look to the log files, I discovered that mrtrix was running fsl5.0-fast, located in /usr/bin/fsl5.0-fast. The interesting thing is that my FSLDIR is actually pointing somewhere else

> which fsl5.0-fast
/usr/bin/fsl5.0-fast
> echo $FSLDIR
/data/u_gallardo_software/fsl
> which fast
/data/u_gallardo_software/fsl/bin/fast

Turns out, that mrtrix was calling some probably obsolete binaries installed by default in all the PCs of the institute, instead of using my own FSL installation.

By digging into the code of 5ttgen, I found that in fsl.py the following ‘if’:

if find_executable('fsl5.0-' + name):
    output = 'fsl5.0-' + name

was causing the whole problem. In this case, mrtrix is finding that, effectively, fsl5.0-fast exists and therefore, it just completely overlooks the fast binary in my FSLPATH.

All my problems were solved by removing such if from the code. This is, 5ttgen correctly finished without any errors after mrtrix was able to locate the correct version of fast.

I will open an issue in github, but I also wanted to let this here, so other members in the community can find it and maybe fix any similar problems. It is rather common to find default installations of FSL in many research institutions.

Best Regards,
Guillermo Gallardo.