I have the following problem: I have a 3d numpy array representing a stack of images. I also have a point cloud (n,3) of some relevant locations in the 3d array, which I have plotted in there. I want to rotate both by an angle around the x-axis. I do the following:
#for point cloud
rotation_matrix = scipy.spatial.transform.Rotation.from_euler('x', x_rot, degrees=True)
rotated_stack_points = rotation_matrix.apply(stack_points)
#for 3d stack
rotated_marked_xy = scipy.ndimage.interpolation.rotate(gfp_stack, angle=-x_rot, axes=(1, 2), reshape=True)
Then I plot the rotated point cloud in the rotated 3d array. The problem is that there is always a xy offset between the points plotted pre rotation and after rotation and can't figure out why. This offset changes with the rotation angle, it's not fixed. Any ideas why this happens?