Multiresolution Registration with 2D Affine Transformation on pairs of 2D images

Hello @ScottP,

Happy to help.

Thanks for sharing an image that is more representative of what you are working with. Your task is harder than most if you want to use intensity based registration. It may be more appropriate to identify corresponding points in the two images and perform point based registration (LandmarkBasedTransformInitializerFilter).

With intensity based registration the issue is that you have very high frequency content (what you refer to as blocky). That means that it is easy for the registration to fail (get stuck in local minima) because the terrain in parameter space has a very small convergence range. The common solution is to blur the images with larger kernels (in your code these are the smoothingSigmas) and possibly use more levels in the pyramid. The blurring at the higher levels of the pyramid smooths the optimized function, removing local minima, and increasing the convergence range. In lower levels of the pyramid there is less blurring but you are already inside the narrow convergence range.

In the extreme (working with high frequency binary images) instead of a blurring pyramid, you can replace the use of original images with their distance maps (e.g. SignedMaurerDistanceMapImageFilter, DanielssonDistanceMapImageFilter):

  1. Input binary images fixed_image, moving_image.
  2. Compute distance maps for both images, fixed_distance_map, moving_distance_map.
  3. Register fixed_distance_map, moving_distance_map.
  4. Apply the estimated transformation as if you had registered fixed_image, moving_image.