I have a question regarding transforming a point with an affine transform. I have applied an affine transform (translation, rotation, scaling) two images (image and its segmentations) and after resampling it is working as intended. However, I am also trying to use the same affine transform to transform points I have (centroids for the segmentation), but it does not seem to be working as intended. An example affine transform is here to show how I am trying to transform the point.
aff_trans = sitk.AffineTransform(3)
aff_trans.Translate((5.8, -3, 6))
aff_trans.Rotate(1, 2, angle=0.5)
aff_trans.Rotate(0, 2, angle=0.2)
aff_trans.Rotate(0, 1, angle=0.65)
# Transform the voxel space landmark to physical space based on the original image
landmark_phys = image.TransformContinuousIndexToPhysicalPoint(landmark)
# Shift the physical landmark based on the affine transform
shifted_landmark_phys = aff_trans.TransformPoint(landmark_phys)
transformed_landmark_vox = resampled_image.TransformPhysicalPointToContinuousIndex(shifted_landmark_phys)
However, when opening both the resampled image and segmentation with ITK-Snap, the transformed landmark does not align properly. The coordinate does align properly with the original image and segmentation when viewing them in ITK-Snap.