overlay

Why does mrview completely cover the underlying image after using the overlay tool?

1 Like

Hi @yixin_gu,

I’m not entirely sure what you’re seeing – maybe a screenshot would help…?

I expect what you’re seeing is that regions of the overlay that have zero values are obscuring the main image? This is by design: zero is a value in its own right. The only values that won’t be displayed at all are Not-a-Number (NaN) or infinities – values which are only supported for floating-point representations.

If you don’t want zero values to obscure the main image, you can set a lower threshold at e.g. 0.5. You can also just adjust the opacity slider down to allow the background image to show through the overlay.

The main reason for these design decisions is because there are many ways an overlay image could be interpreted, depending on context. It could be a simple binary mask, or another image. If you need zero-valued voxels in the overlay to be ignored by default, then one option is to set your zero values to NaN, e.g.:

mrcalc input.mif 0 nan -replace output.mif

Note that this is not a great idea for binary mask images, since this forces the use of a 32-bit floating-point representation. Since binary masks are typically stored bitwise (when using the MRtrix .mif image format), this means your image will suddenly be 32× bigger…

All the best,
Donald.