Abstract
The study was aimed to explore the segmentation effects of different algorithms on thyroid nodule ultrasound images, so as to better protect the recurrent laryngeal nerve during thyroid surgery. Specifically, 186 patients with thyroid nodules were selected as the research objects. The segmentation performances of the gradient vector flow (GVF) Snake, Watershed, and Snake algorithms were compared from 6 aspects of image segmentation effects, pixel accuracy (PA), Intersection over Union (IOU) value, algorithm running time, postoperative recurrent laryngeal nerve injury, intraoperative bleeding volume, and postoperative drainage volume. It was found that the average PA value (0.954) and the IOU value (0.866) of the GVF Snake algorithm were obviously higher than those of the other two algorithms. The total incidence of recurrent laryngeal nerve injury based on the GVF Snake algorithm (4.69%) was obviously lower than that of the Snake algorithm (19.35%) and the watershed algorithm (16.13%). The bleeding volume and postoperative drainage volume based on the GVF Snake algorithm were less versus the other two algorithms (). In conclusion, the GVF Snake algorithm demonstrates ideal segmentation effects, which is suggested in the treatment of thyroid nodules to better protect the recurrent laryngeal nerve.
1. Introduction
The thyroid gland is an important endocrine organ located just below the thyroid cartilage in the neck. The thyroid hormone produced can regulate the body’s metabolism and internal calcium balance [1]. In recent years, there is an increasing number of people with thyroid diseases, with thyroid nodule being the most common one. Thyroid surgery is a common surgical procedure that is easy to operate [2], but there is a certain risk of complications. If not prevented or treated properly, it may have a lifelong impact on the patient [3, 4]. As a common complication of thyroid surgery, recurrent laryngeal nerve injury has a reported incidence of about 0.3% to 15.4%. An underlying culprit causing the recurrent laryngeal nerve injury is capsule anatomy [5, 6]. The clinical diagnosis reveals that the most likely location for recurrent laryngeal nerve injury is 2 cm before the larynx, which is adjacent to the thyroid gland, covered by Zuckerkandl nodules and surrounded by small branches of the thyroid arteries and veins and vascular fascia. In the thyroid surgery, this segment is easily affected [7]. In addition, thyroid tumor adhesion, compression of the recurrent laryngeal nerve, and secondary operations may also cause damage to the recurrent laryngeal nerve, which cannot be completely avoided in practice [8]. It is manifested as hoarseness, difficulty swallowing, and coughing when drinking water when there is an injury on a single side of the recurrent laryngeal nerve. The recurrent laryngeal nerve injury on both sides has symptoms such as dyspnea, which can endanger life in severe cases [9].
The ultrasound is extensively used in the detection of thyroid nodules due to its cheap and noninvasive characteristics and is currently the preferred imaging method for thyroid diseases [10]. The high-resolution ultrasound image enables doctors to perform the targeted treatment by determining the location of thyroid nodules and the degree of calcification, and image segmentation technology plays a key role in the treatment of thyroid nodules. However, the edge of the ultrasound image is often blurred as a result of low image resolution or different degrees of diseases [11], and speckle noise occurs due to the influence of ultrasonic echo [12]. At present, the diagnosis of thyroid nodules mainly relies on manual image segmentation by doctors, who make subjective judgments based on their experience. The judgment results are not so precise to some extent and may be a risk factor of complications [13]. The purpose of image segmentation is to make the contour line or the object surface itself consistent with the edge of the target object or the feature shape expected to be detected in the image. However, the traditional Snake algorithm is not easy to converge concave images, and the range of action is small, and it may converge to the local minimum [14]. The watershed algorithm uses the similarity of adjacent pixels on the image as a reference basis to segment the image, but due to the presence of noise or other interference factors on the real image, the watershed algorithm is likely to be oversegmented [15]. Therefore, improved algorithms such as the GVF Snake algorithm essentially have the ability to process concave images, but it has not yet been confirmed in the segmentation of thyroid nodules.
Based on this, the segmentation performances of different algorithms were compared in the study to identify the most suitable one to enhance the surgical treatment of thyroid nodules, which provided a theoretical basis for the clinical treatment of thyroid nodules.
2. Materials and Methods
2.1. Research Subjects
In the study, 186 patients with thyroid nodules admitted to the hospital from January 2013 to May 2020 were selected and separated into 3 groups based on different segmentation algorithms at random, with 62 in each group. Group A applied the GVF Snake algorithm (25 males, 37 females; mean age 37.44 ± 8.23 years, range 21–49). Group B adopted the Snake algorithm (23 males, 39 females; mean age 39.91 ± 8.72 years; range 23–53). Group C used a watershed algorithm (28 males, 34 females; mean age 36.48 ± 7.89 years; range 22–51). Characteristics variables included age, sex, and the surgery method. There was no notable difference between the three groups (). The study has got permission from the ethics committee of the hospital, and patients and their families were informed of the study and signed the consent forms.
Inclusion criteria: (i) Patients older than 18 years; (ii) Patients with complete preoperative ultrasound examination data; (iii) Patients diagnosed with benign thyroid nodules; (iv) Patients with normal coagulation functions; (v) Patients with no other diseases of the nervous system, respiratory system, digestive system, or endocrine system.
Exclusion criteria: (i) Patients with secondary thyroid surgery; (ii) Patients with Graves disease; (iii) Patients with abnormal coagulation functions; (iv) Patients with incomplete clinical data; (v) Patients who were not suitable for this study for other reasons.
2.2. The Edge Segmentation Algorithm of Thyroid Nodule
In this study, GVF Snake algorithm is used for image segmentation of thyroid nodules. Snake is a classic parameter active contour model, which simplifies the calculation method of image processing. The algorithm can be regarded as an energy function, which uniformly transforms image processing into a problem of finding the minimum energy of a functional function [16]. Snake algorithm initializes a closed contour curve near the segmented object, and the energy function is minimized so that the contour curve expands or contracts according to the established algorithm and finally stops at the target boundary. The closed curve obtained is the segmentation contour of the image [17]. The contour curve of the Snake function is . In which, and are the specific coordinates of the control points on the contour curve in the image, are the independent variables used to describe the boundary by Fourier Transform. The energy function of this contour line is as follows:
In which, represents the internal energy of the contour, represents the external energy, and represents the conditional energy, that is, the item related to the variance.
After the energy minimization, the closed curve obtained by convergence is the target contour curve. According to the Euler formula, the necessary conditions for the minimum value of the functional function are as follows:
In which, and represent the first and second differential of the equation , and represents the sum of and .
Being continuously smooth, the Snake algorithm can converge to a contour of any shape, but it is dependent on the initial contour, and it often fails to converge in the depression of the image edge [18]. Then, the concept of Gradient Vector Flo (GVF) is proposed. The GVF Snake algorithm replaces the energy of some edge corners on the image with a gradient vector field. It redefines the external force, and its external force is the force derived from the edge of the image and no longer depends on the position of the initial contour of the image [19, 20]. The gradient vector flow defined by the GVF Snake algorithm is , and the following function is obtained through energy minimization:
In which, represents the Laplace transform, is a positive coefficient, represents the smoothing term of , represents the data item of . When it is far away from the edge area of the target image, the value is smaller, and the equation is mainly determined by . When it is close to the edge area of the target image, the value is larger, and the equation is mainly determined by . At this time, the data item promotes the active contour line to move to the boundary and the image edge segmentation is realized.
Finally, the Euler-Lagrange equation is used to solve equation (3), and a partial differential equation about is obtained.
2.3. Denoising of the Original Ultrasound Image
Affected by equipment, environment, and other factors during the image acquisition process, some noise will inevitably appear [21]. To solve the speckle noise problem, a partial differential equation is introduced to denoise the image. represents an ideal image, represents a noisy image, represents noise, and the relationship between the three can be expressed as follows:
To obtain a noise-free image , the following partial differential equation is established:
In which, represents the image domain. Using Lagrange equation and gradient descent method to solve equations (6) and (7) can be obtained.
In which, , represents the Lagrange multiplier, and the calculation equation of is as follows:
The image denoised by equation (7) is shown in Figure 1.

2.4. The Performance Test of the GVF Snake Algorithm
To analyze the segmentation effects of the GVF Snake algorithm, the region-based Watershed Algorithm and the contour-based Snake algorithm were introduced to compare the PA and IOU values of the three algorithms, calculated as follows:
In which, represents the image area obtained by the algorithm and represents the area obtained by manual segmentation, that is, the real area.
2.5. The Recurrent Laryngeal Nerve Examination
Before the thyroid surgery, the patients were tested by a laryngoscope, and there were no symptoms of vocal cord dysfunction or vocal cord paralysis so as to ensure that the recurrent laryngeal nerve injury was caused by the operation. After the operation, if the patient had a hoarse voice and the vocal cords were found to have dyskinesias by the laryngoscopy, it was defined as the recurrent laryngeal nerve injury. If it recovered within 6 months, it was defined as a one-time injury. Otherwise, it was defined as a permanent injury.
2.6. Statistics
The data was processed by SPSS19.0. The measurement data were calculated as mean ± deviation. The SNK-q test was for comparison between groups. was set as the threshold for significance.
3. Results
3.1. Comparison of Segmentation Results
Under the same number of iterations, the segmentation effects of the three algorithms were compared on initial contours with different positions and the same size, as shown in Figures 2, 3, and 4.



In this experiment, an ultrasound image of a patient with a thyroid nodule with a size of 441×358 was selected, and different segmentation methods were used for segmentation. The computer operating system was WIN10, the processor was Intel(R)Core (TM) i5-8400, 3.0GH, and the memory was 32 GB. The software version was MATLAB2014. The number of iterations was set to 700 times, the initial contour radius was 65, and the initial contour center coordinates were the coordinates of the lesion center (263.4, 205.9), the coordinates above the lesion center (263.4, 164.3), and the coordinates on the right of the lesion center (296.8, 205.9). It was evident that the position of the initial contour had different effects on the segmentation effects of different algorithms. The watershed segmentation method and the Snake algorithm segmentation method were more sensitive to the position of the initial contour. When the initial contour was offset from the center point, the segmentation performance was poor. However, the GVF Snake algorithm had more accurate segmentation results with low sensitivity to the initial contour.
3.2. Comparison of PA and IOU Values
To further illustrate the accuracy of the GVF Snake algorithm segmentation, the PA and IOU values were introduced for comparison. A greater PA or IOU value indicated a greater overlapping degree between the segmented area and the real area. Table 1 presents the comparison results of segmentation effects.
In Table 1, ground truth represented the result of manual segmentation by the doctor, and the PA and IOU values were both defined as 1. A, B, and C represented the results of three different segmentation methods. It was evident that the PA and IOU values of the GVF Snake algorithm were higher versus the other two, indicating that GVF Snake demonstrated better segmentation capabilities for thyroid nodule images than traditional segmentation methods. As a result of the influence of noise, the watershed algorithm had oversegmentation. Due to the blurred edges of thyroid nodules, it was difficult for the Snake method to accurately recognize the true contour area, and the segmentation effects were very poor. In contrast, the GVF Snake had the best segmentation performance.
3.3. Algorithm Running Time Comparison
As shown in Figure 5, the average running time of the GVF Snake algorithm (14.89s) was longer than the Snake algorithm (10.23s) and shorter than the watershed algorithm (19.55s) with beat segmentation effects.

3.4. Comparison of Recurrent Laryngeal Nerve Injury
After the thyroid surgery under the guidance of different algorithms, the patient’s recurrent laryngeal nerve injury status was as shown in Figures 6, 7, and 8. The average running time of groups A, B, and C were 122.45 ± 19.23 min, 118.22 ± 22.81 min, and 120.22 ± 20.81 min ().



Of the 62 patients in group A, postoperative recurrent laryngeal nerve injury occurred in 3 patients. After 6 months of follow-up, it was found that 2 cases had a one-time injury, with an incidence of 3.13% (2/62), and 1 case was with a permanent injury, with an incidence of 1.56% (1/62). The total incidence rate of recurrent laryngeal nerve injury in group A was 4.69% (3/62).
Of the 62 patients in group B, hoarseness was noted in 12 patients. After 6 months of follow-up, it was found that 8 cases had a one-time injury with an incidence rate of 12.9% (8/62), and 4 cases had a permanent injury with an incidence rate of 6.45% (4/62). The total incidence rate of recurrent laryngeal nerve injury in group B was 19.35% (12/62).
Among the 62 patients in group C, 10 had recurrent laryngeal nerve injury. After 6 months of follow-up, it was found that 7 cases were with one-time injury, with an incidence rate of 11.29% (7/62), and 3 case was with a permanent injury, with an incidence of 4.84% (3/62). The total incidence of recurrent laryngeal nerve injury in group C was 16.13% (10/62). There was a notable difference between the three groups ().
3.5. Comparison of Intraoperative Bleeding Volume and Postoperative Drainage Volume
As shown in Figure 9 and 10, the average intraoperative blood loss (56.42 mL) and the average postoperative drainage (27.21 mL) of the GVF Snake algorithm were less than the watershed algorithm (85.46 mL, 47.33 mL) and the Snake algorithm (76.98 mL, 39.25 mL) ().


4. Discussion
The thyroid is a common clinical malignant tumor, especially papillary cancer. The clinical treatment of thyroid is mainly surgical resection, which is efficient. At present, basically, the clinical best treatment for thyroid nodules is not controversial, but the scope of surgical resection is on the contrary because different surgical methods cause different recurrent laryngeal nerve injuries to patients after surgery [22]. Recurrent laryngeal nerve injury is a common complication of thyroid surgery, which seriously affects patients’ lifestyle and physiological functions after surgery [23], so accurate location of the lesion during thyroidectomy is very important.
It was found that the average PA values of GVF Snake, Snake, and watershed algorithms were 0.954, 0.731, and 0.827, and the average IOU values were 0.866, 0.614, and 0.787, respectively, with manually segmented images taken as real images. It was evident that the PA value and IOU value of the GVF Snake algorithm were lower than the Snake and watershed algorithms (), indicating that the GVF Snake algorithm had higher segmentation accuracy and the segmentation contour was closer to the real contour. The image segmentation results also proved this point. This was in line with the findings of Zhang et al. (2016) [24]. After the running time of different algorithms was compared, it was found that under the same number of iterations, the average segmentation time of GVF Snake algorithm (14.89s) was shorter than that of watershed algorithm (19.55s) but longer than that of Snake algorithm (10.23s) (). The reason for the watershed algorithm having the longest running time may be its high sensitivity to the edges of the image, causing oversegmentation due to blurred edges and longer running time. The Snake algorithm had the shortest running time, which may be due to the undersegmentation resulting from the local minimum during the segmentation, and the segmentation effect was poor. In general, the GVF Snake algorithm was superior to the other two segmentation algorithms, and a study by China et al. [25] also reported similar results. From the perspective of the incidence of postoperative recurrent laryngeal nerve injury, the total incidence of postoperative recurrent laryngeal nerve based on the GVF Snake algorithm was 4.69%, lower than the Snake algorithm (19.35%) and the watershed algorithm (16.13%) (). It may be because the GVF Snake algorithm improves the segmentation accuracy, thereby reducing the recurrent laryngeal nerve injury caused by misoperation. Regarding the intraoperative bleeding volume and postoperative drainage volume, the GVF Snake algorithm’s average intraoperative bleeding volume (56.42 mL) and postoperative average drainage volume (27.21 mL) were less than the watershed algorithm (85.46 mL, 47.33 mL) and the Snake algorithm (76.98 mL, 39.25 mL) (). This illustrated that the operation effects based on GVF Snake algorithm were better.
5. Conclusion
To study the segmentation effects of different algorithms on the ultrasound image of thyroid nodules, 186 patients with thyroid nodules from our hospital were selected as the research subjects, and GVF Snake, watershed algorithm, and Snake algorithm were used for image segmentation. After their performances were compared with that of manual segmentation results, the advantages of the GVF Snake algorithm were verified. The results of this research showed that the GVF snake algorithm had a better segmentation effect on thyroid nodules than the Snake algorithm and the watershed algorithm. The segmentation method based on the GVF snake algorithm can effectively reduce the incidence of recurrent laryngeal nerve injury after thyroidectomy, and the clinical operation effect is better. This study proves that the GVF Snake algorithm has a good application prospect in thyroid image segmentation and can reduce recurrent laryngeal nerve damage and assist clinicians in image segmentation of thyroid nodules. The results of this article provide a basis for the clinical treatment of thyroid nodules, and it also has a certain guiding significance for the protection of the recurrent laryngeal nerve.
Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.
Conflicts of Interest
The authors declare that there are no conflicts of interest.
Authors’ Contributions
Jiyuan Wang and Hanqing Zou contributed equally to this work.