Modify registration metric

Is there a way to set my own similarity metric for ITK registration? I want to define something like this: (“transformation_1” is a given transformation)
f(transformation) = || Image_target-Image_moving || + || transformation - transformation_1||

typedef itk::ImageRegistrationMethodv4<
FixedImageType,
MovingImageType > RegistrationType;
RegistrationType::Pointer registration = RegistrationType::New();

There is a method called SetMetric() in “RegistrationType::Pointer registration”. Should I use that?

Thanks!

Yes, you should use SetMetric() but you need to create your own class which derives from ImageToImageMetricv4 or some other class in that hierarchy.