Help

Tx, Ty, Tz, Rx, Ry, Rz to matrix

Here is some information on how to produce a matrix for the new 3D volume position using the start positions in the start position file. In the following the rows of the matrix are represented by different lines and the individual colums are separated by semicolons.

TOriginalPositionWCS

mentioned in the .sta file (Tposition)

TTranscenterInv

1; 0; 0; -centerx;
0; 1; 0; -centery;
0; 0; 1; -centerz;
0; 0; 0; 1;

TStartTransformation

c(Rz)*c(Ry); c(Rz)*s(Ry)*s(Rx)-s(Rz)*c(Rx); s(Rz)*s(Rx)+c(Rz)*s(Ry)*c(Rx); Tx;
s(Rz)*c(Ry); s(Rz)*s(Ry)*s(Rx)+c(Rz)*c(Rx); -c(Rz)*s(Rx)+s(Rz)*s(Ry)*c(Rx); Ty;
-s(Ry); c(Ry)*s(Rx); c(Ry)*c(Rx); Tz;
0; 0; 0; 1;
where s=sin, c=cos, and Tx, Ty, Tz, Rx, Ry, Rz are the values mentioned per registration in the start position file

TTranscenter

1; 0; 0; centerx;
0; 1; 0; centery;
0; 0; 1; centerz;
0; 0; 0; 1;

TStartErrorPositionWCS =

TTranscenter * TStartTransformation * TTranscenterInv * TOriginalPositionWCS
This is the position in the WCS of the 3D volume when the offset from the ground truth is taken into account.

Matrix to Tx, Ty, Tz, Rx, Ry, Rz

The 3D position of the volume at the end of the registration is most probably represented by a matrix (the position of the 3D volume in WCS). To transform this back to the Tx, Ty, Tz, Rx, Ry, Rz format you can use the following steps:

TPositionErrorResultWCS

Resulting position of 3D volume in WCS

TPositionErrorResult =

TTranscenterInv * TPositionErrorResultWCS

TOriginalErrorPosition =

TTranscenterInv * TOriginalErrorPositionWCS

TOriginalErrorPositionInv =

Inverse of TOriginalErrorPosition

TRemainingPositionResult =

TPositionErrorResult * TOriginalErrorPositionInv

Tx = TRemainingPositionResult[0][3]


Ty = TRemainingPositionResult[1][3]


Tz = TRemainingPositionResult[2][3]


Ry = -asin(TRemainingPositionResult[2][0])


Rx = asin(TRemainingPositionResult[2][1]*1/cos(Ry))


Rz = asin(TRemainingPositionResult[1][0]*1/cos(Ry))