# 5ttgen gives empty mask image

**URL:** <https://community.mrtrix.org/t/5ttgen-gives-empty-mask-image/3560>\
**Category:** Uncategorized\
**Tags:** preprocessing, tractography\
**Created:** [April 23, 2020, 5:20pm UTC](https://community.mrtrix.org/t/5ttgen-gives-empty-mask-image/3560 "2020-04-23T17:20:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![apoorvakelkar](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/a/ba9def/32.png) [@apoorvakelkar](https://community.mrtrix.org/u/apoorvakelkar)\
**Post date:** [April 23, 2020, 5:20pm UTC](https://community.mrtrix.org/t/5ttgen-gives-empty-mask-image/3560/1 "2020-04-23T17:20:44Z")

</div>

Hi,

I am trying to run the 5ttgen fsl command to give as input to tckgen.  
I have a few subjects of my dataset which fail to generate the mask at the 5ttgen step so tckgen gives empty mask error

Here is my 5ttgen command:  
5ttgen fsl -nocrop -premasked $quiet -nthreads $mrtrixthreads $force -nocleanup $imputedimg 5tt.nii.gz

The imputedimg is an imputed T1w from my patient cohort.

For the unsuccessful cases, the orientation information was as follows:  
Orientation : PSR  
Primary Slice Direction: sagittal

However, I have a few other subjects with the same orientation information for which the 5ttgen ran successfully.

Could you please advise?

Thank you  
Best,  
Apoorva

---

<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:** [April 27, 2020, 8:42pm UTC](https://community.mrtrix.org/t/5ttgen-gives-empty-mask-image/3560/2 "2020-04-27T20:42:54Z")

</div>

I’m not sure, but this sounds [similar to this thread](https://community.mrtrix.org/t/5ttgen-output-act-mif-with-only-zeros-inside/1269). Maybe there’s some clues in there?

---

<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:** [May 3, 2020, 11:56am UTC](https://community.mrtrix.org/t/5ttgen-gives-empty-mask-image/3560/3 "2020-05-03T11:56:25Z")

</div>

If the discussion in the other thread happens to not provide an answer to your issue, you have already utilised the `-nocleanup` option, which is implemented precisely for this sort of use case. You can go into the scratch directory, look at the contents of file “`log.txt`” to see the order in which the various intermediate images were genreated, and manually load them in that order in order to determine the _first_ image that does not contain what it should; that then tells you which processing step led to the failure.

---

<div class="post-metadata">

**Author:** ![apoorvakelkar](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/a/ba9def/32.png) [@apoorvakelkar](https://community.mrtrix.org/u/apoorvakelkar)\
**Post date:** [May 4, 2020, 12:58pm UTC](https://community.mrtrix.org/t/5ttgen-gives-empty-mask-image/3560/4 "2020-05-04T12:58:33Z")

</div>

Hi,

Thank you so much for pointing me to the other thread. I tried the solutions suggested there, but it didn’t work.  
I will go through the intermediate files and the log more closely to try to understand where it’s exactly failing.

Thank you so much for your help once again.  
Best,  
Apoorva
