5ttgen Error

Dear Experts,
I already checked the forum for same error messages but could not find any solution.
So when I run 5ttgen I got following error message:

FSL FIRST has failed; not all structures were segmented successfully

When I check the log file it says the following:

Cannot open volume first-L_Accu_corr for reading!
Image Exception : #22 :: ERROR: Could not open image first_all_none_firstseg

Strangely the 5ttgen command works fine with some of my data.
All my data has been on the same way preprocessed and created in a directory of same structure.
I also started running just the fsl run_first_all command and it works fine. I also could run fsl_anat command.
It seemed to be a problem with the coregistered T1 images. The T1 is for all measurements the same, I just did a coregistration (6 rigid transform FLIRT) between the T1 and each DWI as recommended before running 5ttgen. Last I took the unregistered T1 and repeated 5ttgen. It worked!
I really dont know why because when I checked via mrinfo/mrview both T1 seemed to be ok.

Thank you for any kind of help
Best
Max

Hi Max,

Here is the post that you’re looking for. Note in particular the effects of T1 co-registration if you use flirt & are not fully aware of its default behaviour. Another topic that I really need to add to the documentation FAQs… :crazy_face:

Rob

1 Like

Dear Rob,
thank you for your help,
I checked out the post and did it the way you suggested: first I transformed the flirt_trafo.mat via transformconvert to mtrix_trafo.txt and then I applied via mrtransform the transformation to my T1. When viewing the results everything looks good to me. But when I compare the inputs of the matrices (flirt_trafo.mat and mrtrix_trafo.txt) they slightly differ from each other. I guess although the matrices are not the same they do the same job in the end or are the results incorrect then?
Here the matrices:

mrtrix:
0.999928258585556 -0.00179227576370166 -0.0118482326670557 -2.34805592992597
0.00212362345003817 0.999605329869771 0.0280128311094757 -1.59255629536604
0.0117933496769622 -0.0280359811373596 0.999537370169424 -8.79857663443265
0 0 0 1

fsl:
0.9999281434 -0.002123623205 -0.01179334855 38.4919582
0.001792275695 0.9996052859 -0.02803597963 24.78287935
0.0118482318 0.02801282988 0.9995373165 -51.18039925
0 0 0 1

Another question relates to the mrtransform command. While I have been reading some other post http://community.mrtrix.org/t/beginner-connectome-pipeline-updated/373/7 relating to this topic I was wondering about the -inverse option which all other user turned on? But why should I apply an inverse transform to my T1 in that case? Sorry but I am a bit confused right now, I guess I just misunderstood something easy, because I just applied the mrtrix-trafo without the -inverse option on and it works well.
Thank you I really appreciate your help!
Best
Max

Hi Max,

But when I compare the inputs of the matrices (flirt_trafo.mat and mrtrix_trafo.txt) they slightly differ from each other.

Yep, that’s the whole point of the transformconvert call. It’s not just changing the file type extension from .mat to .txt (which would be kinda boring): first and MRtrix3 define their affine transformation matrices with respect to different coordinate conventions, and hence an explicit matrix conversion operation is required. If you apply the flirt_trafo.mat transformation to your image via mrtransform, i.e. skip the transformconvert step, it should be quite clear that that would indeed be an incorrect result.

… I was wondering about the -inverse option which all other user turned on?

A single affine transformation matrix intrinsically defines a transformation from image 1 to image 2. If you were to apply that same transformation to image 2, it would move further away from image 1. The goal of the -inverse option is to invert the transformation before applying it, such that a transform estimated to move image 1 to image 2 can instead be applied to image 2 to move it to image 1. So usage or non-usage of this option depends on both which option you are applying the transformation to, and which order the two images were provided in when the registration was performed.

Rob

1 Like

Okay, now I understand!
Again thank you so much for your help!
Best
Max