# Lenke Classification of Scoliosis Based on Segmentation Network and Adaptive Shape Descriptor
## 2 Methods
### Adaptive Shape Descriptor for Vertebrae
#### 2.4.2 Adaptive Similarity Matching Weight Based on Key Segments  
Since spinal parts with greater curvature have more influence on the [PERSON] classification of scoliosis, an adaptive weighting mechanism is further proposed to improve the similarity matching.  
Mathematically, suppose \(\mathbf{s}=\{\mathbf{p}_{0},\mathbf{p}_{1},\ldots,\mathbf{p}_{m}\}\) and \(\mathbf{S}^{\prime}\)= \(\{\mathbf{p}^{\prime}_{0},\mathbf{p}^{\prime}_{1},\ldots,\mathbf{p}^{\prime}_{m}\}\) are the outline point sets of segmented spinal image X and Y, respectively, \(\mathbf{C}_{1}\)= \(\{\mathbf{x}_{1},\mathbf{x}_{2},\ldots,\mathbf{x}_{m}\}\) and \(\mathbf{C}_{2}\)= \(\{\mathbf{y}_{1},\mathbf{y}_{2},\ldots,\mathbf{y}_{m}\}\) are corresponding coded sequences that need to be matched.  
Firstly, for \(\mathbf{S}\) or \(\mathbf{S}^{\prime}\), we calculate the boundary segments with the largest local change slope. Using the calculation for \(S\) as an example, we first compute the slope between all adjacent points, i.e., \(\mathbf{p}_{i-1}\) and \(\mathbf{p}_{i}\) are denoted as \(\text{slop}_{i}\). Then, the slope difference between the two adjacent boundary segments \((\mathbf{p}_{i},\mathbf{p}_{i+1})\) and \((\mathbf{p}_{i-1},\mathbf{p}_{i})\) can be calculated as \(disslop_{i}=\)\(|\text{slop}_{i+1}-\text{slop}_{i}|\). If \((\mathbf{p}_{i-1},\mathbf{p}_{i})\) satisfy the following two restrictions: (1) \(\text{slop}_{i}\) and \(\text{slop}_{i+1}\) have opposite signs, or \(\text{slop}_{i}\) and \(\text{slop}_{i-1}\) have opposite signs; (2) satisfying \(disslop_{i}=\max(disslop_{j}),i-r<j<i+r\), where \(r\) is a local range parameter, \(\mathbf{p}_{i}(i>0)\) is called the key point and \((\mathbf{p}_{i-1},\mathbf{p}_{i})\) is called the key segment. In fact, the first restriction above indicates that the tilt angle occurring at \((\mathbf{p}_{i-1},\mathbf{p}_{i})\) changes in direction. The second restriction indicates that the local maximum slope change has been determined. An example is shown in Figure 8; the key segments are marked as red, which often denote the most curved part.  
Figure 7: Outline representation using shape encoding. (**a**) Circular direction template; (**b**) outline representation of vertebrae.  
Subsequently, suppose the key points of \(\mathbf{S}\) and \(\mathbf{S^{\prime}}\) are denoted as \(\left\{kp_{j}\right\},j=1,\ldots,k_{1}\) and \(\left\{kp_{j}^{*}\right\},j=1,\ldots,k_{2}\), respectively, we can then calculate the similarity matching weight \(w_{i}\) for each point using Formula (5), where \(\left\|\cdot\right\|\) operation denotes the interval distance between two points in the outline point sets. Finally, the dissimilarity calculation between \(X\) and \(Y\) can be improved using Formula (7).  
\[w_{i}=\sum_{j=1}^{k1}\exp(-\left\|p_{i}-kp_{j}\right\|)+\sum_{j=1}^{k2}\exp(- \left\|p^{\prime}_{i}-kp_{j}*\right\|) \tag{7}\]  
\[\text{Dis}Sim_{2}(X,Y)=\sum_{i=1}^{m}\{w_{i}\cdot\min((x_{i}-y_{i}+n)\text{ mod}n,(y_{i}-x_{i}+n)\text{mod}n)\,\} \tag{8}\]  
Since the key points and key segments of each segmented spine image are determined by its own largest local change slope, different spine images may have different numbers of key points, i.e., \(k_{1}\) and \(k_{2}\) in formula (7) are adaptively determined by their respective segmentation results. As shown in Figure 8, both the two segmented spine images have three key segments that reflect their respective conditions with a maximum local slope change. In addition, to ensure a more robust match, the similarity matching weights \(w_{i}\) (\(i\) = 1,2,..., \(m\)) in Formula (8) are further normalized, i.e.,\(w_{i}\) is updated to \(w_{i}/\sum_{i=1}^{m}w_{i}\) in the experiment. In general, with this intuitive weight assignment strategy, the shape matching process pays more attention to the key parts of the spinal image, which will further improve the Lenke classification performance.