An automatic segmentation method of lung parenchyma based on chest CT images
Lung parenchyma regions are automatically extracted through methods such as seed point extraction, region growing and corner detection, and combined with the U-Net network, which solves the problems of low lung parenchyma segmentation efficiency and poor label consistency in the existing technology, achieving efficient and accurate Automatic segmentation and label acquisition of lung parenchyma, supporting three-dimensional reconstruction.
Patent Information
- Application Number
- CN202110960219.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-20
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-08-20
AI Technical Summary
In the existing technology, lung parenchyma segmentation relies on manual intervention and manual labeling, which is inefficient and has poor label consistency, leading to frequent problems such as missed diagnosis and misdiagnosis.
Seed point extraction, region growing, hole filling, corner detection and area threshold methods are used to automatically extract the lung parenchyma area, and combined with the U-Net segmentation network for training, automatic segmentation label acquisition and segmentation network model construction are achieved.
It reduces manual workload, improves segmentation efficiency, ensures the consistency of segmentation labels, and accurately obtains lung parenchyma areas through the trained model to support subsequent three-dimensional reconstruction work.
Smart Images

Figure CN113706492B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of medical image processing, and in particular relates to a method for automatic segmentation of lung parenchyma based on chest CT images. Background Art
[0002] CT imaging is an important technical means for clinical diagnosis of lung diseases, especially for lung cancer. The early discovery and analysis of signs such as lung nodules can enable early clinical intervention and treatment, reducing the risk of disease progression. At present, the analysis of lung nodules in clinical practice mainly relies on clinicians to analyze a large number of two-dimensional CT slice images, which is inefficient and prone to missing some key information, resulting in missed diagnosis and misdiagnosis. Therefore, it is very important to achieve three-dimensional reconstruction of the lung parenchyma area containing lung nodules. As a key area for evaluating and studying diseases, the accurate segmentation and reconstruction of the lung parenchyma is crucial for further research on the organization and lesions of the functions of various lung organs.
[0003] Traditional lung parenchyma segmentation requires manual intervention. Currently, deep learning model methods can be used to segment lung parenchyma, but the acquisition of segmentation labels often requires clinicians to manually annotate, which is labor-intensive and inefficient. At the same time, segmentation labels may come from multiple doctors. Due to differences in relevant medical experience, judgment criteria, etc. among multiple doctors, the consistency of labels will also be affected to a certain extent. Summary of the invention
[0004] In order to solve the above problems, a method for automatic segmentation of lung parenchyma based on chest CT images is provided. The present invention adopts the following technical solutions:
[0005] The present invention provides a lung parenchyma automatic segmentation method based on chest CT images, which is used to extract lung parenchyma areas from chest CT images, and is characterized in that it comprises step S1, using a seed point extraction method to select seed points from the chest CT images; step S2, based on the seed points, using a region growing method and a hole filling method to extract the chest contour; step S3, performing a connected domain analysis within the range of the chest contour to determine whether there are two connected domains with similar areas; step S4, when step S3 determines that the chest contour is no, using a corner point detection method to separate the chest contour to obtain two connected domains; step S5, using an area threshold method to respectively remove trachea areas in the two connected domains to obtain lung parenchyma areas; step S6, using the lung parenchyma area as a label, using the chest CT image corresponding to the lung parenchyma area as an image corresponding to the label to form a training set, training a segmentation network based on the training set to obtain a trained lung parenchyma segmentation grid model, and using the lung parenchyma segmentation grid model to extract the lung parenchyma area from a new chest CT image.
[0006] The automatic lung parenchyma segmentation method based on chest CT images provided by the present invention may also have such a technical feature, wherein the seed point extraction method includes the following steps: Step A1, using a sliding window with a predetermined size and a predetermined step length to perform a global traversal of the chest CT image, and judging whether the average pixel gray value of the image in each sliding window is higher than a set threshold value, when the judgment is yes, the sliding window is used as a preliminary selected sliding window; Step A2, performing a similarity measurement calculation on each preliminary selected sliding window and four sliding windows adjacent to the preliminary selected sliding window, and judging whether the preliminary selected sliding window and the four adjacent sliding windows all have high similarity, when the judgment is yes, extracting the centroid of the preliminary selected sliding window as a seed point.
[0007] The method for automatic segmentation of lung parenchyma based on chest CT images provided by the present invention may also have such a technical feature, wherein the similarity measurement calculation includes grayscale similarity calculation, texture similarity calculation and structural similarity calculation, and the grayscale similarity calculation adopts a mean difference algorithm for calculation:
[0008]
[0009] The texture similarity calculation uses the entropy difference algorithm for calculation:
[0010]
[0011]
[0012] The structural similarity calculation uses the Hamming value based on hash coding:
[0013]
[0014] Where N is the scale of the image, X is the pixel grayscale value of the middle area image, and Y is n is the pixel grayscale value of the domain image of X, E x 、E y is the image entropy, i is the gray value of the pixel, j is the gray mean of the domain image, P ij The probability of the image taking gray value ij.
[0015] The automatic segmentation method of lung parenchyma based on chest CT images provided by the present invention may also have such a technical feature, wherein the region growing method includes the following steps: step B1, the grown region includes the seed point; step B2, searching for pixel points in the four neighborhoods of the seed point and not in the grown region, looking for pixel points whose grayscale values are less than a set threshold, when the pixel point is found, adding the pixel point to the grown region, and using the pixel point as a new seed point, repeating step B2 to perform region growing, when no pixel point is found, stopping the region growing, and the grown region is the chest cavity contour with a hole.
[0016] The automatic lung parenchyma segmentation method based on chest CT images provided by the present invention may also have such technical features, wherein the corner point detection method includes the following steps: step C1, calculating the response value of each pixel point in the image of the chest contour; step C2, selecting two pixel points whose response values are much larger than the response values of other pixel points as two corner points; step C3, connecting the two corner points to achieve separation of the two areas.
[0017] The method for automatic segmentation of lung parenchyma based on chest CT images provided by the present invention may also have such a technical feature, wherein the response value is calculated according to the following formula:
[0018] R = detM-k(traceM) 2
[0019]
[0020] In the formula, R is the response value, M is the intermediate matrix, k is the test constant, w is the Gaussian function, I x ,I y Represent the two gradients of the image in the X and Y directions respectively.
[0021] The automatic lung parenchyma segmentation method based on chest CT images provided by the present invention may also have such technical features, wherein the lung parenchyma area is a binary mask image, the segmentation grid is a U-Net segmentation network, the loss function of the segmentation grid is a cross entropy loss function, and the evaluation index of the segmentation grid is a Dice index.
[0022] Function and Effect of the Invention
[0023] According to the automatic segmentation method of lung parenchyma based on chest CT images of the present invention, due to the adoption of the seed point extraction method, it is possible to automatically select appropriate seed points from the chest CT images; due to the adoption of the region growing method and the hole filling method, it is possible to automatically extract the chest contour based on the seed points; and due to the adoption of the area threshold method, it is possible to remove the trachea regions in the two connected domains respectively, thereby obtaining the lung parenchyma region; further, the obtained lung parenchyma region (i.e., the binary mask image) is used as a label, and the corresponding chest CT image is used as the image corresponding to the label to form a training set, and the segmentation network is trained based on the training set to obtain a trained lung parenchyma segmentation grid model, so that the lung parenchyma segmentation grid model can be used to extract the lung parenchyma region from the new chest CT image. Therefore, through the automatic segmentation method of lung parenchyma based on chest CT images of the present invention, the segmentation label can be automatically obtained, and manual labeling is no longer required, thereby reducing the manual workload and improving efficiency, and because the segmentation label is obtained by a unified method, these segmentation labels have a high consistency. Further, through the trained lung parenchyma segmentation grid model, the lung parenchyma regions of various types of morphology can be more accurately obtained, which improves work efficiency and provides technical support for subsequent three-dimensional reconstruction work. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a step diagram of a method for automatic segmentation of lung parenchyma based on chest CT images in an embodiment of the present invention;
[0025] Figure 2 is a schematic diagram of automatic extraction of seed points in an embodiment of the present invention;
[0026] Figure 3 is a schematic diagram of region growing and chest contour extraction in an embodiment of the present invention;
[0027] Figure 4 is a schematic diagram of the separation of the left and right lung parenchyma regions in an embodiment of the present invention;
[0028] Figure 5 is a diagram showing the final left and right lung parenchyma region extraction results in an embodiment of the present invention;
[0029] Figure 6 Schematic diagram of the structure of the U-Net network in an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the following is a detailed description of the automatic lung parenchyma segmentation method based on chest CT images of the present invention in combination with embodiments and drawings.
[0031] <Example>
[0032] Figure 1 1 is a step diagram of a method for automatic segmentation of lung parenchyma based on chest CT images in an embodiment of the present invention.
[0033] like Figure 1 As shown, a lung parenchyma automatic segmentation method based on chest CT images of the present invention comprises the following steps:
[0034] Step S1, using a seed point extraction method to select seed points from a chest CT image.
[0035] Figure 2 Schematic diagram of automatic extraction of seed points in an embodiment of the present invention.
[0036] like Figure 2 As shown, the seed point extraction method includes the following steps:
[0037] Step A1, using a sliding window with a predetermined size and a predetermined step length to globally traverse the chest CT image, to determine whether the average pixel grayscale value of the image in each sliding window is higher than a set threshold, and if the judgment is yes, the sliding window is used as a preliminary selected sliding window.
[0038] In this embodiment, the size of the sliding window is 25 pixels×25 pixels, and the step length of the sliding window is 25 pixels. Figure 2 The gray square in the upper left corner is a schematic diagram of the sliding window. The threshold is set to 200, that is, the window with an average pixel grayscale value higher than 200 is regarded as the chest contour area and is initially selected. Figure 2 There are 5 sliding windows in the dotted box, and the sliding window in the middle is the initially selected sliding window.
[0039] Step A2, performing similarity measurement calculation on each initially selected sliding window and the four sliding windows adjacent to the initially selected sliding window, determining whether the initially selected sliding window and the four adjacent sliding windows all have high similarity, and when the determination is yes, extracting the centroid of the initially selected sliding window as a seed point.
[0040] In this embodiment, the similarity measurement calculation includes grayscale similarity calculation, texture similarity calculation and structural similarity calculation. The grayscale similarity calculation adopts the mean difference algorithm for calculation. The larger the grayscale difference value of the two images calculated, the higher the similarity of the two images:
[0041]
[0042] The texture similarity calculation uses the entropy difference algorithm. The smaller the entropy difference between the two images, the higher the similarity between the two images:
[0043]
[0044]
[0045] The structural similarity calculation uses the Hamming value based on hash coding. The smaller the Hamming value of the two images is, the higher the similarity of the two images is:
[0046]
[0047] In the above formula, N is the scale of the image, X is the pixel grayscale value of the image in the middle area, and Y is n is the pixel grayscale value of the domain image of X, E x 、E y is the image entropy, i is the gray value of the pixel (0≤i≤255), j is the gray mean of the domain image (0≤j≤255), P ij The probability of the image taking gray value ij.
[0048] When a sliding window and the four sliding windows in its four neighborhoods are highly similar, the sliding window is selected, and the centroid of the image in the sliding window area is used as the seed point, that is, the seed point is a pixel point in the image.
[0049] Figure 2 In the figure, there are 5 sliding windows in the dotted box. The sliding window in the middle is the preliminary selected sliding window, and the surrounding 4 sliding windows are the sliding windows of the four neighborhoods of the preliminary selected sliding window. After the above calculation, these 4 sliding windows are highly similar to the preliminary selected sliding window in the middle, so the sliding window in the middle is selected, and its centroid is used as a seed point.
[0050] As described above, through step S1, a seed point is automatically acquired, and the seed point is one or more pixel points in the chest CT image.
[0051] Step S2: Based on the seed points, the chest contour is extracted using the region growing method and the hole filling method.
[0052] Figure 3 Schematic diagram of region growing and chest contour extraction in an embodiment of the present invention.
[0053] like Figure 3 As shown, the region growing method includes the following steps:
[0054] Step B1, the grown area includes the seed point;
[0055] Step B2, search for the pixels in the four neighborhoods of the seed point that are not in the grown area, and look for pixels whose grayscale values are less than the set threshold. When such a pixel is found, add the pixel to the grown area, and use the pixel as the new seed point, and repeat step B2 to grow the area. When no such pixel is found, stop growing the area. At this time, the grown area is the chest contour with a hole.
[0056] In this embodiment, the threshold is set to 15, that is, the pixels with grayscale values less than 15 are regarded as the chest contour area. Figure 3 As shown, when the above-mentioned region growth stops, a chest contour with two holes is obtained, and then the chest contour with holes is processed using a hole filling method, and the closed holes therein are filled to obtain the entire chest contour area. In this embodiment, the hole filling method is a binary image hole filling algorithm in the prior art.
[0057] As described above, through step S2, the chest cavity contour is extracted.
[0058] Step S3, performing connected domain analysis within the range of the chest contour to determine whether there are two connected domains with similar areas.
[0059] In this embodiment, the connected domain analysis method is a method in the prior art, that is, adjacent pixels with the same pixel value are grouped as a connected domain, and a mark is set for each connected domain to complete the connected domain analysis.
[0060] When the judgment of step S3 is yes, that is, there are two connected domains with similar areas within the range of the chest contour, which means that the separation interface of the left and right lung parenchyma is clearly displayed and no separation processing is required; when the judgment of step S3 is no, it means that the separation interface of the left and right lung parenchyma is not clearly displayed, and they appear to be connected on the chest CT image, and separation processing is required.
[0061] Step S4: when the judgment of step S3 is no, the chest contour is separated using a corner detection method to obtain two connected domains with similar areas.
[0062] In this embodiment, before using the corner point detection method, Gaussian smoothing is first performed on the chest contour.
[0063] Figure 4 Schematic diagram of the separation of the left and right lung parenchyma regions in an embodiment of the present invention.
[0064] like Figure 4 As shown, in this embodiment, the corner point detection method is the Harris corner point detection method, which includes the following steps:
[0065] Step C1, calculating the response value of each pixel in the image of the chest contour;
[0066] Step C2, selecting two pixel points whose response values are much larger than the response values of other pixel points as two corner points;
[0067] Step C3: connect the two corner points to separate the two connected areas.
[0068] The chest contour image was preprocessed and Gaussian smoothed, and then the response value of the pixel in the image was calculated using the following formula:
[0069] R = detM-k(traceM) 2
[0070]
[0071] In the formula, R is the response value, M is a 2×2 intermediate matrix, k is the test constant, w is the Gaussian function, and I x ,I y Represent the two gradients of the image in the X and Y directions respectively.
[0072] By using the above formula, the response value of each point in the chest contour image is calculated, and non-maximum suppression is performed in the 3×3 area to select the point with the local maximum value. Figure 4 As shown in Figure 1, multiple pixels can be obtained through preliminary Harris corner detection, and the connection between the left and right lung parenchyma areas is sharper, so the autocorrelation here is lower and the corner response value is larger. Therefore, save Figure 4 The two points with the largest response values in the upper part of the middle image are selected, and then these two points are connected to separate the left and right lung parenchyma areas and obtain two connected domains with similar areas.
[0073] As described above, through step S4, the situation where the separation interface of the left and right lung parenchyma is not clearly displayed is processed, and two connected domains with similar areas are obtained.
[0074] Step S5, using the area threshold method to remove the trachea regions in the two connected domains respectively, to obtain the lung parenchyma region.
[0075] In this embodiment, the area threshold method is an area threshold algorithm in the prior art, which determines a specific threshold according to the distribution characteristics of the image gray value to perform image segmentation, and is used to remove the trachea area in the two connected domains, thereby obtaining the lung parenchyma area.
[0076] Figure 5 This is a diagram showing the final extraction results of the left and right lung parenchyma regions in an embodiment of the present invention.
[0077] like Figure 5As shown, the lung parenchyma area image finally extracted is a binary mask image, the lung parenchyma area is displayed in white, and the background part (ie, the part outside the lung parenchyma area) is displayed in black.
[0078] As described above, through step S5, the lung parenchyma region is obtained, and the lung parenchyma region is a binary mask image.
[0079] Step S6, taking the lung parenchyma area as a label and the chest CT image corresponding to the lung parenchyma area as the image corresponding to the label to form a training set, training the segmentation network based on the training set to obtain a trained lung parenchyma segmentation grid model, and using the lung parenchyma segmentation grid model to extract the lung parenchyma area from the new chest CT image.
[0080] In this embodiment, the segmentation network is a U-Net network.
[0081] Figure 6 Schematic diagram of the structure of the U-Net network in an embodiment of the present invention.
[0082] like Figure 6 As shown in the figure, the U-Net network is mainly composed of a convolutional layer, a maximum pooling layer (downsampling), a deconvolution layer (upsampling) and a ReLu non-linear activation function, wherein the convolutional layer and the deconvolution layer use a two-dimensional convolutional layer Conv2d.
[0083] In this embodiment, when the U-Net network model is trained, the number of samples is 1579, the batch size is set to 5, the learning rate is 0.0001, the number of training times is 30, the ratio of the training set to the validation set in the training process is 9:1, the activation function is the ReLU activation function, the optimization function selects RMSprop, the momentum is set to 0.9, and the loss function uses the cross entropy loss function. The loss value of the cross entropy loss function is calculated by the following formula:
[0084] L = -[ylog(p)+(1-y)log(1-p)]
[0085] Where L is the loss value of the cross entropy loss function, y represents the sample label, the lung parenchyma area is 1, the background (i.e., the part outside the lung parenchyma area in the image) is 0, and p represents the probability that the sample is predicted to be the lung parenchyma area.
[0086] The evaluation index for the U-Net network training results is the Dice index, and the value of the Dice index is calculated by the following formula:
[0087]
[0088] In the formula, R seg is the predicted segmentation result, R gtis the segmentation result of the ground truth.
[0089] In this embodiment, after the above training, the loss value of the loss function of the lung parenchyma segmentation network model can reach 0.0141, and the value of the Dice index can reach 0.9655. Therefore, the lung parenchyma segmentation network model has a high accuracy. Then, the trained lung parenchyma segmentation network model can be used to quickly extract the lung parenchyma area from a new chest CT image.
[0090] Example Function and Effect
[0091] According to the automatic lung parenchyma segmentation method based on chest CT images provided by this embodiment, due to the adoption of a seed point extraction method, suitable seed points can be automatically selected from the chest CT images; due to the adoption of a region growing method and a hole filling method, the chest contour can be automatically extracted based on the seed points; and due to the adoption of an area threshold method, the trachea regions in the two connected domains can be removed respectively, thereby obtaining the lung parenchyma region; further, the obtained lung parenchyma region (i.e., a binary mask image) is used as a label, and the corresponding chest CT image is used as the image corresponding to the label to form a training set, and the segmentation network is trained based on the training set to obtain a trained lung parenchyma segmentation grid model, so that the lung parenchyma segmentation grid model can be used to extract the lung parenchyma region from a new chest CT image. Therefore, through the automatic lung parenchyma segmentation method based on chest CT images of the present invention, segmentation labels can be automatically obtained, and manual labeling is no longer required, thereby reducing manual workload and improving efficiency, and because the segmentation labels are obtained by a unified method, these segmentation labels have high consistency. Furthermore, by training the lung parenchyma segmentation grid model, it is possible to more accurately obtain lung parenchyma areas of various types of morphology, improve work efficiency, and provide technical support for subsequent three-dimensional reconstruction work.
[0092] The above embodiments are only used to illustrate specific implementation modes of the present invention, and the present invention is not limited to the description scope of the above embodiments.
Claims
1. A lung parenchyma automatic segmentation method based on chest CT images, used to extract lung parenchyma areas from chest CT images, characterized in that: include: Step S1, selecting seed points from the chest CT image using a seed point extraction method; Step S2, based on the seed point, using a region growing method and a hole filling method to extract a chest contour; Step S3, performing a connected domain analysis within the range of the chest contour to determine whether there are two connected domains with similar areas, that is, determining whether the separation interface of the left and right lung parenchymas in the chest CT image is clearly displayed; Step S4, when the judgment in step S3 is no, using a corner detection method to separate the chest contour to obtain the two connected domains; Step S5, using an area threshold method to remove the trachea regions in the two connected domains respectively to obtain the lung parenchyma region; Step S6, taking the lung parenchyma region as a label and the chest CT image corresponding to the lung parenchyma region as an image corresponding to the label to form a training set, training a segmentation network based on the training set to obtain a trained lung parenchyma segmentation network model, and using the lung parenchyma segmentation network model to extract the lung parenchyma region from the new chest CT image. The seed point extraction method comprises the following steps: Step A1, using a sliding window with a predetermined size and a predetermined step length to globally traverse the chest CT image, and determining whether the average pixel grayscale value of each image in the sliding window is higher than 200, and when the determination is yes, using the sliding window as a preliminary selected sliding window, wherein the size of the sliding window is 25 pixels×25 pixels, and the step length is 25 pixels; Step A2, performing similarity measurement calculation on each initially selected sliding window and the four sliding windows adjacent to the initially selected sliding window, determining whether the initially selected sliding window and the four adjacent sliding windows all have high similarity, and when the determination is yes, extracting the centroid of the initially selected sliding window as the seed point, The similarity measurement calculation includes grayscale similarity calculation, texture similarity calculation and structural similarity calculation. The grayscale similarity calculation adopts the mean difference algorithm for calculation: The texture similarity calculation adopts the entropy difference algorithm for calculation: The structural similarity calculation uses the Hamming value based on hash coding for calculation: Where N is the scale of the image, X is the pixel grayscale value of the middle area image, and Y is n is the pixel grayscale value of the neighborhood image of X, E x 、E Y is the image entropy, i is the gray value of the pixel, j is the gray mean of the neighborhood image, P ij is the probability of the image taking the gray value ij, Wherein, the region growing method comprises the following steps: Step B1, the grown area includes the seed point; Step B2, searching for the pixel points in the four neighborhoods of the seed point that are not in the grown area, looking for the pixel point with a grayscale value less than 15, when the pixel point is found, adding the pixel point to the grown area, and using the pixel point as the new seed point, repeating step B2 to perform regional growth, when the pixel point is not found, stopping the regional growth, and the grown area is the chest contour with a hole.
2. The method for automatic segmentation of lung parenchyma based on chest CT images according to claim 1, Features: The corner point detection method comprises the following steps: Step C1, calculating the response value of each pixel in the image of the chest contour; Step C2, selecting two pixel points whose response values are much larger than the response values of other pixel points as two corner points; Step C3, connecting the two corner points to separate the two regions. The response value is calculated according to the following formula: R=detM-k(traceM) 2 In the formula, R is the response value, M is the intermediate matrix, k is the test constant, w is the Gaussian function, I x ,I y Represent the two gradients of the image in the X and Y directions respectively.
3. The method for automatic segmentation of lung parenchyma based on chest CT images according to claim 1, characterized in that: in, The lung parenchyma region is a binary mask image, The segmentation network is a U-Net segmentation network, The loss function of the segmentation network is a cross entropy loss function, and the loss value of the cross entropy loss function is calculated by the following formula: L = -[ylog(p)+(1-y)log(1-p)] Where y is the sample label, and p is the probability that the sample is predicted to be the lung parenchyma area.
4. The method for automatic segmentation of lung parenchyma based on chest CT images according to claim 3, characterized in that: in, The evaluation index of the segmentation network is the Dice index, which is calculated by the following formula: In the formula, R seg is the predicted segmentation result, R gt is the segmentation result of the ground truth.
Citation Information
Patent Citations
Detection method of high-resolution remote sensing image street center line
CN101714211A
Automatic random-walk CT lung parenchyma image segmentation method based on prior information
CN104933709A
Method and device for extracting pulmonary lobe from chest CT image
CN107230204A
Supervoxel sequence lung image 3D pulmonary nodule segmentation method based on multimodal data
CN107230206A
Fully automatic segmentation method for lung parenchyma CT images
CN109410166A
