Mrmath behavior

Hi,

I was using the mrmath command in the fixel based analysis pipeline, and I encountered some unexpected (at least for me) behaviors:

The command mrmath */dwi_mask_in_template_space.mif min ../template/template_mask.mif -datatype bit gives me as expected a mask, when if at least one subject is 0, the value is 0 for the final mask. However, I don’t understand the max and the mean options. When I’m working with the masks is fine, I see a full brain mask, but for example is I use the command like this: mrmath fa/* max max_fa_template.mif -datatype bit where fa/ is a folder containing all the FA maps in template space (I inspected the images and all look fine). I obtain a strange binary mask.


Using the same command as before with the option mean, I found the result quite similar, thing that surprises me, because I was not waiting a binary image at the end of this process. Is mrmath applying some internal thresholds? Or I’m missing something about the behavior of this commad?

Thanks in advance.

Best regards,

Manuel

Yes, because you ask it to with -datatype bit. This makes sense for binary masks but not for floating point values between 0 and 1 (FA). Try without or with -datatype float.

Just to clarify: when casting to a bitwise value (-datatype bit), a floating-point value gets rounded to zero if it’s less than 0.5 – not just if it’s exactly zero. Does that clarify what’s going on?

Hi,

Thanks @maxpietsch and @jdtournier, that makes perfectly sense, now everything works as expected.

Best regards,

Manuel