# 5ttgen freesurfer output not usable

**URL:** <https://community.mrtrix.org/t/5ttgen-freesurfer-output-not-usable/4344>\
**Category:** Uncategorized\
**Created:** [December 2, 2020, 9:21am UTC](https://community.mrtrix.org/t/5ttgen-freesurfer-output-not-usable/4344 "2020-12-02T09:21:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Caroline](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/c/ba8739/32.png) [@Caroline](https://community.mrtrix.org/u/Caroline)\
**Post date:** [December 2, 2020, 9:21am UTC](https://community.mrtrix.org/t/5ttgen-freesurfer-output-not-usable/4344/1 "2020-12-02T09:21:07Z")

</div>

Hi,  
I checked a lot and did not find any response, I hope you did not answer this question before.  
I used the normal downloaded Mrtrix for all preprocessings, and I installed the Version 3Tissue\_v5.2.8-2 to use the ss3t\_csd\_beta1 function. It seems to work well.  
But after I used the 5ttgen with freesurfer option on a t1 image. I have no error message. But with the Version 3Tissue\_v5.2.8-2 I obtained like points everywhere in the brain for the 5 volumes instead of the 5 categories volumes. So I force the script to use the 5ttgen from the old version of Mrtrix (as for the preprocessings). I worked, no errors and looks nice, when I opened it with fsleyes.  
But, when I want to use this image for the next steps (5tt2gmwmi or tckgen with -act 5ttgenoutput) I have this error:  
terminate called after throwing an instance of ‘std::bad\_alloc’  
what(): std::bad\_alloc

If I use tckgen without the 5ttgen output it works. If I want to open the 5ttgenoutput with mrview it failed with the same error as before:  
terminate called after throwing an instance of ‘std::bad\_alloc’  
what(): std::bad\_alloc  
Abandon (core dumped)

if I want to convert the 5ttgen output with mri\_convert to have a nii.gz image, I have this error:  
Cannot allocate memory  
error: znzTAGskip: tag=-2, failed to calloc 9 bytes!

so for me it is a problem with the 5ttgen output, but I have no more idea to fix that. Could you help me?

have a nice day,

all the best and thank you,  
Caroline

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [December 2, 2020, 9:24am UTC](https://community.mrtrix.org/t/5ttgen-freesurfer-output-not-usable/4344/2 "2020-12-02T09:24:44Z")

</div>

Hi Caroline,

Unfortunately, we don’t provide support for this version, [as stated in this post](https://community.mrtrix.org/t/error-from-dwi2response/2818/5). However, if you can install the [latest release version of MRtrix3](https://www.mrtrix.org/download/) and reproduce the error, we’ll be more than happy to take a look and try to figure it out 👍

Thanks!  
Donald.

---

<div class="post-metadata">

**Author:** ![Caroline](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/c/ba8739/32.png) [@Caroline](https://community.mrtrix.org/u/Caroline)\
**Post date:** [December 2, 2020, 10:42am UTC](https://community.mrtrix.org/t/5ttgen-freesurfer-output-not-usable/4344/3 "2020-12-02T10:42:59Z")

</div>

Hi Donald,

thank you for your quick answer!  
I used the latest version of Mrtrix for all preprocessings, I will then remove the Version 3Tissue\_v5.2.8-2 to perform the 5ttgen, there is may be a conflict somewhere (I used the path from the last version- not the fork one - to perform the 5ttgen function).  
Have a nice day and thank you,

Caroline

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [December 10, 2020, 2:13pm UTC](https://community.mrtrix.org/t/5ttgen-freesurfer-output-not-usable/4344/4 "2020-12-10T14:13:06Z")

</div>

Hi Caroline,

It looks like you have encountered an issue that I found myself and that has been [addressed](https://github.com/MRtrix3/mrtrix3/pull/2216) on the _MRtrix3_ `master` branch, but that has not yet been incorporated into a tagged _MRtrix3_ update.

However if I’m correct about that, then you should in fact be able to proceed without making any modification to your installed software. All you have to do is _not write_ any image in MGH or MGZ format using any _MRtrix3_ command. As long as you only use MGH / MGZ images generated by FreeSurfer as image _inputs_, and anything being generated by _MRtrix3_ uses some other image format as output, you should be OK.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![Caroline](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/c/ba8739/32.png) [@Caroline](https://community.mrtrix.org/u/Caroline)\
**Post date:** [December 11, 2020, 8:43am UTC](https://community.mrtrix.org/t/5ttgen-freesurfer-output-not-usable/4344/5 "2020-12-11T08:43:06Z")

</div>

Hi Rob,

thank you very much for your answer! That comforts me in the procedure I followed. Well, I found the same idea to fix the problem. I kept the results.mif (nice results, everything correct) by using the -nocleanup option for 5ttgen, and it worked! So, I used this results.mif for the following steps instead of the .mgz output.

Have a nice day,

all the best,  
Caroline
