# Modify registration metric

**URL:** https://discourse.itk.org/t/modify-registration-metric/289
**Category:** Engineering
**Created:** [October 12, 2017, 3:57pm UTC](https://discourse.itk.org/t/modify-registration-metric/289 "2017-10-12T15:57:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ray](https://discourse.itk.org/letter_avatar_proxy/v4/letter/r/e9a140/32.png) [@Ray](https://discourse.itk.org/u/Ray)
#### Post date: [October 12, 2017, 3:57pm UTC](https://discourse.itk.org/t/modify-registration-metric/289/1 "2017-10-12T15:57:27Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 12, 2017, 10:07pm UTC](https://discourse.itk.org/t/modify-registration-metric/289/2 "2017-10-12T22:07:25Z")

</div>

Yes, you should use `SetMetric()` but you need to create your own class which derives from [ImageToImageMetricv4](https://itk.org/Doxygen/html/classitk_1_1ImageToImageMetricv4.html) or some other class in that hierarchy.
