Discrepancy in the output of mrcalc

I’ve noticed that the two commands below generating different outputs:

mrcalc a.mif 0 -gt a.mif 1 -lt -mult a.mif -mult a.mif -force

mrcalc a.mif 0 -gt a.mif 1 -lt -mult a.mif -mult test.mif

The mrstats output of a.mif and test.mif are not the same.

Is this something that I should expect?

Unfortunately, yes. The problem is that you can’t use the same image as both input and output, due to the way MRtrix3 handle images. This is an open issue on GitHub, if you’re interested…

So just to be clear for future reference: even though the first command generates an output, it’ll be the wrong one of the two. In general, avoid force-overwriting inputs at all costs: it’ll lead to all sorts of unexpected (often unwanted) behaviour.