Smoothing with a mask (in general, and specifically applied to registration)

There is an interesting approximation for smoothing using a mask:
s(X with mask) = s(Mask*X)/s(Mask)

For smoothing, particularly in registration pipelines, this can reduce the computation needed, and focus registration better, particularly also helpful to avoid edge effects from anatomy/features that you might want to avoid.

A little discussion here:

I wanted to open this up for discussion to add to the feature ideas for ITKv5 registration pipeline.

Good idea, @gdevenyi.

In the ideal case, we could make it possible to specify / override the smoothing filter used in the registration method. This would enable optimized implementations, GPU implementation when available, mask approximations, etc.

Exactly what I was thinking, perhaps time for a ITKv5RegistrationMethod with selectable smoothers, better masking support etc.

There are two steps quite related here: smoothing and downsampling.

Perhaps we can look at a class that was used in the v3 registration framework for insight:

I think we are looking to create a base class perhaps called “DownsamplerImageFilter” or MultiResolutionImageFilter? (additional keywords: scale, scale space, smoothing, downsample … )

It should take the sigmas, shrink factors, input image and optionally input mask and produce a smooth downsampled image. This could be an settable object to the ImageRegistrationMethodv4.

Possible implementations include:
Discrete in X, Shrink in X, … Discrete in D, Shrink in D

I have used the last two outside the registration method when needing to reduce an image by a large amount say 10x10x10, doing the shrinking after just 1D convolution can greatly reduce the amount of computation done in the later convolutions.