# Modeling of Hidden Markov in Ultrasound Image-Assisted Diagnosis

Authors: Liping Shao; Zubang Zhou; Hongmei Wu; Jinrong Ni; Shulan Li
Journal: Journal of Healthcare Engineering
 (2021)

---

## Abstract

Different segmentation of lung nodules using the same segmentation algorithm can easily lead to excessive segmentation errors. Therefore, it is necessary to design an effective segmentation algorithm to improve image segmentation accuracy. Based on the hidden Markov model, this study processed the ultrasound images of pulmonary nodules to improve their diagnostic results. At the same time, this study was combined with the ultrasound image of lung nodules to process the ultrasound images. In addition, this study combines the convex hull algorithm for image processing, uses the improved vector method to repair, improves image recognizability, establishes a reliable feature extraction algorithm, and establishes a comprehensive diagnostic model. Finally, this study designed the test for performance analysis. Through experimental research, it can be seen that the model constructed in this study has certain clinical effects and can provide theoretical reference for subsequent related research.


---

## Body

## 1. Introduction

At present, there are more and more patients with clinical pulmonary nodules. The 1–30 mm lung nodules found by X-ray or chest CT account for 0.2% or 1%, respectively. Most of them are benign nodules, and malignant knots account for 20%. Meanwhile, as the size of nodules increases, the malignant rate fluctuates between 3% and 80%. When the diameter of nodules is between 4 and 7 mm, the incidence of malignant nodules is 1%; when the nodules are 8–20 mm in diameter, malignant nodules account for 18%; when the diameter of nodules is greater than 20 mm, the malignant rate is as high as 50%. At present, the nature of pulmonary nodules is determined by chest CT-guided percutaneous lung biopsy, bronchoscopy, or even open lung biopsy to confirm the pathology. These invasive procedures have the disadvantages of high risk and uneconomical and even bring unnecessary harm to patients with benign pulmonary nodules.Since the 1990s, lung nodule detection based on CT images has gradually become an important research content in the field of computer-aided diagnosis. Moreover, many universities and research institutions at home and abroad have carried out a lot of experimental work on the construction of lung nodule detection models.In the exploration of research methods, many scholars took pulmonary nodules as the research object to conduct image segmentation. Wang et al. [1] first segmented the lung parenchyma based on the regional growth method and isolated the ROI from the lung parenchyma according to the Gaussian mixture model and the Hessian matrix. Then, they selected Tsallis entropy and Shannon entropy as descriptive features and used the support vector machine (SVM) to classify lung nodules and nonnodular regions. Meanwhile, José et al. [2] used clustering coarse segmentation using growing neural gas (GNG). Then, they separated the lung nodules from the tissues containing blood vessels and bronchus according to the three-dimensional distance transformation. Finally, the SVM was used to effectively identify the lung nodules based on the extracted shape features and texture features. Furthermore, Jacobs et al. [3] integrated fuzzy threshold, Gaussian matrix, mean curvature, Hessian matrix, and other algorithms to extract the ROI. Then, they use local shape features and local divergence information as the feature expression of ROI and, finally, use weighted SVM to identify and detect lung nodules. Perandini et al. [4] performed segmentation of pulmonary nodules based on vascular and nodule enhancement filters proposed by Li et al. [5]. Then, they locate the cluster center of the lung nodules based on the divergence calculated based on the Gaussian template to achieve ROI extraction. Finally, the genetic algorithm-based classifier, artificial neural network (ANN), SVM, and three kinds of classifiers were used to compare and analyze the detection effect of lung nodules. Kim et al. [6] extracted the ROI by using the region growth algorithm and morphological operation and then reconstructed the spline surface based on the 3D spring model, which facilitated the extraction of relevant 3D gray features and shape features, and finally used ANN to detect the lung nodules. Guedes et al. [7] proposed a method of genetic algorithm template matching (GATM), which is first used for the rough detection of pulmonary nodule region, and then, the nodule misjudgment region is eliminated by combining the shape of the region and the gradient characteristic rule of the gray scale. Boididou et al. [8] first constructed a probabilistic statistical model based on lung nodule data and used the model to determine whether candidate nodules in CT images were connected to other lung tissues. They then form a fully automated 3D pixel segmentation of the pulmonary nodules, blood vessels, thoracic cavity, and lung parenchyma through a unified feature set and classifier and use a probabilistic classifier to determine the relationship between the candidate node and the lung tissue structure. Plapous et al. [9] first separated the lung parenchyma from the CT image, calculated the statistical parameters (such as mean, standard deviation, skewness, peak, fifth standard deviation, and sixth central moment) from the segmentation results, and finally obtained better classification results using BP neural network.According to the research status of the pulmonary nodule detection algorithm, although the construction method of the lung nodule CAD model is different, it basically includes the following three important steps: (1) ROI segmentation of pulmonary nodules, (2) feature extraction and selection, and (3) classification recognition of candidate regions. Among them, ROI segmentation is the premise of feature level fusion, which provides an important research object for further research of feature level fusion. However, there are still some shortcomings in the ROI segmentation algorithm of lung nodules. The main reason is that most segmentation algorithms based on two-dimensional images will lose the spatial structure information of ROI, which is not conducive to the extraction of three-dimensional features. Moreover, the segmentation algorithm is designed with less consideration for the adjacent relationship between the lung nodules and other tissues, and the same segmentation algorithm for different types of lung nodules is likely to cause excessive segmentation errors. Therefore, it is necessary to design an effective segmentation algorithm to improve the segmentation accuracy of ROI. Feature extraction and selection and classification recognition of targets can be attributed to the main content of image feature level fusion method. In order to further analyze the problems in the detection algorithm of pulmonary nodules, based on the hidden Markov model, this study studied the ultrasound images of pulmonary nodules and strived to improve the application of this model in the diagnosis of pulmonary nodules.


## 2. Research Method

### 2.1. Segmentation Process of Lung Nodule Images

The process of segmentation of lung parenchyma is mainly divided into three steps: initial contour segmentation of the lung, lung contour repair, and lung parenchymal extraction. The overall process of the algorithm is shown in Figure1 [10].(1)
Binary image: in the CT image of the lung, it includes not only high-density areas such as bones, soft tissues, and blood vessels around the chest but also low-density areas such as lung parenchyma and trachea, as well as background interference areas such as scan beds and clothes outside the chest. Objects or tissues of different densities have different CT values. Therefore, if a uniform threshold is used for segmentation, the effect of lung image obtained is poor and has a greater influence on subsequent processing. Therefore, the original lung image is binarized using the OTSU threshold method.(2)
Remove trachea and other backgrounds: first, the binary image is subjected to a region filling hole operation, and the background region (lung parenchyma and trachea, etc.) inside the white portion is filled with white. Next, the filled image is subtracted from the original binary image to obtain a binary image including lung parenchyma and trachea and other interference items, as shown in Figure2 [11].Figure 1
Flowchart of segmentation of lung parenchyma.Figure 2
Initial contour segmentation of the lungs.For a point set S on a plane, the convex hull is the smallest convex polygon that can contain all points in the point set S. The most widely used is the Graham scanning method, and the algorithm is shown in Figure3 [12].Figure 3
Schematic diagram of convex hull algorithm.The 2D convex hull algorithm mainly consists of 3 steps:Step 1: start selection and point set sorting. For a set of points withn points on the plane, we first select the point with the smallest Y coordinate. If there are multiple points, we select the point with the smallest X coordinate as the starting point, i.e., P0 point. After that, the algorithm scans all other points counterclockwise from the starting point for sorting, sorting from the positive angle between the point Pii=1,2,3,…,n−1 to the point P0 and the X-axis from small to large. If there is the same angle, the point with a small Y coordinate is preferred. After sorting, the point set is [13](1)S=P0,P1,…,Pn−1.Step 2: according to the sort order, the points are taken Graham scan. It is known thatP0 is a bump, and it is first determined whether P1 is a bump. The cross-multiplication result of vector P1, P0 and P2, P1 formed by P2, P1, and P0 are calculated to determine whether P1 is a bump, and the condition is [14](2)P1P0×P2P1=X1Y2−X2Y1≥0.In the formula,P1P0=X1,Y1,P2P1=X2,Y2. If P1 is a bump, the algorithm then determines if the next point P2 is a bump, i.e., P3P2×P2P1≥0 and so on.Step 3 (backtracking operation): if the current pointPk is not a bump, that is, Pk+1Pk×PkPk−1<0k=1,2,3,…,n−2, the algorithm performs a backtracking operation: The vector cross-multiplication Pk+1Pk−1×Pk−1Pk−2k=2,3,…,n−2 of the previous point Pk−1I of the current point is calculated. If Pk−1 is not a bump, then the vector cross-multiplication Pk+1Pk−2×Pk−2Pk−3 of the previous point Pk−2 of Pk−1 is determined and so on. Until the calculation point is a bump, the backtracking ends. After that, the concavity of the next point Pk+1 is recalculated until all points are considered. All the bumps obtained are two-dimensional convex hull point sets, and the sequential connection point sets obtain two-dimensional convex hulls [15].In this paper, the segments to be repaired are divided into two categories according to the numberN of points between the two convex hull points of the segment to be repaired. The number of points is less than the threshold N0 which is the first type and is mainly the outer contour depression and can be directly repaired by directly connecting the two convex points. The number of points is larger than the threshold N0 which is the second type and is mainly the inner contour depression and cannot be directly repaired. In this paper, the improved vector bump method is used to repair the internal cavity. Among them, the empirical value is N0=120 [16].


### 2.2. Pulmonary Parenchymal Repair of Improved Vector Method

Aiming at the problem that the convex hull algorithm is used to repair the crossover effect of the internal contour of the lung parenchyma, this paper uses the improved vector method to repair. For simple polygons, it is a simpler method to use the cross-multiplication of vectors to determine the concavity and convexity of polygon vertices. The vertex concavity is judged by calculating the crossover of the two vectors a andb formed by the two points to be processed and the two adjacent points [17].Figure 4
3∗3 coordinate point map.The bumps obtained by the original vector product are processed.Step 1: when the number of points between two adjacent bumps (points withr greater than 0) is n≥0, the sum of the vector crosses of all the points between the two points is calculated. If sum≥0, the bump is retained, otherwise it is not retained.Step 2: when the number of adjacent two bumps isn=0, one of the bumps is reserved. According to experimental experience, the algorithm retains the next bump, as shown in Figure 4 [18].Step 3: on the basis of Steps 1 and 2, one of the two bumps in the remaining convex points is rounded off. This step is used to remove the situation where two bumps may be closer in the steps of Steps 1 and 2. For example, the vector product of consecutive 3 points is greater than zero. According to the experimental experience, it is judged whether or not a bump is discarded by the number of points between two adjacent bumps, and the empirical value isM0=5. If it is less than the threshold M0, the previous bump is discarded, and the next bump is retained, otherwise no operation is performed. After the above three steps, a new bump is obtained.


### 2.3. Feature Extraction of This Study

This paper is mainly for the automatic detection of isolated solid nodules and adhesion pleural nodules. Therefore, in the feature extraction, only the two types of nodules are extracted. The extracted features in this paper are mainly divided into gray features, geometric features, shape features, texture features and so on, as shown in Table1 [19].(1)
Grayscale features (gray meanM and variance σ2): assuming that Ii,j is the gray value of an arbitrary point in the image, and N is the length and width of the image, the corresponding image gray mean and gray variance calculation formulas are as follows [20]:(3)M=1N2∑i=1N∑j=1NIi,j,(4)σ2=1N2∑i=1N∑j=1NIi,j.Gray level entropyH: the gray level entropy is represented by H. Image entropy is a statistical form of feature that reflects the amount of average information in an image. Moreover, the one-dimensional entropy of an image represents the amount of information contained in the aggregated features of the grayscale distribution in the image. Assuming that Pi is set to represent the proportion of pixels whose gray value is i in the image, the formula for calculating the unary gray entropy of the gray image is as follows:(5)H=−∑i=0255PilogPi.Among them,Pi is a gray value corresponding to the probability of occurrence in the image, which is obtained by gray histogram statistics.(2)
Geometric features: the diameter of the region is indicated byD, which is defined herein as the diameter of a circle having the same area as the region of interest. D=sqrt4∗Area/Pi can be obtained by deriving the area A.Area perimeterL: currently, there are many ways to calculate the perimeter of a region. Among the methods of chain code, Freeman chain code is the most widely used. In this paper, by extracting the contour boundary of the region of interest, the number of boundary points is equivalent to the perimeter of the equivalent replacement region, which achieves the purpose of fast calculation.(3)
Shape feature (long axish and short axis O): the main axis extracted in this paper is the long axis length of the candidate region based on the regionprops method in MATLAB, which is defined as the long axis length of the ellipse with the same standard second-order central moment as the region (in the sense of pixels). The minor axis is defined as the short axis length of the ellipse having the same standard second-order center moment as the region (in the sense of pixels). The long and short axes are represented in the area as shown in Figure 5.When calculating the long and short axes, we first define thep+q order center moment of the area image as μpq, and the calculation formula is(6)μpq=∑i∑ji−i0pj−j0qIi,j.Among them,i0 and j0 are the centroid abscissa and ordinate of the region, respectively. Then, the major and minor axes of the regional equivalent ellipse are(7)h=22μ20+μ02+μ20−μ022+4μ112μ001/2,(8)o=22μ20+μ02−μ20−μ022+4μ112μ001/2.The regional linearityx is also known as the aspect ratio or the fine length. The length and width are, respectively, the length and width of the smallest rectangle MER of the candidate region, and the corresponding calculation formula is as follows:(9)X=WMERHMER.This feature was chosen primarily for the differentiation of tubular vessels and round nodules. The eccentricity feature is defined as the eccentricity of an ellipse with the same standard second-order central moment as the region, that is, the ratio of the major axis to the minor axis of the ellipse. Among them, the length of the major axis isa and the length of the minor axis is b:(10)Ec=ab.The theory shows that if a andb are closer, that is, the ellipse having the same standard second-order central moment as the region is closer to a circle, the Ec value is closer to l. However, it does not necessarily mean that the candidate area is close to a circle. The calculation formula is(11)So=AreaConvexArea.ConvexArea is the smallest convex polygon area, and Area is the region area. At the same time, the pixel ratio Ex in the region and its minimum boundary rectangle, also known as the rectangle, is calculated as(12)Ex=AreaBoxArea.Among them, Area is the region area, BoxArea is the minimum bounding rectangle area, and Ex actually reflects the extent of the area's extended range. RoundnessS: roundness is one of the commonly used methods for measuring circularity, reflecting the proximity of the region to the circle, which is defined as(13)S=4πAreaL2.WhenS=1, the shape is a circle, and the larger the S, the more irregular the shape. The Fourier descriptor has deformation independence such as translation, rotation, and scaling and has better robustness when representing object features. In this paper, based on MATLAB’s countercontour extraction algorithm, the region contour is obtained and stored in a two-dimensional matrix. After that, the coordinates of the contour boundary points are represented by complex numbers and then converted and stored in the one-dimensional array T to facilitate the late fast Fourier transform. The coordinate complex number is expressed as follows:(14)ti=xi+jyi.Among them,j is a complex symbol and i is a corresponding boundary point number. The Fourier transform is performed on the T array (in this case, the fft fast Fourier transform is used), and the transform is a one-dimensional Fourier transform, that is, the time domain signal is converted into a frequency domain signal. The corresponding transformation formula is(15)au=1N∑I=0N−1tie−j2πui/N.In the formula,N is the number of boundary points, u=0,1,…N−1 …1. Since the data obtained by fft is not symmetrical with the frequency, the fftshifl operation is performed to make the images of the positive semiaxis portion and the negative half-axis portion symmetrical about the respective centers. After that, the DC component of fft is moved to the center of the spectrum. That is, assuming that the spectral image is divided into four parts by one horizontal line and one vertical line, the fftshift operation exchanges the divided four-part diagonal and the diagonal matrix.(4)
Texture features: the methods for extracting image texture features can be roughly divided into four categories: statistical-based methods, model-based methods, signal processing-based methods, and structural analysis-based methods. The first three categories are more commonly used.Table 1
Feature extraction of this study.
Feature categorySpecific characteristicsGrayscale featureGray mean, gray variance, and gray entropyGeometric featuresArea, diameter, and perimeterShape featureLong axis, short axis, linearity, eccentricity, convexity, and squarenessTexture featureEnergy, contrast, and inverse momentFigure 5
The long and short axes of the area graphic.There are more than a dozen image features extracted based on GLCM, but there are many features of correlation. According to the research by Ulaby and Baraldi et al., several of the features with the strongest discriminative ability are extracted, which are contrast, energy, and correlation.(1)
The energy is represented by ASM, that is, the sum of the squares of the probability values of all the elements in the gray level co-occurrence matrix, which is a reflection of the uniformity in the gray value distribution of the image and the thickness of the texture. If all values of the co-occurrence matrix are equal, the energy value is small. If some values are large and other values are small, the corresponding energy value is larger. When the element distribution is concentrated, the corresponding energy value is larger, and the corresponding calculation formula is as follows:(16)ASM=∑i∑jPi,j2.(2)
Contrast, also known as contrast, is represented by CON, which is a reflection of whether the image is clear and the depth of the groove. Among them, if the groove of the texture is deeper, the corresponding contrast will be larger, and the corresponding visual effect will be clearer. Conversely, if the grooves are shallow, the contrast will be smaller, and the effect will be more blurred. The corresponding calculation formula is as shown in (10):(17)CON=∑i∑ji−j2Pi,j.(3)
Correlation, also known as the inverse moment, is represented by IDM, which reflects the homogeneity of the image texture and measures how much the image texture changes locally. A large value indicates a lack of variation between different regions of the image texture, and the locality is very uniform. The corresponding calculation formula is as shown in (11):(18)IDM=∑i∑jPi,j1+i−j2.In order to describe the texture information of the candidate nodule part obtained by segmentation more accurately, the candidate region is segmented again by the method of minimum enclosing rectangle, which performs texture feature extraction for the smallest rectangular region instead of texture analysis for the whole image.


## 2.1. Segmentation Process of Lung Nodule Images

The process of segmentation of lung parenchyma is mainly divided into three steps: initial contour segmentation of the lung, lung contour repair, and lung parenchymal extraction. The overall process of the algorithm is shown in Figure1 [10].(1)
Binary image: in the CT image of the lung, it includes not only high-density areas such as bones, soft tissues, and blood vessels around the chest but also low-density areas such as lung parenchyma and trachea, as well as background interference areas such as scan beds and clothes outside the chest. Objects or tissues of different densities have different CT values. Therefore, if a uniform threshold is used for segmentation, the effect of lung image obtained is poor and has a greater influence on subsequent processing. Therefore, the original lung image is binarized using the OTSU threshold method.(2)
Remove trachea and other backgrounds: first, the binary image is subjected to a region filling hole operation, and the background region (lung parenchyma and trachea, etc.) inside the white portion is filled with white. Next, the filled image is subtracted from the original binary image to obtain a binary image including lung parenchyma and trachea and other interference items, as shown in Figure2 [11].Figure 1
Flowchart of segmentation of lung parenchyma.Figure 2
Initial contour segmentation of the lungs.For a point set S on a plane, the convex hull is the smallest convex polygon that can contain all points in the point set S. The most widely used is the Graham scanning method, and the algorithm is shown in Figure3 [12].Figure 3
Schematic diagram of convex hull algorithm.The 2D convex hull algorithm mainly consists of 3 steps:Step 1: start selection and point set sorting. For a set of points withn points on the plane, we first select the point with the smallest Y coordinate. If there are multiple points, we select the point with the smallest X coordinate as the starting point, i.e., P0 point. After that, the algorithm scans all other points counterclockwise from the starting point for sorting, sorting from the positive angle between the point Pii=1,2,3,…,n−1 to the point P0 and the X-axis from small to large. If there is the same angle, the point with a small Y coordinate is preferred. After sorting, the point set is [13](1)S=P0,P1,…,Pn−1.Step 2: according to the sort order, the points are taken Graham scan. It is known thatP0 is a bump, and it is first determined whether P1 is a bump. The cross-multiplication result of vector P1, P0 and P2, P1 formed by P2, P1, and P0 are calculated to determine whether P1 is a bump, and the condition is [14](2)P1P0×P2P1=X1Y2−X2Y1≥0.In the formula,P1P0=X1,Y1,P2P1=X2,Y2. If P1 is a bump, the algorithm then determines if the next point P2 is a bump, i.e., P3P2×P2P1≥0 and so on.Step 3 (backtracking operation): if the current pointPk is not a bump, that is, Pk+1Pk×PkPk−1<0k=1,2,3,…,n−2, the algorithm performs a backtracking operation: The vector cross-multiplication Pk+1Pk−1×Pk−1Pk−2k=2,3,…,n−2 of the previous point Pk−1I of the current point is calculated. If Pk−1 is not a bump, then the vector cross-multiplication Pk+1Pk−2×Pk−2Pk−3 of the previous point Pk−2 of Pk−1 is determined and so on. Until the calculation point is a bump, the backtracking ends. After that, the concavity of the next point Pk+1 is recalculated until all points are considered. All the bumps obtained are two-dimensional convex hull point sets, and the sequential connection point sets obtain two-dimensional convex hulls [15].In this paper, the segments to be repaired are divided into two categories according to the numberN of points between the two convex hull points of the segment to be repaired. The number of points is less than the threshold N0 which is the first type and is mainly the outer contour depression and can be directly repaired by directly connecting the two convex points. The number of points is larger than the threshold N0 which is the second type and is mainly the inner contour depression and cannot be directly repaired. In this paper, the improved vector bump method is used to repair the internal cavity. Among them, the empirical value is N0=120 [16].


## 2.2. Pulmonary Parenchymal Repair of Improved Vector Method

Aiming at the problem that the convex hull algorithm is used to repair the crossover effect of the internal contour of the lung parenchyma, this paper uses the improved vector method to repair. For simple polygons, it is a simpler method to use the cross-multiplication of vectors to determine the concavity and convexity of polygon vertices. The vertex concavity is judged by calculating the crossover of the two vectors a andb formed by the two points to be processed and the two adjacent points [17].Figure 4
3∗3 coordinate point map.The bumps obtained by the original vector product are processed.Step 1: when the number of points between two adjacent bumps (points withr greater than 0) is n≥0, the sum of the vector crosses of all the points between the two points is calculated. If sum≥0, the bump is retained, otherwise it is not retained.Step 2: when the number of adjacent two bumps isn=0, one of the bumps is reserved. According to experimental experience, the algorithm retains the next bump, as shown in Figure 4 [18].Step 3: on the basis of Steps 1 and 2, one of the two bumps in the remaining convex points is rounded off. This step is used to remove the situation where two bumps may be closer in the steps of Steps 1 and 2. For example, the vector product of consecutive 3 points is greater than zero. According to the experimental experience, it is judged whether or not a bump is discarded by the number of points between two adjacent bumps, and the empirical value isM0=5. If it is less than the threshold M0, the previous bump is discarded, and the next bump is retained, otherwise no operation is performed. After the above three steps, a new bump is obtained.


## 2.3. Feature Extraction of This Study

This paper is mainly for the automatic detection of isolated solid nodules and adhesion pleural nodules. Therefore, in the feature extraction, only the two types of nodules are extracted. The extracted features in this paper are mainly divided into gray features, geometric features, shape features, texture features and so on, as shown in Table1 [19].(1)
Grayscale features (gray meanM and variance σ2): assuming that Ii,j is the gray value of an arbitrary point in the image, and N is the length and width of the image, the corresponding image gray mean and gray variance calculation formulas are as follows [20]:(3)M=1N2∑i=1N∑j=1NIi,j,(4)σ2=1N2∑i=1N∑j=1NIi,j.Gray level entropyH: the gray level entropy is represented by H. Image entropy is a statistical form of feature that reflects the amount of average information in an image. Moreover, the one-dimensional entropy of an image represents the amount of information contained in the aggregated features of the grayscale distribution in the image. Assuming that Pi is set to represent the proportion of pixels whose gray value is i in the image, the formula for calculating the unary gray entropy of the gray image is as follows:(5)H=−∑i=0255PilogPi.Among them,Pi is a gray value corresponding to the probability of occurrence in the image, which is obtained by gray histogram statistics.(2)
Geometric features: the diameter of the region is indicated byD, which is defined herein as the diameter of a circle having the same area as the region of interest. D=sqrt4∗Area/Pi can be obtained by deriving the area A.Area perimeterL: currently, there are many ways to calculate the perimeter of a region. Among the methods of chain code, Freeman chain code is the most widely used. In this paper, by extracting the contour boundary of the region of interest, the number of boundary points is equivalent to the perimeter of the equivalent replacement region, which achieves the purpose of fast calculation.(3)
Shape feature (long axish and short axis O): the main axis extracted in this paper is the long axis length of the candidate region based on the regionprops method in MATLAB, which is defined as the long axis length of the ellipse with the same standard second-order central moment as the region (in the sense of pixels). The minor axis is defined as the short axis length of the ellipse having the same standard second-order center moment as the region (in the sense of pixels). The long and short axes are represented in the area as shown in Figure 5.When calculating the long and short axes, we first define thep+q order center moment of the area image as μpq, and the calculation formula is(6)μpq=∑i∑ji−i0pj−j0qIi,j.Among them,i0 and j0 are the centroid abscissa and ordinate of the region, respectively. Then, the major and minor axes of the regional equivalent ellipse are(7)h=22μ20+μ02+μ20−μ022+4μ112μ001/2,(8)o=22μ20+μ02−μ20−μ022+4μ112μ001/2.The regional linearityx is also known as the aspect ratio or the fine length. The length and width are, respectively, the length and width of the smallest rectangle MER of the candidate region, and the corresponding calculation formula is as follows:(9)X=WMERHMER.This feature was chosen primarily for the differentiation of tubular vessels and round nodules. The eccentricity feature is defined as the eccentricity of an ellipse with the same standard second-order central moment as the region, that is, the ratio of the major axis to the minor axis of the ellipse. Among them, the length of the major axis isa and the length of the minor axis is b:(10)Ec=ab.The theory shows that if a andb are closer, that is, the ellipse having the same standard second-order central moment as the region is closer to a circle, the Ec value is closer to l. However, it does not necessarily mean that the candidate area is close to a circle. The calculation formula is(11)So=AreaConvexArea.ConvexArea is the smallest convex polygon area, and Area is the region area. At the same time, the pixel ratio Ex in the region and its minimum boundary rectangle, also known as the rectangle, is calculated as(12)Ex=AreaBoxArea.Among them, Area is the region area, BoxArea is the minimum bounding rectangle area, and Ex actually reflects the extent of the area's extended range. RoundnessS: roundness is one of the commonly used methods for measuring circularity, reflecting the proximity of the region to the circle, which is defined as(13)S=4πAreaL2.WhenS=1, the shape is a circle, and the larger the S, the more irregular the shape. The Fourier descriptor has deformation independence such as translation, rotation, and scaling and has better robustness when representing object features. In this paper, based on MATLAB’s countercontour extraction algorithm, the region contour is obtained and stored in a two-dimensional matrix. After that, the coordinates of the contour boundary points are represented by complex numbers and then converted and stored in the one-dimensional array T to facilitate the late fast Fourier transform. The coordinate complex number is expressed as follows:(14)ti=xi+jyi.Among them,j is a complex symbol and i is a corresponding boundary point number. The Fourier transform is performed on the T array (in this case, the fft fast Fourier transform is used), and the transform is a one-dimensional Fourier transform, that is, the time domain signal is converted into a frequency domain signal. The corresponding transformation formula is(15)au=1N∑I=0N−1tie−j2πui/N.In the formula,N is the number of boundary points, u=0,1,…N−1 …1. Since the data obtained by fft is not symmetrical with the frequency, the fftshifl operation is performed to make the images of the positive semiaxis portion and the negative half-axis portion symmetrical about the respective centers. After that, the DC component of fft is moved to the center of the spectrum. That is, assuming that the spectral image is divided into four parts by one horizontal line and one vertical line, the fftshift operation exchanges the divided four-part diagonal and the diagonal matrix.(4)
Texture features: the methods for extracting image texture features can be roughly divided into four categories: statistical-based methods, model-based methods, signal processing-based methods, and structural analysis-based methods. The first three categories are more commonly used.Table 1
Feature extraction of this study.
Feature categorySpecific characteristicsGrayscale featureGray mean, gray variance, and gray entropyGeometric featuresArea, diameter, and perimeterShape featureLong axis, short axis, linearity, eccentricity, convexity, and squarenessTexture featureEnergy, contrast, and inverse momentFigure 5
The long and short axes of the area graphic.There are more than a dozen image features extracted based on GLCM, but there are many features of correlation. According to the research by Ulaby and Baraldi et al., several of the features with the strongest discriminative ability are extracted, which are contrast, energy, and correlation.(1)
The energy is represented by ASM, that is, the sum of the squares of the probability values of all the elements in the gray level co-occurrence matrix, which is a reflection of the uniformity in the gray value distribution of the image and the thickness of the texture. If all values of the co-occurrence matrix are equal, the energy value is small. If some values are large and other values are small, the corresponding energy value is larger. When the element distribution is concentrated, the corresponding energy value is larger, and the corresponding calculation formula is as follows:(16)ASM=∑i∑jPi,j2.(2)
Contrast, also known as contrast, is represented by CON, which is a reflection of whether the image is clear and the depth of the groove. Among them, if the groove of the texture is deeper, the corresponding contrast will be larger, and the corresponding visual effect will be clearer. Conversely, if the grooves are shallow, the contrast will be smaller, and the effect will be more blurred. The corresponding calculation formula is as shown in (10):(17)CON=∑i∑ji−j2Pi,j.(3)
Correlation, also known as the inverse moment, is represented by IDM, which reflects the homogeneity of the image texture and measures how much the image texture changes locally. A large value indicates a lack of variation between different regions of the image texture, and the locality is very uniform. The corresponding calculation formula is as shown in (11):(18)IDM=∑i∑jPi,j1+i−j2.In order to describe the texture information of the candidate nodule part obtained by segmentation more accurately, the candidate region is segmented again by the method of minimum enclosing rectangle, which performs texture feature extraction for the smallest rectangular region instead of texture analysis for the whole image.


## 3. Results

In order to reduce the computational complexity of the convex hull algorithm, the obtained initial lung region is subjected to boundary tracking, and the boundary is implemented by a two-dimensional convex hull algorithm. The obtained convex hull point set is as shown in Figure6(a). The red circle in the figure indicates the convex point set and the blue is the initial lung outline. In order to determine the recessed area of the lung contour to be repaired, the ratio of the Euclidean distance between the adjacent two convex hull points and the arc length between the two points is calculated for the initial lung contour convex blunt point set. The experience threshold K0=9.67 is selected to obtain the contour depression between the two convex hull points that need to be repaired, which is defined as the segment to be repaired, as shown in Figure 6(b). The section to be repaired has a total of 4 segments, which are determined by 8 convex hull points, and is represented by red circles in Figure 6.Figure 6
Results of the convex hull algorithm. (a) Initial lung wide convex bulge. (b) Convex segment to be repaired.
(a)(b)In this paper, the vector method is improved. First, the extracted bumps are divided into two categories. One type is a bump that has a significant effect on repair and is defined as a necessary bump, mainly concentrated on the contour point, as shown in Figure7(a), the letters A, B, etc. The other type of bumps that have no significant effect on repair is defined as unnecessary bumps, mainly concentrated on jagged boundaries, as indicated by the white arrow in Figure 7(b). In order to reduce the amount of calculation, we need to remove unnecessary bumps as much as possible while retaining the necessary bumps.Figure 7
Improved vector bump method. (a) Original vector result. (b) Improved vector method results.
(a)(b)The patched boundary is shown in Figure8.Figure 8
Repair results of the improved vector method.Since the GLCM is a pixel-level calculation, it takes too much time for the entire image to be calculated, and the calculation task is large. The main factors affecting the calculation amount are three parameters: image gray levelG, two-pixel point distance D, and direction θ.In this paper, the parameters are set from these three aspects to achieve the purpose of reducing the amount of calculation. First, the CT grayscale image of the lung is compressed to 8 levels, and the distanceD is selected to be 1. Since the direction is symmetrical, this article is to ensure that the main direction is considered. To reduce the amount of calculation, the horizontal direction (i.e., 0∘) and the two directions are selected. The corresponding vector parameters are 0Dand−DDas shown in Figure 9.Figure 9
Parameter diagram of the direction vector.The data used in the feature extraction phase of this paper is based on the results of candidate nodule extraction. After some candidate nodules were removed by layering method, 20 features including gradation features, morphological features, geometric features, and texture features of 710 candidate nodule samples were extracted. Among them, the number of samples containing true nodules (i.e., positive samples) is 95, and the number of pseudonodule samples (i.e., negative samples) is 615. Some candidate nodule features are shown in Table2.Table 2
Partial candidate nodule features.
EccentricityConvexityCircularityCompactnessEntropyBoundary delineatorROI0.5270.9450.7758.7620.0020.072ROI0.8970.4320.23386.1650.0530.004ROI0.9120.9400.76013.3860.0020.052ROI0.9530.7800.39625.1270.0040.239ROI0.8250.9500.8747.7520.0010.093ROI0.8570.9640.70811.9980.0020.058ROI0.9210.7770.56317.9530.0020.042


## 4. Discussion and Analysis

For the lung contour depression caused by nodules, based on the traditional two-dimensional convex hull algorithm, this paper uses the improved vector bump method to focus on repairing the internal contour depression of the lung and compares it with the traditional convex hull algorithm and the widely used corner detection method. Corner detection algorithm patching: the corner point is the point where the gray level changes sharply or the curvature value of the edge curve in the two-dimensional image is the important object feature of the image, which plays a key role in pattern recognition and analysis. In this paper, the corner point detection of the lung contour is extracted based on the global and local curvature values. The algorithm can accurately extract good and rough corners, and the calculation amount is small, which is widely used in corner detection.In order to extract the relevant features of the candidate region, the calculation of the regional gray mean and variance is performed for each candidate nodule region obtained after the candidate nodule segmentation and is based on the gray histogram statistics in the region. It should be noted that when calculating the gray value or variance of a certain region, since the gray value of the background region is zero, all the points with the gray value of zero need to be removed when performing gray scale statistics on the entire image, thereby obtaining the histogram statistics of the corresponding candidate nodule regions.Figure7(a) shows the bumps of the inner contour of the initial lung found using the original vector bump method. The red circle in the figure is the obtained bump, and the area marked by the white tip indicates that the bump is too concentrated, which is often caused by noise and the like. The resulting initial pulmonary contour is shown in Figure 7(b). The white arrow is partially jagged and processed by the improved vector method, which successfully removes these unnecessary bumps while preserving the necessary bumps for repair. In this test data, the number of contour points on the inner side of the initial lung is 331, and the original vector bump method finds 88 bumps. However, the improved vector bump method removes unnecessary bumps that have no significant effect on the repair and obtains 16 bump numbers, which greatly reduces the amount of subsequent processing calculations.Through the above analysis, three laws can be drawn. Rule one: the vector consisting of two adjacent coordinates of the lung parenchyma contour in the two-dimensional plane has only eight cases of−1,1, 0,1, 1,1, 1,0, 1,−1, 0,−1, −1,−1, and −1,0, that is, within the range of t points centered on the point, as shown in Figure 6. Among them, 0,0 is the point to be processed and the rest are the adjacent points of the point. The result r of the cross-multiplication between the two points of the pending point and the two adjacent points is only −2,−1,0,1,2. Among them, r is greater than zero, which is a bump, r is less than zero, which is a pit, and r is equal to zero, which is a three-point collinear. Rule 2: unnecessary bumps mainly appear on jagged boundaries. The distribution of the corresponding vector product result r satisfies r>0,r<0,andr=0. That is, when the vector product of the points between adjacent two bumps is less than zero, a depression is formed. Among them, r>0 indicates that the point is a bump, r<0 indicates that the point is a pit, and r=0 indicates that the point is collinear with two adjacent points. Rule 3: the necessary bumps generally appear in pairs, and the number of points between the two necessary bumps is zero or greater than zero. When the number is greater than zero, the vector product r value of the corresponding point is zero, that is, the points between the two necessary bumps only appear collinear, and there is no recess.In this paper, the lung parenchymal contour repair process has also been improved and is mainly divided into four steps:Step 1: according to the bump extracted by the improved vector method, the Euclidean distance from one bump to the other bump is calculated from the first bump. If the Euclidean distance is less than the set thresholdD, the algorithm proceeds to the second step. If the bump to be processed reaches the nearest bump or the distance to the other bump is greater than the threshold D, the next bump of the to-be-processed bump is selected to perform Step 1 operation again.Step 2: the ratiot of the arc length to the distance between the bump to be processed and the closest bump is calculated. If t>T, the two bumps need to be repaired, and the points on the original boundary between the two bumps are stored in an intermediate variable m, otherwise no repair is needed. Among them, T is the empirical threshold and takes the value T=1.3.Step 3: the algorithm continues to calculate the ratiot between the arc length and the distance of the bump to be processed and all other bumps satisfying the condition and performs Step 2 operation. Until the distance between the to-be-processed bump and the ith bump is greater than the set threshold D, the algorithm stops and moves to Step 1 to reselect the next pending point.Step 4: the points in the intermediate variablem are deleted on the boundary of the initial lung contour, and the obtained new coordinate points are connected by straight lines to form a patched edge.


## 5. Conclusion

Based on the hidden Markov model, this study studied the ultrasound images of pulmonary nodules and sought to improve the application of this model in the diagnosis of pulmonary nodules. The process of segmentation of lung parenchyma is mainly divided into three steps: pulmonary initial contour segmentation, lung contour repair, and lung parenchymal extraction. Aiming at the problem that the convex hull algorithm is used to repair the crossover effect of the internal contour of the lung parenchyma, this paper uses the improved vector method to repair. For simple polygons, it is a simpler method to use the cross-multiplication of vectors to determine the concavity and convexity of polygon vertices. In addition, this paper is mainly for the automatic detection of isolated solid nodules and adhesion pleural nodules, so in the feature extraction, only the two types of nodules are extracted. Moreover, the extracted features in this paper are mainly divided into grayscale features, geometric features, shape features, texture features, and so on. Meanwhile, in order to describe the texture information of the candidate nodule part obtained by segmentation more accurately, the candidate area is segmented again by the method of minimum enclosing rectangle, and texture feature extraction is performed for the smallest rectangular area instead of texture analysis for the whole image. The research results show that the algorithm proposed in this study has certain effects on the ultrasound image recognition of pulmonary nodules, which can be gradually applied to clinical practice.



---

*Source: 5597591-2021-04-12.xml*