import matplotlib.pyplot as plt
import numpy as np
from skimage import transform

phantom_roll = 30
phantom_center = (150,150)
r_phantom = 100
t = np.linspace(0, 2*np.pi, 100)
p_phantom = r_phantom * np.vstack((np.sin(t), np.cos(t)))

tf1 = transform.EuclideanTransform(rotation=np.deg2rad(phantom_roll))
tf2 = transform.EuclideanTransform(translation=phantom_center)
phantom_placement = tf1 + tf2
phantom_rotated = tf1(p_phantom.T).T
phantom_final = phantom_placement(p_phantom.T).T

_, axs = plt.subplots(1, 3)
axs[0].annotate('', xy=(0, 125), xytext=(0, 0),
             arrowprops=dict(facecolor='black', shrink=0.0, width=0.1, headlength=5, headwidth=5), )
axs[0].annotate('', xy=(125, 0), xytext=(0, 0),
             arrowprops=dict(facecolor='black', shrink=0.0, width=0.1, headlength=5, headwidth=5), )
axs[0].plot(p_phantom[0,:], p_phantom[1,:], 'k', linewidth=2)
axs[0].plot(p_phantom[0,0], p_phantom[1,0], 'ro')
axs[0].axis((-150, 300, -150, 300))
axs[0].set_aspect('equal')

axs[1].annotate('', xy=(0, 125), xytext=(0, 0),
             arrowprops=dict(facecolor='black', shrink=0.0, width=0.1, headlength=5, headwidth=5), )
axs[1].annotate('', xy=(125, 0), xytext=(0, 0),
             arrowprops=dict(facecolor='black', shrink=0.0, width=0.1, headlength=5, headwidth=5), )
axs[1].plot(phantom_rotated[0,:], phantom_rotated[1,:], 'k', linewidth=2)
axs[1].plot(phantom_rotated[0,0], phantom_rotated[1,0], 'ro')
axs[1].axis((-150, 300, -150, 300))
axs[1].set_aspect('equal')

axs[2].annotate('', xy=(0, 125), xytext=(0, 0),
             arrowprops=dict(facecolor='black', shrink=0.0, width=0.1, headlength=5, headwidth=5), )
axs[2].annotate('', xy=(125, 0), xytext=(0, 0),
             arrowprops=dict(facecolor='black', shrink=0.0, width=0.1, headlength=5, headwidth=5), )
axs[2].plot(phantom_final[0,:], phantom_final[1,:], 'k', linewidth=2)
axs[2].plot(phantom_final[0,0], phantom_final[1,0], 'ro')
axs[2].axis((-150, 300, -150, 300))
axs[2].set_aspect('equal')

plt.show()