The translations and rotations produced by the affine transformation do not correspond to those used on a treatment machine. The treatment and simulator machines use a frame of reference in which the operations of rotation and translation commute (i.e. it does not matter in which order they are carried out). Additionally the centre of rotation for the treatment and simulator machines is the isocentre. A method is required to convert the affine transformation into the coordinate system used by the treatment machines.

Take two images, image one being the simulator image and image two the
portal image, and a transformation (r,q,x_{t},y_{t}) that maps pixels in the
version of image two registered with image one, onto corresponding pixels in
image two (i.e. the transformation passed to `POLY_2D`). If
(x_{c},y_{c}) is the position of the centre of rotation
(assumed to be the same in both images), and image two has an initial
magnification m and the pixel size of both images is p (assumed to be square),
then the position of the centre of rotation before the transformation was
applied (x_{a},y_{a}) is given by

x_{a} = |
x_{c} r cosq+y_{c}
r sinq-x_{t}cosq
-y_{t}sinqcos ^{2}q-sin^{2}
q |

y_{a} = |
y_{c} r cosq-x_{c}
r sinq-y_{t}cosq
+x_{t}sinqcos ^{2}q-sin^{2}
q |

The distance between the two points (x_{c},y_{c}) and
(x_{a},y_{a}) using Pythagoras' theorem is

h = | _________________ Ö (x _{a}-x_{c})^{2}+
(y_{a}-y_{c})^{2} |

and the angle is given by

tan f = | y_{a}-y_{c}x _{a}-x_{c} |

The longitudinal movement of the table (i.e. along its length) is given by

p m |
× h cos | æ ç è |
p 2 |
-q-f | ö ÷ ø |

and the lateral movement of the table is given by

p m |
× h sin | æ ç è |
p 2 |
-q-f | ö ÷ ø |

These movements will have the same units as the pixel size p. The rotation is the same in both systems, and knowing the table height and magnification of image one, working out the vertical table movement is trivial.