Use the new FunctorImageFilter with a lambda in DomainTransform application.
FunctorImageFilter
DomainTransform