Displaying Results with Streamlines After Masking

Hello MRtrix Experts!

My question is about displaying results with streamlines (3D image from template derived tractogram) following fixelcfestats with the -mask option.

Below is the result from my original FBA without a mask. After I ran fixelcfestats, I did fixel2tsf stats_fdc/fwe_pvalue.mif tracks_200k_sift.tck fdc_fwe_pvalue.tsf and was able to easily see my results in 3D after thresholding. Below is an image from my original analysis with my streamline picture on the left and the fixel plot on the right.

I decided I wanted to try and mask out areas of CSF, so I re-did fixelcfestats with the mask option. When I look at my fixel plot, my results don’t look much different (which I expected). However, when I do fixel2tsf and display streamlines, it also seems like it just “thins out” the tractogram, and is not thresholding it by significance. Everything is the same between these two analyses except for the -mask option.

Thank you very much for your time,
Shannon

Hi Shannon,

I can’t envisage any software mechanism that could lead to a result like this. Unfortunately TSF files do not (yet) store provenance information, so we can’t check that; but it really needs to be verified that this is some sort of reproducible issue before we can pursue any further. Can you re-generate both TSF files, using the same commands in both cases, and still get the same results as shown in your posted screenshots? If so, you’ll probably need to provide adequate data for one of us to be able to reproduce ourselves.

Rob

Hi Rob,
Thank you so much for getting back. I re-ran fixelcfestats twice using all the same data: once using the mask option, one without the mask option. I then applied the same fixel2tsf function to both files, and I get the same “thinning out” streamline display for my mask results only. If you think the next best step is to provide you with all necessary files, could you please tell me the best way to get these to you?

Shannon

On second inspection, I have a hypothesis as to what might be causing the issue.

When fixelcfestats is used with the -mask option, fixels outside of the mask receive a value of NaN (Not a Number) in all derived fixel data files. This ensures that fixels outside of the mask do not contribute to any subsequent calculated statistics, and disappear immediately as soon as any thresholding is applied within mrview regardless of the threshold values, but fixel correspondence with the fixel directory used as the input to fixelcfestats is preserved.

However, both the .tck and .tsf formats rely on NaN values to delimit data between streamlines.

As such, if such non-finite values are sampled from the underlying fixels and placed into the TSF, this will ruin the correspondence between the track vertex data and track scalar data.

This issue was rectified here; but if your installed MRtrix3 version is sufficiently old to not contain that fix, you may be experiencing this issue. If that’s the case, you could either update MRtrix3, or you could replace the non-finite values in your fixel data file with 0.0 prior to sampling those values for constructing the TSF:

mrcalc fixeldata.mif nan 0.0 -replace fixeldata_nonans.mif

It would also be worth running the command tsfvalidate on your data; though I suspect that if your code is sufficiently old to suffer from this problem, you won’t actually have that command :man_shrugging:

If that’s not it, PM me and we can organise some data transfer.

Rob

Yes, it seems that it was just an issue of not having an updated version of MRtrix. The streamlines are displaying nicely now. Thanks for the help!