I need to calculate the remapped coordinates of two known points within a volume after application of scipy.ndimage.interpolation.affine_transform with a rotation matrix I've generated.
In addition to being rotated during affine_transform, the output array is also padded compared to the input array to take into account the fact that the rotated volume may fall outside the bounds of the original array's shape.
I have the coordinates of the two known points in the volume before transformation (xb1,yb1,zb1) and (xb2,yb2,zb2). I want to know what the new position of those coordinates are after affine transformation and expansion of the array (xa1,ya1,za1) & (za2, ya2, za2). In affine_transform, the rotation is performed at the mid point between (xb1,yb1,zb1) and (xb2,yb2,zb2) at the center of the volume.
Edit: What I've tried so far: I made a zeros array of the same shape as the volume I'm tranforming. The two elements in the zeros array corresponding to the two starting points are set to two 32bit integers, 1000 for one, 5000 for the other. I then transform the marked zeros array with the same transformation matrix as the volume, and then after affine_transform with a spline order of 0 (to maintain the starting element values in the transformed array), I just use np.any to return the index of the 1000 and 5000 elements in the transformed array. This works OK, but there are instances where during the process of affine_transform, one point can go "missing" - probably through interpolation with a spline order of 0 (no spline). So this doesn't work in all cases.