# Automatic Tortuosity Estimation of Nerve Fibers and Retinal Vessels in Ophthalmic Images
## 2 Methods
### Curvilinear Structure Tortuosity Representation
#### 2.2.2 Exponential Curvature Estimation  
Intuitively, as shown in Figure 3b, the curvature of a curvilinear can be regarded as the rate of angular change of a moving point along the direction of the curve. In \(\mathbb{R}^{2}\rtimes S^{1}\) 3D space, an exponential curve \(\gamma_{\epsilon}\) with arc length \(t\) is represented by tangent vector components and the rotation-invariant basis: i.e., \(\dot{\gamma}_{\epsilon}(t)=c^{\epsilon}\mathbf{e}_{\xi}|_{\gamma_{\epsilon }(t)}+c^{\eta}\mathbf{e}_{\eta}|_{\gamma_{\epsilon}(t)}+c^{\theta}\mathbf{e}_{ \theta}|_{\gamma_{\epsilon}(t)}\). Here the tangent vector is \(\mathbf{c}=(c^{\xi},c^{\eta},c^{\theta})^{T}\), while the basis is noted as \(\{\mathbf{e}_{\varphi},\mathbf{e}_{\eta},\mathbf{e}_{\theta}\}\). In orientation scores, exponential curves are presented as circular spirals, which are similar to straight lines with respect to the curved geometry in \(\mathbb{R}^{2}\rtimes S^{1}\). With the spatial projections, each pixel on the curvature can be determined. For an exponential curve \(\gamma_{\epsilon}\) with the tangent vector of \(c\), we note \(\mathbb{P}_{\mathbb{R}^{2}}\gamma_{\epsilon}\) as the projected curve. Therefore, the curvature \(\kappa(\mathbf{x},\theta)\) is calculated by the term \(\frac{c^{\theta}\operatorname{sign}(c^{\xi})}{\sqrt{|c^{\xi}|^{2}+|c^{\xi}|^{ 2}}}\). Accurate local curvature estimation is achieved by fitting the exponential curve to the local curvilinear structure with the best alignment. The optimal tangent vector \(\mathbf{c}^{*}\) of the best exponential curve fit is used to compute the local curvature \(\kappa\), as shown in Figure 3(b). We can solve the \(\mathbf{c}^{*}\) by calculating the eigenvectors of the Hessian matrix. Here we take the Hessian matrix with \(\mu\)--normalized form previous orientation scores. Its mathematical expression is: \(\mathcal{H}_{\mu}S_{f}=M_{\mu^{-1}}(\mathcal{H}S_{f})^{T}M_{\mu^{-2}}( \mathcal{H}S_{f})M_{\mu^{-1}}\), with  
\[\mathcal{H}S_{f}= \begin{pmatrix}\partial_{\xi}^{2}S_{f}&\partial_{\xi} \partial_{\eta}S_{f}&\partial_{\theta}\partial_{\xi}S_{f}\\ \partial_{\xi}\partial_{\eta}S_{f}&\partial_{\eta}^{2}S_{f}&\partial_{\theta }\partial_{\eta}S_{f}\\ \partial_{\xi}\partial_{\theta}S_{f}&\partial_{\eta}\partial_{\theta}S_{f}& \partial_{\theta}^{2}S_{f}\end{pmatrix} , \tag{9}\]  
For each element in the matrix, its first and second order derivative are calculated by rotation-invariant partial derivative [34]. Here, the derivative of position group is \(\{\partial_{\xi},\partial_{\eta}\}=\{\cos\theta\partial_{x}+\sin\theta \partial_{y},\cos\theta\partial_{y}-\sin\theta\partial_{x}\}\). The orientation element is \(\partial_{\theta}\). \(M_{\mu^{-1}}\) is the diagonal matrix [11]. From previous steps, we extract curvilinear structures from original images with the proposed enhancement method, and generate high-quality maps for the further calculations. Then, we obtained the orientation scores and curvature of local curvilinear structures. In Figure 3, we show this process with curvilinear structures with a different position and curvature. From the results of orientation and curvature of individual curvilinear fragment, we will evaluate the tortuosity all over the map. For tortuosity metric calculation, we consider the length, curvature of each curve and the proportion of different curvature in the map. The equation of the tortuosity metric is  
\[\kappa_{\text{exp}}=\frac{1}{\mathcal{V}}\int_{-\infty}^{\infty}|\kappa_{ \mathbf{c}^{*}}(\mathbf{x},\Theta(\mathbf{x}))|\mathcal{T}(\mathbf{x})\text{ d}\mathbf{x}, \tag{10}\]  
where the \(\kappa_{\text{exp}}\) is our tortuosity metric, which is the normalized global absolute curvatures of the enhanced curvilinear. For an enhanced curvilinear structure map \(\mathcal{T}(\mathbf{x})\), the \(\kappa_{\text{exp}}\) is the sum of them with curvature weights \(|\kappa_{\mathbf{c}^{*}}(\mathbf{x},\Theta(\mathbf{x}))|\).