Creating ROI masks from the output of fixelcfestats?

Hello experts, I am trying to figure out the best way to extract mean fc, fd, and fdc from a pvalue-based ROI, across each subject in my study. For example, say I wanted to plot the association between Age and mean fdc in voxels that differ significantly between groups. Basically, what I want to do is:

  1. Figure out the best way to threshold/convert the outputprefix_fwe_pvalue.msf file as a mask containing p values greater than .95 (inverse of .05)
  2. extract the mean fdc across this ROI for each subject’s (converted?) fdc.msf image, and store/print it somewhere for external analyses

Thanks for your time,

1 Like

Hi Rachael,
We are working on a large update to be released soon. It will include additional features to do what you want.

I started writing a reply with instructions on how you can get access to the new tools sooner (it’s in the fixel_format branch on Github) and what commands you need to run to do what you want. However it was getting quite lengthy and I didn’t get time to finish it today. I’ll finish it off first thing in the morning.


I appreciate your taking the time to leave a note! Sounds like the next update is going to be really exciting.

Hi Rachael,
Sorry it just occurred to me you can do what you want with the existing fixelthreshold and fixelstats commands.

To compute a fixel mask of p < 0.05:

fixelthreshold fwe_pvalue.msf 0.05 significance_mask.msf

Then to estimate the mean value inside this mask:

fixelstats subject1_fdc.msf  -mask significance_mask.msf -output mean

Sorry about the delay in getting back to you. I completely forgot I had implemented fixelstats. I have been working on a different branch of MRtrix for a while now that does not have it. In the upcoming release the commands for working on fixel files are somewhat different (and more flexible), however for your existing study that has *.msf files this will do what you need.

Thanks! Just to be clear, does fixelthreshold want the regular p-value or the inverse pvalue? Based on the documentation, I thought it would be:

fixelthreshold fwe_pvalue.msf 0.95 significance_mask.msf

Ah yes. Sorry, my mistake.

Hi Dave,

It looks like both fixelthreshold and fixelstats are deprecated in the latest updates–I can’t seem to accomplish this same task (making a mask based on significant fixels) using mrthreshold. Any suggestions?



Many fixel* commands are deprecated with the new fixel format. This is because each fixel data file is simply an image file (albeit a one-dimensional “image”), and therefore many of the MRtrix3 commands “intended” for working with image data (e.g. mrthreshold, mrstats) work seamlessly with fixel data files. This saves us the effort of duplicating & managing the same functionality across multiple commands just because they operate on different data.

Using mrthreshold directly on the FWE p-value image / file should achieve the same purpose. I suspect your error is that it looks as though from your previous usage:

fixelthreshold fwe_pvalue.msf 0.95 significance_mask.msf

, fixelthreshold took the threshold value as a compulsory command-line argument. mrthreshold simply takes the input and output “images” as the compulsory command-line arguments, and automatically calculates an appropriate threshold (which won’t work for fixel data files); so most likely you want to use the -abs option to manually specify the absolute threshold value. Therefore your usage would be:

mrthreshold fwe_pvalue.mif significance_mask.mif -abs 0.95


I’ve been playing around with creating masks for different levels of significance for FDC (e.g. p < 0.05, 0.04, 0.03, 0.02, 0.01).


tck2fixel TOM_trackings/CST_left.tck TOM_trackings/ TOM_trackings/ CST_left.mif
mrthreshold CST_left.mif -abs 0.5 CST_left_mask.mif
mrthreshold stats_fdc/fwe_1mpvalue_t1.mif stats_fdc/t1_significance_mask.mif -abs 0.95
mrthreshold CST_left.mif -abs 0.95 CST_left_mask.mif

Then using mrstats on the masks to determine what percentage of the tract is significantly different between two groups. (mean output value)

mrstats CST_left_mask.mif -mask t1_significance_mask.mif

I assumed that the percentage of each tract showing significant fixels would decrease as the significance level decreased (going from 0.05 to 0.01, say).

But in fact, for the pipeline above, many tracts show an increase in the % significant fixels.

I wondered if anyone had thoughts as to what is going on here? I think I must be doing something wrong.

I think I’ve solved the issue… the two masks were the wrong way around in the mrstats command. I think.