# Image Registration with no translation

**URL:** https://discourse.itk.org/t/image-registration-with-no-translation/5874
**Category:** Beginner Questions
**Created:** [April 17, 2023, 2:59pm UTC](https://discourse.itk.org/t/image-registration-with-no-translation/5874 "2023-04-17T14:59:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![csoconnor](https://discourse.itk.org/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@csoconnor](https://discourse.itk.org/u/csoconnor)
#### Post date: [April 17, 2023, 2:59pm UTC](https://discourse.itk.org/t/image-registration-with-no-translation/5874/1 "2023-04-17T14:59:44Z")

</div>

Is it possible to register two images off of a point (not the center of the image) without translation? As in I have two images that are fixed at one point but I need to align the moving image using 3d rotation only.

I have tried this with AffineTranform, Euler3DTransform, and VersorRigid3DTransform:  
image\_center = post\_resam.TransformIndexToPhysicalPoint((75, 250, 350))  
new\_transform = sitk.AffineTransform(3)  
new\_transform.SetCenter(image\_center)  
new\_transform.SetTranslation((0, 0, 0))

parameters = {‘numberOfHistogramBins’: 50,  
‘SamplingPercentage’: 0.01,  
‘learningRate’: 1,  
‘numberOfIterations’: 150,  
‘convergenceMinimumValue’: 1e-7,  
‘convergenceWindowSize’: 10,  
‘shrinkFactors’: [4, 2, 1],  
‘smoothingSigmas’: [2, 1, 0]}  
registration\_method = sitk.ImageRegistrationMethod()  
registration\_method.SetMetricAsMattesMutualInformation(numberOfHistogramBins=parameters[‘numberOfHistogramBins’])  
registration\_method.SetMetricSamplingStrategy(registration\_method.RANDOM)  
registration\_method.SetMetricSamplingPercentage(parameters[‘SamplingPercentage’])  
registration\_method.SetInterpolator(sitk.sitkLinear)

registration\_method.SetOptimizerAsGradientDescent(  
learningRate=parameters[‘learningRate’],  
numberOfIterations=parameters[‘numberOfIterations’],  
convergenceMinimumValue=parameters[‘convergenceMinimumValue’],  
convergenceWindowSize=parameters[‘convergenceWindowSize’])  
registration\_method.SetOptimizerScalesFromPhysicalShift()

registration\_method.SetShrinkFactorsPerLevel(parameters[‘shrinkFactors’])  
registration\_method.SetSmoothingSigmasPerLevel(parameters[‘smoothingSigmas’])  
registration\_method.SmoothingSigmasAreSpecifiedInPhysicalUnitsOn()

registration\_method.SetInitialTransform(new\_transform, inPlace=False)

final\_transform = registration\_method.Execute(pre\_left\_sitk, post\_left\_sitk)

Thanks

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [April 17, 2023, 3:09pm UTC](https://discourse.itk.org/t/image-registration-with-no-translation/5874/2 "2023-04-17T15:09:55Z")

</div>

Hello @csoconnor,

Yes. Use the [VersorTransform](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1VersorTransform.html). Set its center to the arbitrary center of rotation in the fixed image’s coordinate system:

```auto
arbitrary_center_of_rotation = fixed_image.TransformIndexToPhysicalPoint([10,20,30])
new_transform = sitk.VersorTransform()
new_transform.SetCenter(arbitrary_center_of_rotation)
...

```

Note that when using the versor transform there is no need to `SetOptimizerScalesFromPhysicalShift`.

---

<div class="post-metadata">

### Author: ![csoconnor](https://discourse.itk.org/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@csoconnor](https://discourse.itk.org/u/csoconnor)
#### Post date: [April 17, 2023, 3:11pm UTC](https://discourse.itk.org/t/image-registration-with-no-translation/5874/3 "2023-04-17T15:11:11Z")

</div>

Thanks, much appreciated!

---

<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: [April 17, 2023, 3:48pm UTC](https://discourse.itk.org/t/image-registration-with-no-translation/5874/4 "2023-04-17T15:48:46Z")

</div>

You could also set optimizer weights:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/v5.3.0/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.h#L290-L300>

Take a look at this [example](https://simpleitk.readthedocs.io/en/master/link_ImageRegistrationOptimizerWeights_docs.html) of how to apply it.
