Registration error using MMI with an ROI moving mask


I am using the BRAINS registration module to register two MRI exams using an affine transform. I want to provide an ROI Masking image for the moving image, but I get the following error when using the MMI metric :

too many samples map outside moving image buffer, the images do not sufficiently overlap!

This is very surprising since the two MRI exams are already globally aligned (I just want to be more precise on some organs using the mask). And the registration runs when I use any other metric, but with unsatisfying results.

For test, I put the same MRI exam as both the fixed and moving images for the registration. When I put the mask as the ROI fixed masking image, it runs, but I get the same error when I put it as the ROI moving masking image!

Is there any bug or specificity for masking input moving with MMI ? Thanks for your help!


If you use a small ROI mask then you need to increase sampling percentage accordingly. See details here:

Thanks for your response! I try to set the sampling percentage to 1 to consider all voxels but it makes no difference. Any other idea ?
I don’t understand why this problem only appears when considering an ROI mask for the moving image, with mutual information?

How much is the volume of the masked region comopared to the volume of the entire image region?

You may try much higher, 30-100% ratio. If you still have problems, write to the ITK forum topic that I linked above.

I’m sorry I meant 100% for the sampling percentage (it corresponds to a value of 1 in the BRAINS registration module).
The masked region corresponds to a dilated organ, it represents 5% of the entire MRI Volume.
What I don’t understand is that it works in one way when the mask is used for the fixed image, but if a switch the moving and fixed images to do the inverse registration, then the mask is used for the moving image, and it does not work anymore.

Probably you can alleviate the error by cropping the image using Crop Volume module (so that the mask takes much more than 5% of the total volume).

For more information, you can read this discussion. You can also create a new topic for your question on the ITK forum (if you do that, please post the link here so those who interested can follow the discussion there).

You may also try to use Elastix - via SlicerElastix extension. It tends to be much more robust than BRAINS. You may not even need masking, just approximately crop volumes to the same region before registration.