Calculate commong/shared voxels

Hi dear mrtrix community!

I have encountered a problem, and I would like to solve it with mrtrix. I hope it is possible!
What I am trying to accomplish is this. I have:

  • one ROI mask made from anatomical image of a tract (ex. arcuate fasciculus)
  • one tract (ex. arcuate fasciculus) made from tckgen reconstruction

What I want is how many (number) voxels from tckgen reconstructed tract are also consisted in ROI mask made from anatomical image. So basically, just the common/shared voxels of the two!
Images were previously coregistered.

Thanks in advance!

First check that the images have the same transformation: mrinfo anat.mif tck.mif, if not you’ll need to regrid at them to the same voxel space using mrtransform's -template option (and presumably -interpolate nearest).
Then mrcalc anat.mif tck.mif -mult - | mrstats -output count -ignorezero - gives you the overlap.