Mrthreshold fixelmask problem

Dear MRtrix experts,

I’m trying to use mrthreshold to create a fixelmask (by thresholding a fixel -non binarized-image), as suggested here (Remove fixels with value 0 from fixelmask). However, mrthreshold seems to be misbehaving.

I execute the following

mrthreshold -abs 0.5 fixelmask_non_bin.mif fixelmask.mif -force

but this seems to have no effect. My fixelmask has the same number of fixels than before thresholding and it doesn’t threshold appropriately (see below)

$ mrinfo fixelmask_non_bin.mif -size
1726175 1 1
$ mrinfo fixelmask.mif -size
1726175 1 1

fixelmask_non_bin:
image
fixelmask: after running mrthreshold
image

Could this be related to the mrtrix version I’m using? I updated recently (Feb 5 2019) (see below) and I’m afraid this version might not be as stable, since with previous MRtrix versions the same mrthreshold command was working fine in the same PC.

$ mrconvert -version
== mrconvert 3.0_RC3-135-g2b8e7d0c-dirty ==
64 bit release version, built Feb 5 2019

I also came across this, which seems to be related (https://github.com/MRtrix3/mrtrix3/issues/1481).

Should I go back to the another stable version of MRtrix to make it work or is there any other solution?

Thank you,
Ane

Hi @anege,

mrthreshold does not remove fixels but thresholds the fixel image which results in a binary mask (see mrstats fixelmask.mif). You can apply this fixel mask to zero out fixels below the threshold, keep others unaltered, by multiplying the mask with the fixel image:
mrthreshold -abs 0.5 fixelmask_non_bin.mif - | mrcalc fixelmask_non_bin.mif - -mult fixel_thresholded.mif

Cheers,
Max

Dear Max,

mrthreshold -abs 0.5 fixelmask_non_bin.mif fixelmask.mif | mrcalc fixelmask_non_bin.mif fixelmask -mult fixel_thresholded.mif still doesn’t zero out fixels.

fixelmask_non_bin.mif looks as follows

$ mrinfo fixelmask_non_bin.mif -size
1726175 1 1

fixelmask.mif looks as follows

$ mrinfo fixelmask.mif -size
1726175 1 1

fixel_thresholded.mif looks as follows

$ mrinfo fixel_thresholded.mif -size
1726175 1 1

In case it was not clear, I want something like the following. I want to extract FD values only in those fixels but I’m only able to get such a file for visualization (thresholding it in mrview).

Am I missing something?

Thank you,
Ane

Just to clarify, mrthreshold creates a mask that you can use to on the fixel value image or in fixel-specfic commands such as fixelcrop. The mrcalc command I provided multiplies the values associated with each fixel with the mask values, no fixels are removed (mrinfo -size stays constant). As Rob hinted at, this might be desirable if you do not want to change the associated direction and index files. If you actually want to remove fixels them, have a look at fixelcrop which will generate a new fixel directory with cropped fixel value, direction and index files.

As to why the mask is not applied: I suspect your fixel_thresholded.mif was not produced with the command you posted.

You can check the command used with mrinfo fixel_thresholded.mif -property command_history

This should work to set the fixel values below the threshold value to zero:

mrcalc fixelmask_non_bin.mif fixelmask.mif -mult fixel_thresholded2.mif

I want to extract FD values only in those fixels

To “extract” FD values within the mask:

mrdump FD.mif -mask fixelmask.mif

To compute statistics on FD within this mask:

mrstats FD.mif -mask fixelmask.mif

Note that the “count” field of mrstats output will additionally tell you the number of fixels with a value of 1 in the mask, as opposed to mrinfo which purely tells you the total number of fixels in the image regardless of their value.