# Lenke Classification of Scoliosis Based on Segmentation Network and Adaptive Shape Descriptor
## 2 Methods
### Automatic Measurement of Cobb Angle  
The Cobb angle as an objective measure is used to quantify spinal curvature and is important for the Lenke classification system. The Cobb angle is traditionally measured manually by doctors on X-ray images using a pencil and protractor based on their experience. This type of traditional measurement could lead to some errors, and its inter- and intra-observer variability is high. Moreover, the accuracy and consistency of the Cobb angle measurement will affect the Lenk classification results and have significant implications for treating and managing of patients. Therefore, in this section, an automatic and effective Cobb angle measurement approach based on the segmented spinal block is proposed, as explained in the next paragraph. The key links for measuring the Cobb angle based on computer vision are to identify the superior and inferior endplates of each spinal block. As shown in Figure 5, the Cobb angle automatic measurement framework consists of four steps. First, each verteb can be segmented and locally separated by segmentation and using the post-processing algorithm. Second, a canny operator [34] is employed to detect edge of the spinal block, which is almost closed. Then, we traverse the upper and lower edges, respectively, and the sample points at regular intervals and at the same time. These sample points on the upper and lower edges are marked as green and yellow, respectively. As the segmented boundaries of each verteb have a slight bend, some noise points may exist that could affect the fitting results. Therefore, a simple and effective strategy is employed to eliminate the noise and optimize the distribution of the simple points. Mathematically, suppose (\(a_{0}\), \(a_{1}\),..., \(a_{n-1}\)) are sampled \(n\) points, then we define the \(k\)-neighbors angle \(\overline{\theta}_{i}\) for each point \(a_{i}\), according to Formula (4), where we describe the average fluctuation degree of \(a_{i}\). Subsequently, the average angle \(\overline{\theta}\) of \(k\)-neighbors for the sequence of points can be obtained from Formula (5). To better explain these two formulas, we use Figure 5 as an example that has nine sampled points marked as (\(a_{0}\), \(a_{1}\),..., \(a_{9}\)). If \(k\) is set as 2, then each point forms two angles with its left and right neighbor points in turn. Specifically, for \(a_{3}\), \(a_{3}^{\rightarrow}a_{2}\) and \(a_{3}^{\rightarrow}a_{4}\) form an angle denoted as \(\theta_{3}^{1}\), \(  
Then, if point \(a_{i}\) satisfies \((\overline{\theta}-\overline{\theta}_{i}+\pi)\text{mod}\pi>\delta\), then \(a_{i}\) is marked as noise points and will be further eliminated, where \(\delta\) is a threshold that reflects the noise factor. As shown in Figure 5, the point marked as red is the noise point because its average fluctuation angle is quite different from that of other points. Through the preliminary experiment, we found that the noise points are mainly caused by the speckle error of the segmentation model, and there is a large deviation from the real boundary. Therefore, we set \(k\) and \(\delta\) to 3 and \(\pi/6\), respectively. After the optimized simple points have been obtained, the straight line representing the superior and inferior endplates can be determined by least square fit. Finally, as shown in Figure 6, we traverse each of the two vertebra and calculate the angle between the superior and inferior endplates from the two different vertebrae. The largest angle is defined as the Cobb angle. The pseudocode for automatically measuring the Cobb angle is presented in Algorithm 1, where the key details are illustrated in Figure 6. It is worth mentioning that if the Cobb angle is greater than 10\({}^{\circ}\), the scoliosis needs further investigation, and, if the Cobb angle is >25\({}^{\circ}\), then surgical treatment may be inevitable.