Remove fixels with value 0 from fixelmask


Dear experts,

After using tck2fixel, I am trying to see how many fixels I have in my tck-weighted fixel mask. How could I do this? I just want to erase the fixels with value 0 from the mask.

Some useful commands to do such a thing (fixelthreshold , fixelstats or fixelcalc), are deprecated and not available on the last version.

Thank you for your help!!

Mrthreshold fixelmask problem

I’m pretty sure you can achieve this with fixelcrop, e.g.

fixelcrop template_fixel_directory tck_mask_fixel_directory/tck_mask.mif template_fixel_directory_cropped

then you can run mrinfo on any file in the resulting cropped fixel directory to get the size.


Looks like @anege came across the solution to this issue, but the text got piped to the wrong stream deep in the depths of the Discourse server where nobody can see it :crazy_face:

With the fixel directory format, because each fixel data file is just a 1D image file, many “workhorse” MRtrix3 commands are applicable, including mrthrehsold. So applying a threshold of e.g. 0.5, and then feeding the result as the -mask option of mrstats, should provide the number of super-threshold fixels in the “count” output.

The fixelcrop option suggested by @rgrazioplene should give the same answer, but is doing a bit more work to get there: It creates a new fixel directory, where only those fixels in the input directory that have a value of 1 in the mask (e.g. super-threshold as determined by mrthreshold) are included in the output fixel directory; those fixels that have a value of 0 in the mask are omitted entirely. So the number of fixels present in that directory will correspond to the number of fixels that had a value of 1 in your mask; but you also have a new fixel directory containing only those fixels, which you may or may not want depending on context.

Mrthreshold fixelmask problem