# Calibration Method of Projectional Geometry for X-ray C-arm Fluoroscopy Using Sinogram Data
## 2 Materials Furthermore, Methods
### Calculation of Isocenter Position  
The SVD method was used to calculate the 3D coordinates of the phantom and the isocenter [10,11]. The positions of known markers are defined with respect to the coordinates of the phantom. Therefore, a relational equation should be established by considering the initial position and orientation with respect to the current coordinates of the markers. Furthermore, the rotational angle about the z-axis, \(\theta_{z}\), can be calculated using the minAreaRect function [15] of the OpenCV library. A \(4\times 4\) homogeneous transformation matrix can be expressed as the relational Equation (8) of a point rotated along the X- and Y-axes. \[P^{r}=M\cdot P=TR_{x}R_{y}T^{-1}P \tag{8}\] \[ \begin{bmatrix}P_{x}^{r}\\ P_{y}^{r}\\ P_{z}^{r}\\ 1\end{bmatrix} =\]  
The proportional expression between \(P^{r}\) and the projected point \(P^{\prime}\) is given by Equation (9). \[ \begin{split} S_{z}:S_{z}-P_{z}^{r}&=P_{x}^{r}:P_{x}^{r}\\ S_{z}:S_{z}-P_{z}^{r}&=P_{y}^{\prime}:P_{y}^{r}\end{split}  \tag{9}\]  
Equations (8) and (9) can be substituted and summarized into Equation (10). \[ \begin{split} P_{x}^{\prime}\cdot S_{z}=& P_{x}[S_{z}cos\theta_{y}-P_{x}^{\prime}sin\theta_{y}cos\theta_{x}]+P_{y}[P_{x}^ {\prime}sin\theta_{x}]\\ &+P_{z}[S_{z}sin\theta_{y}+P_{x}^{\prime}cos\theta_{y}cos\theta_{ x}]+I_{x}[S_{z}(1-cos\theta_{y})+P_{x}^{\prime}sin\theta_{y}cos\theta_{x}]\\ &-I_{y}[P_{x}^{\prime}sin\theta_{x}]+I_{z}[P_{x}^{\prime}(1-cos \theta_{y}cos\theta_{x})-S_{z}sin\theta_{y}]\\ & P_{y}^{\prime}\cdot S_{z}=& P_{x}[S_{z}sin\theta_{y}sin \theta_{x}-P_{y}^{\prime}sin\theta_{y}cos\theta_{x}]+P_{y}[S_{z}cos\theta_{x} +P_{y}^{\prime}sin\theta_{x}]\\ &+P_{z}[P_{y}^{\prime}cos\theta_{y}cos\theta_{x}-S_{z}cos\theta_{ y}sin\theta_{x}]+I_{x}[P_{y}^{\prime}sin\theta_{y}cos\theta_{x}-S_{z}sin \theta_{y}sin\theta_{x}]\\ &-I_{y}[S_{z}(1-cos\theta_{x})-P_{y}^{\prime}sin\theta_{x}]+I_{z}[ S_{z}cos\theta_{y}sin\theta_{x}+P_{y}^{\prime}(1-cos\theta_{y}cos\theta_{x})]\end{split}  \tag{10}\]  
The least-squares solution can be calculated by defining a matrix form of \(Ax=b\) using SVD [10,11]. Therefore, Equation (10) can be converted into Equation (11) in the form of \(Ax=b\). \[ \begin{bmatrix}S_{z}cos\theta_{y}-P_{x}^{\prime}sin\theta_{y}cos \theta_{x}&\cdots&P_{x}^{\prime}(1-cos\theta_{y}cos\theta_{x})-S_{z}sin \theta_{y}\\ S_{z}sin\theta_{y}sin\theta_{x}-P_{y}^{\prime}sin\theta_{y}cos\theta_{x}& \cdots&S_{z}cos\theta_{y}sin\theta_{x}+P_{y}^{\prime}(1-cos\theta_{y}cos \theta_{x})\\ & I_{x}\\ I_{y}\\ I_{z}\end{bmatrix}  \tag{11}\] \[= \begin{bmatrix}P_{x}^{\prime}\cdot S_{z}\\ P_{y}^{\prime}\cdot S_{z}\end{bmatrix} \]  
Since Equation (11) is a matrix of one angle, the matrix of several angles can be expressed as Equation (12). \[ \begin{bmatrix}S_{z}cos\theta_{y,0}-P^{r}_{x}sin\theta_{y,0}cos\theta_{x,0}& \cdots&P^{r}_{x}(1-cos\theta_{y,0}cos\theta_{x,0})-S_{z}sin\theta_{y,0}\\ S_{z}sin\theta_{y,0}sin\theta_{x,0}-P^{r}_{y}sin\theta_{y,0}cos\theta_{x,0}& \cdots&S_{z}cos\theta_{y,0}sin\theta_{x,0}+P^{r}_{y}(1-cos\theta_{y,0}cos \theta_{x,0})\\ \vdots&\vdots&\vdots\end{bmatrix} ^{T} \begin{bmatrix}P_{x}\\ P_{y}\\ P_{z}\\ I_{x}\\ I_{y}\\ I_{z}\end{bmatrix}  \tag{12}\] \[= \begin{bmatrix}P^{r}_{x,0}\cdot S_{z}\\ P^{r}_{y,0}\cdot S_{z}\\ \vdots\end{bmatrix} \]  
Equation (12) obtains the \(Ax=b\) matrix in which \(P_{x},P_{y},P_{z},I_{x},I_{y},I_{z}\) become variables. Matrix \(A\) can be decomposed into \(A=U\Sigma V^{T}\) by the SVD theorem. \[A:m\times n\text{ rectangular matrix}\] \[U:m\times m\text{ orthogonal matrix}\] \[\Sigma:m\times n\text{ diagonal matrix}\] \[V:m\times m\text{ orthogonal matrix}\]  
The pseudo-inverse of \(A\) is calculated as \(A^{+}=V\Sigma^{+}U^{T}\). Therefore, in \(Ax=b\), the \(x\) can be calculated as \(x=A^{+}b\), and the calculation is the least-squares solution that minimizes \(\|Ax-b\|\). Consequently, the least-squares solution of Equation (12) can be expressed as Equation (13). \[x= A^{+}b \tag{13}\] \[= \begin{bmatrix}P_{x}&P_{y}&P_{z}&I_{x}&I_{y}&I_{z}\end{bmatrix}