Hi,
I am a little bit confused about the results I get from the LandmarkBasedTransformInitializer in combination with the similarity Transform.
Lets say I have to sets of landmarks (points_a and points_b) where points_b is simply an uspscaled version of points_a (in reference to the origin). For some reason the TransformInitializer only tries to fit the translation, while the scale stays 1. Here is a minimal example in python using simpleITK:
import SimpleITK as sitk
import numpy as np
points_a = [[0,0], [0,1], [1,0], [1,1]]
points_b = [[0,0], [0,2], [2,0], [2,2]]
a_flat = [c for p in points_a for c in p]
b_flat = [c for p in points_b for c in p]
similarity_transform = sitk.LandmarkBasedTransformInitializer(
sitk.Similarity2DTransform(),
a_flat,
b_flat
)
matrix = np.reshape(similarity_transform.GetMatrix(), (2,2))
translation = similarity_transform.GetTranslation()
scale = similarity_transform.GetScale()
print(matrix)
print(translation)
print(scale)
Output:
[[1, 0]
[0, 1]]
[0.5, 0.5]
1.0
I don’t understand why the scaling is not set correctly to 2 in this example.
Best regards,
Jan