I’m using VersorRigid3DTransform with a mask on the moving image. I would like to set up the center for the rotation.
The CenteredTransformInitializer can call MomentsOn() to automatically get the center of the mass. However, it’s for the entire image, and I want the center of the mask.
Is there any way to do it automatically or manually?
Last time I had to do the same, I had to do it manually : I masked my image with MaskImageFilter and computed the center of gravity with ImageMomentCalculator (or manually) (as the 0 values do not impact the computation).
Then you can set the center of the transform manually.
A follow-up question: When we use transform->SetCenter(), this center is set up for the moving image or the fixed image? I have a mask for my moving image, so I want the center of that mask to be the rotation center.
ITK registration is done in “physical” space, images are considered in the same space so the center applies to both.
You can refer to the Software Guide Registration chapter to fully comprehend the specificities of ITK’s implementation.