# A Noniterative Simultaneous Rigid Registration Method for Serial Sections of Biological Tissues +
## 3 Noniterative Simultaneous Rigid Registration Method (NSRR)
### Estimation of Rotation Matrix  
It is known that the F norm of a matrix is equal to the trace of the matrix product of the matrix and its transpose, which can be notated mathematically as \(||\mathbf{X}||_{\mathbf{F}}^{2}\)=\(tr(\mathbf{X}^{\mathbf{T}}\mathbf{X})\). Then, based on the matrix trace property that \(tr(\mathbf{ABC})\)=\(tr(\mathbf{CAB})\)=\(tr(\mathbf{BCA})\), Equation (2) can be rewritten as follows:  
\[\begin{array}{l}\underset{\mathbf{R}_{i}}{\arg\min}\sum\limits_{i=1}^{n-1}- tr(\mathbf{R}_{i}^{T}\mathbf{R}_{i+1}\widehat{\mathbf{X}}_{i+1,i}\widehat{ \mathbf{X}}_{i,i+1})\\ s.t.\left\{\begin{array}{l}\mathbf{R}_{i}^{T}\mathbf{R}_{i}=\mathbf{I}\\ \det(\mathbf{R}_{i})=1\\ \mathbf{R}_{1}=\mathbf{R}_{n}=\mathbf{I}\end{array}\right.\end{array} \tag{3}\]  
We let \(\mathbf{W}_{i}=\mathbf{R}_{i}^{T}\mathbf{R}_{i+1},\mathbf{A}_{i}=\widehat{ \mathbf{X}}_{i+1,i}\widehat{\mathbf{X}}_{i,i+1}^{T}\); Thus, Equation (3) can be further rewritten as follows:  
\[\begin{array}{l}\underset{\mathbf{W}_{i}}{\arg\min}\sum\limits_{i=1}^{n-1}- tr\left(\mathbf{W}_{i}\mathbf{A}_{i}\right)\\ s.t.\left\{\begin{array}{l}\prod\limits_{i=1}^{n}\mathbf{W}_{i}=\mathbf{I}\\ \mathbf{W}_{i}^{T}\mathbf{W}_{i}=\mathbf{I}\\ \det(\mathbf{W}_{i})=1\end{array}\right.\end{array} \tag{4}\]  
Because the matrix product of two rotation matrices is still a rotation matrix, \(\mathbf{W}_{i}\) still must satisfy the two constraints of rotation matrices, i.e., \(\mathbf{W}_{i}^{T}\mathbf{W}_{i}=\mathbf{I}\) and \(\det(\mathbf{W}_{i})=1\). Furthermore, because the positions of the first and last point sets are fixed, no relative rotation exists between the first and last point sets; therefore, \(\prod\limits_{i=1}^{n}\mathbf{W}_{i}=\mathbf{R}_{1}\mathbf{R}_{n}=\mathbf{I}\).  
By using Lemma A1 in the Appendix A, solving Equation (4) is equivalent to solving Equation (5). The goal of this step is to convert a complex problem into a very simple problem. Equation (5) can be solved easily using the interior point method, e.g., the fmincon function in Matlab.  
\[\begin{array}{l}\underset{\theta_{i}}{\arg\min}\sum\limits_{i=1}^{n-1}-tr \left(\mathbf{C}_{i}\mathbf{S}_{i}\right)\cos\theta_{i}\\ s.t.\sum\limits_{i=1}^{n-1}\theta_{i}=-\theta\end{array} \tag{5}\]  
The optimal solution of \(\mathbf{W}_{i}\) is \(\mathbf{H}_{i}\mathbf{V}_{i}\mathbf{C}_{i}\mathbf{U}_{i}^{T}\), where \(\mathbf{H}_{i}\in\mathbb{R}^{2\times 2}\) is a rotation matrix whose rotation degree is \(\theta_{i}\), \(\theta_{i}\) is the solution of Equation (5), and \(\mathbf{U}_{i}\mathbf{S}_{i}\mathbf{V}_{i}^{T}\) is the result of the singular value decomposition (SVD) of \(\mathbf{A}_{i}\). \(\mathbf{C}_{i}\) is a diagonal matrix \(diag(1,\det(\mathbf{V}_{i}\mathbf{U}_{i}^{T}))\in\mathbb{R}^{2\times 2}\), and \(\theta\) is the rotation degree of the matrix \(\prod\limits_{i=1}^{n}\mathbf{V}_{i}\mathbf{C}_{i}\mathbf{U}_{i}^{T}\). We provide lemmas and their proofs in Appendix A. Consequently, the final form of the rotation matrices is:  
\[\mathbf{R}_{1}=\mathbf{I},\mathbf{R}_{i}=\prod\limits_{k=1}^{i-1}\mathbf{W}_{ k}\quad(i=2,\dots,n) \tag{6}\]