Tumor lesion detection method in CT images based on machine learning

By calculating the adaptive weights of pixel points and their neighboring pixel points in CT images and optimizing the mean drift clustering algorithm, the problem of insufficient accuracy of tumor area extraction in traditional methods is solved, and higher accuracy of tumor area detection is achieved.

CN118762018BActive Publication Date: 2024-11-08渭南市第二医院
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411246556.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-11-08
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

The traditional mean drift clustering algorithm is relatively low when extracting tumor areas in CT images, which is mainly due to the high grayscale similarity and close distance between pixel points in the tumor area and its neighboring pixel points, resulting in insufficient weight setting, which affects the impact of Clustering effect.

Method used

By obtaining the grayscale difference between pixel points and their neighboring pixel points, calculating adaptive weights, optimizing the mean drift clustering algorithm, and improving the clustering accuracy of tumor areas.

Benefits of technology

The extraction accuracy of tumor areas in CT images is improved, so that pixel points belonging to the tumor areas can better gather together to form clear clusters, thereby accurately segmenting the tumor areas in the lungs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118762018B_ABST
    Figure CN118762018B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and in particular to a method for detecting a tumor lesion area in a CT image based on machine learning. The method obtains a lung CT image of a patient to obtain a corresponding grayscale image; obtains neighborhood pixel points of a pixel point in the grayscale image within a preset neighborhood range, and obtains a grayscale difference according to a grayscale value difference between the pixel point and the neighborhood pixel point; obtains a grayscale weight of the neighborhood pixel point according to the grayscale difference, obtains a distance weight of the neighborhood pixel point according to a distance between the pixel point and the neighborhood pixel point, optimizes the distance weight according to the grayscale weight, and obtains an adaptive weight of the pixel point; and performs mean shift clustering on all pixel points in the grayscale image according to the adaptive weight of each pixel point to obtain a lung tumor area in the grayscale image, thereby improving the accuracy of tumor area extraction in the CT image using a mean shift algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method for detecting tumor lesion areas in CT images based on machine learning. Background Art

[0002] CT is an imaging examination method that uses computerized tomography to diagnose chest and lung diseases. As a commonly used medical imaging technology, it can provide high-resolution information about the internal structure of the body, but automatically detecting tumor areas from CT images is a complex task. Since CT images themselves have image noise, and tumors may have unclear boundaries or complex shapes, there is a lot of interference in judgment. The mean shift clustering algorithm is a parameter-free statistical iterative algorithm that can cluster the tumor lesion area according to the density of pixel points in CT images and eliminate the interference of noise points.

[0003] When the mean shift clustering algorithm is used in the traditional way, the weight coefficient of the offset mean is set according to the distance between the sample point and other data points. Since there is a distribution relationship of high grayscale similarity and close relative distance between the pixels in the tumor area and its neighboring pixels, when the mean shift clustering algorithm is used to extract the tumor area, if the weight coefficient of the offset mean is set only according to the distance between the sample point and other data points, the accuracy of the extracted tumor area will be reduced.

[0004] Therefore, how to use the mean shift algorithm to improve the accuracy of tumor area extraction in CT images has become an urgent problem to be solved. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method for detecting tumor lesion areas in CT images based on machine learning to solve the problem of how to use the mean shift algorithm to improve the accuracy of tumor area extraction in CT images.

[0006] An embodiment of the present invention provides a method for detecting tumor lesion areas in CT images based on machine learning, the method comprising the following steps:

[0007] Acquire a lung CT image of the patient, and perform grayscale processing on the lung CT image to obtain a grayscale image of the lung CT image;

[0008] For any pixel point in the grayscale image, obtain the neighboring pixel points of the pixel point within a preset neighborhood range, take any neighboring pixel point as a target neighborhood pixel point, and obtain the grayscale difference between the pixel point and the target neighborhood pixel point according to the grayscale value difference between the pixel point and the target neighborhood pixel point;

[0009] According to the grayscale difference, a grayscale weight of the target neighborhood pixel point is obtained, according to the distance between the pixel point and the target neighborhood pixel point, a distance weight is obtained, and according to the grayscale weight, the distance weight is optimized to obtain an adaptive weight of the target neighborhood pixel point;

[0010] Obtain an adaptive weight of each neighborhood pixel within a preset neighborhood range of the pixel point, perform mean shift clustering on all pixels in the grayscale image according to the adaptive weight of each neighborhood pixel within a preset neighborhood range of each pixel point in the grayscale image to obtain at least one cluster, and obtain a lung tumor area in the grayscale image according to the grayscale values ​​of the pixels included in each of the clusters.

[0011] Furthermore, the step of obtaining the grayscale difference between the pixel point and the target neighborhood pixel point according to the grayscale value difference between the pixel point and the target neighborhood pixel point includes:

[0012] Obtaining a first grayscale value mean and a first grayscale value variance of all pixels within a preset neighborhood of the pixel, calculating a first absolute value of a difference between the grayscale value of the pixel and the first grayscale value mean, calculating a product of the first absolute value of the difference and the first grayscale value variance, and obtaining a first grayscale distribution correlation coefficient within a preset neighborhood of the pixel;

[0013] According to the grayscale values ​​of all pixels within a preset neighborhood range of the target neighborhood pixel point, a second grayscale distribution correlation coefficient within a preset neighborhood range of the target neighborhood pixel point is obtained;

[0014] The absolute value of the difference between the first grayscale distribution correlation coefficient and the second grayscale distribution correlation coefficient is calculated to obtain the grayscale difference between the pixel point and the target neighborhood pixel point.

[0015] Furthermore, the step of obtaining a second grayscale distribution correlation coefficient within a preset neighborhood range of the target neighborhood pixel point according to the grayscale values ​​of all pixels within a preset neighborhood range of the target neighborhood pixel point comprises:

[0016] Obtain the second grayscale value mean and the second grayscale value variance of all pixels within a preset neighborhood range of the target neighborhood pixel point, calculate the second absolute value of the difference between the grayscale value of the target neighborhood pixel point and the second grayscale value mean, calculate the product of the second absolute value of the difference and the second grayscale value variance, and obtain the second grayscale distribution correlation coefficient within the preset neighborhood range of the target neighborhood pixel point.

[0017] Furthermore, obtaining the grayscale weight of the target neighborhood pixel according to the grayscale difference includes:

[0018] Normalizing the grayscale difference to obtain a grayscale difference normalized value;

[0019] The grayscale difference normalized value is used as the independent variable of the Gaussian kernel function to obtain the grayscale weight of the target neighborhood pixel.

[0020] Furthermore, obtaining a distance weight according to the distance between the pixel point and the target neighborhood pixel point includes:

[0021] According to the coordinates of the pixel point and the target neighborhood pixel point, the distance between the pixel point and the target neighborhood pixel point is obtained, and the distance is normalized to obtain a distance normalization value;

[0022] The distance normalization value is used as an independent variable of a Gaussian kernel function to obtain a distance weight of the target neighborhood pixel.

[0023] Furthermore, the distance weight is optimized according to the grayscale weight to obtain the adaptive weight of the target neighborhood pixel, including:

[0024] The product of the grayscale weight and the distance weight is used as the adaptive weight of the target neighborhood pixel.

[0025] Furthermore, the step of obtaining the lung tumor region in the grayscale image according to the grayscale values ​​of the pixels included in each of the clusters includes:

[0026] The grayscale value mean of all pixels contained in each cluster is calculated, the cluster corresponding to the maximum grayscale value mean is taken as the tumor cluster, and the area composed of all pixels contained in the tumor cluster is taken as the lung tumor area in the grayscale image.

[0027] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0028] The present invention obtains a lung CT image of a patient, performs grayscale processing on the lung CT image, and obtains a grayscale image of the lung CT image; for any pixel point in the grayscale image, obtains the neighborhood pixel points of the pixel point within a preset neighborhood range, takes any neighborhood pixel point as a target neighborhood pixel point, and obtains the grayscale difference between the pixel point and the target neighborhood pixel point according to the grayscale value difference between the pixel point and the target neighborhood pixel point; obtains the grayscale weight of the target neighborhood pixel point according to the grayscale difference, obtains the distance weight according to the distance between the pixel point and the target neighborhood pixel point, optimizes the distance weight according to the grayscale weight, and obtains the adaptive weight of the target neighborhood pixel point; obtains the adaptive weight of each neighborhood pixel point within a preset neighborhood range of the pixel point, performs mean shift clustering on all pixels in the grayscale image according to the adaptive weight of each neighborhood pixel point within a preset neighborhood range of each pixel point in the grayscale image, obtains at least one cluster, and obtains the lung tumor area in the grayscale image according to the grayscale value of the pixel points contained in each of the clusters. Among them, the lung CT image is denoised to obtain a grayscale image, and the coordinates of each pixel in the grayscale image are obtained. Any pixel in the grayscale image is selected to obtain the neighboring pixels within the neighborhood of the pixel. Since there is a distribution relationship of high grayscale similarity and close relative distance between the pixels in the tumor area and its neighboring pixels, the grayscale weight and distance weight are calculated for each neighboring pixel, and the distance weight is optimized according to the grayscale weight to obtain an adaptive weight, so that when using the mean shift clustering algorithm, the pixels belonging to the tumor area can be better clustered together to obtain multiple clusters. The lung tumor area is obtained according to the average grayscale value of the pixels contained in each cluster, and the distance weight is optimized according to the grayscale weight, which improves the accuracy of tumor area extraction in CT images using the mean shift algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0030] Figure 1 This is a method flow chart of a method for detecting tumor lesion areas in CT images based on machine learning provided in Example 1 of the present invention. DETAILED DESCRIPTION

[0031] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, but should not be understood as limiting the present disclosure.

[0032] It should be noted that the terms "first", "second", etc. in the specification of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure.

[0033] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.

[0034] See also Figure 1 , is a method flow chart of a method for detecting tumor lesion areas in CT images based on machine learning provided in Embodiment 1 of the present invention, such as Figure 1 As shown, the method may include:

[0035] Step S101, obtaining a lung CT image of a patient, performing grayscale processing on the lung CT image, and obtaining a grayscale image of the lung CT image.

[0036] First, a lung CT image of the patient is obtained through CT scanning. In order to reduce unnecessary calculations and interference caused by noise, bilateral filtering technology is used to reduce the noise in the lung CT image and maintain the edge. Then the denoised lung CT image is converted into a grayscale image. Among them, the bilateral filtering technology is an existing technology and will not be repeated here.

[0037] Use OpenCV to read the grayscale image and obtain the grayscale value and coordinates of each pixel in the grayscale image. OpenCV is a prior art and will not be described in detail here.

[0038] Step S102, for any pixel point in the grayscale image, obtain the neighborhood pixel points of the pixel point within a preset neighborhood range, take any neighborhood pixel point as the target neighborhood pixel point, and obtain the grayscale difference between the pixel point and the target neighborhood pixel point based on the grayscale value difference between the pixel point and the target neighborhood pixel point.

[0039] In the traditional way, the mean shift clustering algorithm is used to cluster the pixels in the grayscale image to obtain the tumor area, wherein the basic steps of the mean shift clustering algorithm are: step 1, initially determine a center point, and calculate the distance between all points in a circular space with a preset radius D and the center point; step 2, calculate the weight according to the distance between each point in the circular space and the center point, weight the distance between each point and the center point to obtain the weighted distance, calculate the average of all weighted distances in the entire circular space, and obtain a weighted offset mean; step 3, move the center point to the position of the weighted offset mean; step 4, repeat the movement until the position change between the moved point and the original point is less than the preset threshold, and the clustering ends.

[0040] However, since there are distinguishing features between the tumor area and the non-tumor area, that is, there is a distribution relationship of high grayscale similarity and close relative distance between the pixels in the tumor area and its neighboring pixels, and the tumor is relatively clustered, only calculating the weight based on the distance between each point and the center point will reduce the accuracy of the extracted tumor area. Therefore, in the example of the present invention, step 2 of the mean shift clustering algorithm is optimized: different weights are assigned to each pixel according to the distance and grayscale relationship between the pixel in the grayscale image and its neighboring pixels, so that when the mean shift clustering algorithm is used, the pixels belonging to the tumor area can be better clustered together, thereby achieving the purpose of accurate segmentation, wherein the mean shift clustering algorithm is a prior art and will not be described here.

[0041] Take any pixel in the grayscale image as an example, and take the pixel as the central pixel. In the example of the present invention, the preset neighborhood range is centered on the central pixel and has a size of A window is constructed with the central pixel as the center. The pixels in the window are the neighborhood pixels of the central pixel.

[0042] Among them, taking the i-th neighborhood pixel point (i.e., the target neighborhood pixel point) and obtaining the grayscale relationship between the central pixel point and the i-th neighborhood pixel point includes:

[0043] (1) obtaining a first grayscale value mean and a first grayscale value variance of all pixels within a preset neighborhood of the pixel, calculating a first absolute value of a difference between the grayscale value of the pixel and the first grayscale value mean, calculating a product of the first absolute value of the difference and the first grayscale value variance, and obtaining a first grayscale distribution correlation coefficient within a preset neighborhood of the pixel;

[0044] In one embodiment, the grayscale value of the central pixel is obtained, and a window constructed with the central pixel as the center is recorded as a first window. The grayscale distribution correlation coefficient of the first window is obtained according to the grayscale value of the central pixel, the grayscale value mean of all pixels included in the first window, and the grayscale value variance, that is, the first grayscale distribution correlation coefficient within the neighborhood of the central pixel. The calculation formula of the first grayscale distribution correlation coefficient is:

[0045]

[0046] in, It represents the grayscale distribution correlation coefficient of the window (i.e., the first window) where the central pixel is located, i.e., the first grayscale distribution correlation coefficient. represents the absolute value symbol, Represents the gray value of the center pixel, represents the mean grayscale value of all pixels in the first window, that is, the first grayscale value mean, Represents the gray value variance of all pixels in the first window, that is, the first gray value variance.

[0047] It should be noted that The smaller the value of is, the smaller the difference between the grayscale value of the central pixel and the grayscale values ​​of the surrounding pixels is. The smaller the value of .

[0048] (2) obtaining a second grayscale distribution correlation coefficient within a preset neighborhood range of the target neighborhood pixel point according to the grayscale values ​​of all pixels within a preset neighborhood range of the target neighborhood pixel point, including:

[0049] Obtain the second grayscale value mean and the second grayscale value variance of all pixels within a preset neighborhood range of the target neighborhood pixel point, calculate the second absolute value of the difference between the grayscale value of the target neighborhood pixel point and the second grayscale value mean, calculate the product of the second absolute value of the difference and the second grayscale value variance, and obtain the second grayscale distribution correlation coefficient within the preset neighborhood range of the target neighborhood pixel point.

[0050] In one embodiment, a pixel is constructed with the ith neighborhood pixel as the center. A window is constructed, the pixels in the window are the neighborhood pixels of the ith neighborhood pixel, the window constructed with the ith neighborhood pixel as the center is recorded as the second window, the gray value of the ith neighborhood pixel is obtained, the gray value mean and gray value variance of all pixels included in the second window are calculated, and the gray distribution correlation coefficient of the second window is obtained according to the gray value of the ith neighborhood pixel, the gray value mean and gray value variance of all pixels included in the second window, that is, the second gray distribution correlation coefficient within the neighborhood range of the ith neighborhood pixel, and the calculation formula of the second gray distribution correlation coefficient is:

[0051]

[0052] in, represents the grayscale distribution correlation coefficient of the window (i.e., the second window) where the i-th neighborhood pixel point is located, i.e., the second grayscale distribution correlation coefficient, represents the absolute value symbol, represents the gray value of the i-th neighborhood pixel, represents the mean gray value of all pixels in the second window, that is, the second gray value mean, It represents the gray value variance of all pixels in the second window, that is, the second gray value variance.

[0053] It should be noted that The smaller the value of is, the smaller the difference between the grayscale value of the i-th neighborhood pixel and the grayscale values ​​of its surrounding pixels is. The smaller the value of .

[0054] (3) Calculating the absolute value of the difference between the first grayscale distribution correlation coefficient and the second grayscale distribution correlation coefficient to obtain the grayscale difference between the pixel point and the target neighborhood pixel point.

[0055] In one embodiment, the grayscale difference between the central pixel and the i-th neighboring pixel is obtained according to the first grayscale distribution correlation coefficient and the second grayscale distribution correlation coefficient, and the grayscale difference between the central pixel and the i-th neighboring pixel is calculated as follows:

[0056]

[0057] in, Represents the grayscale difference between the central pixel and the i-th neighboring pixel, It represents the grayscale distribution correlation coefficient of the window (i.e., the first window) where the central pixel is located, i.e., the first grayscale distribution correlation coefficient. represents the grayscale distribution correlation coefficient of the window (i.e., the second window) where the i-th neighborhood pixel point is located, i.e., the second grayscale distribution correlation coefficient, Represents the absolute value symbol.

[0058] It should be noted that The smaller the value of is, the smaller the difference between the grayscale value of the pixel in the neighborhood of the central pixel and the grayscale value of the i-th neighboring pixel is. The smaller the value of , the smaller the difference in grayscale distribution between the corresponding central pixel and the i-th neighborhood pixel, that is, the greater the similarity of the grayscale values ​​of the two pixels in the local range, and the more likely the two pixels are the same type of pixels in the grayscale image.

[0059] Step S103, obtaining the grayscale weight of the target neighborhood pixel according to the grayscale difference, obtaining the distance weight according to the distance between the pixel and the target neighborhood pixel, optimizing the distance weight according to the grayscale weight, and obtaining the adaptive weight of the target neighborhood pixel.

[0060] Since there are many different areas in the patient's lung CT images, such as normal cavity areas, tumor areas and normal tissue areas, the grayscale value similarity between any pixel point in the same area and its neighboring pixel points is large and the relative distance is close. Therefore, according to the grayscale difference between the pixel point and its neighboring pixel points, the distance between the pixel point and its neighboring pixel points is optimized, and the neighboring pixel points are assigned optimized adaptive weights, so that in the process of mean shift clustering of each pixel point in the grayscale image according to the adaptive weight, the pixels belonging to the same area can be more accurately clustered together, thereby achieving the purpose of accurate segmentation.

[0061] The acquisition of the adaptive weight of the i-th neighborhood pixel includes:

[0062] (1) Obtaining the grayscale weight of the target neighborhood pixel according to the grayscale difference, including:

[0063] Normalizing the grayscale difference to obtain a grayscale difference normalized value;

[0064] The grayscale difference normalized value is used as the independent variable of the Gaussian kernel function to obtain the grayscale weight of the target neighborhood pixel.

[0065] In one embodiment, the grayscale difference between the central pixel and each neighboring pixel is obtained according to step S102. Since the scale of each grayscale difference is different, it is not conducive to subsequent calculations, so it is necessary to perform linear normalization processing on it to obtain the normalized value of the grayscale difference, wherein linear normalization is a prior art and will not be repeated here.

[0066] Then the calculation formula for the normalized value of the grayscale difference of the i-th neighborhood pixel is:

[0067]

[0068] in, represents the normalized value of the grayscale difference between the central pixel and the i-th neighboring pixel, norm() represents the linear normalization function, Represents the grayscale difference between the central pixel and the i-th neighboring pixel.

[0069] Furthermore, the normalized value of the grayscale difference between the central pixel and the i-th neighboring pixel is used as the independent variable of the Gaussian kernel function to obtain the grayscale weight of the i-th neighboring pixel. The grayscale weight of the i-th neighboring pixel is calculated as follows:

[0070]

[0071] in, represents the grayscale weight of the i-th neighborhood pixel, Represents the normalized value of the grayscale difference between the central pixel and the i-th neighboring pixel. represents the standard deviation of the Gaussian kernel function, and exp() represents the exponential function with the natural constant e as the base.

[0072] It should be noted that The value of is 1. There is no restriction here. The implementer can set it according to the implementation scenario. The smaller the value is, the smaller the grayscale difference between the central pixel and the i-th neighboring pixel is, the greater the grayscale similarity is, and the more likely they are to belong to the same area. In the subsequent mean shift clustering process of the central pixel, the greater the contribution of the i-th neighboring pixel, the greater the grayscale weight of the corresponding i-th neighboring pixel, that is, The larger the value of .

[0073] (2) Obtaining a distance weight according to the distance between the pixel point and the target neighborhood pixel point, including:

[0074] According to the coordinates of the pixel point and the target neighborhood pixel point, the distance between the pixel point and the target neighborhood pixel point is obtained, and the distance is normalized to obtain a distance normalization value;

[0075] The distance normalization value is used as an independent variable of a Gaussian kernel function to obtain a distance weight of the target neighborhood pixel.

[0076] In one embodiment, the Euclidean distance between the central pixel and the i-th neighboring pixel is calculated according to the coordinates of the central pixel and the i-th neighboring pixel. The calculation formula of the Euclidean distance between the central pixel and the i-th neighboring pixel is:

[0077]

[0078] in, represents the Euclidean distance between the central pixel and the i-th neighboring pixel, Represents the horizontal coordinate value of the i-th neighborhood pixel, Represents the ordinate value of the i-th neighborhood pixel, Indicates the horizontal coordinate value of the center pixel point. Indicates the vertical coordinate value of the center pixel.

[0079] It should be noted that The smaller the value of The smaller the value of is, the smaller the distance between the central pixel and the i-th neighboring pixel is. The smaller the value of , the more similar the two pixels are in spatial distribution, and the more likely the two pixels are of the same type in the image.

[0080] Similarly, the Euclidean distance between the central pixel and each of its neighboring pixels is obtained, and each Euclidean distance is linearly normalized to obtain a distance normalized value, wherein linear normalization is a prior art and will not be described in detail here.

[0081] Then the calculation formula for the normalized distance value of the i-th neighborhood pixel is:

[0082]

[0083] in, represents the normalized value of the distance between the central pixel and the i-th neighboring pixel, norm() represents the linear normalization function, Represents the Euclidean distance between the central pixel and the i-th neighboring pixel.

[0084] The normalized value of the distance between the central pixel and the i-th neighboring pixel is used as the independent variable of the Gaussian kernel function to obtain the distance weight of the i-th neighboring pixel. The calculation formula for the distance weight of the i-th neighboring pixel is:

[0085]

[0086] in, represents the distance weight of the i-th neighborhood pixel, Represents the normalized distance between the central pixel and the i-th neighboring pixel. represents the standard deviation of the Gaussian kernel function, and exp() represents the exponential function with the natural constant e as the base.

[0087] It should be noted that The value of is 1. There is no restriction here. The implementer can set it according to the implementation scenario. The smaller the value of is, the closer the distance between the central pixel and the ith neighboring pixel is, and the greater the distance weight of the ith neighboring pixel is. The larger the value of .

[0088] (3) Optimizing the distance weight according to the grayscale weight to obtain the adaptive weight of the target neighborhood pixel, including:

[0089] The product of the grayscale weight and the distance weight is used as the adaptive weight of the target neighborhood pixel.

[0090] In one embodiment, the distance weight of the i-th neighborhood pixel is optimized according to the grayscale weight of the i-th neighborhood pixel to obtain the adaptive weight of the i-th neighborhood pixel. The adaptive weight is calculated as follows:

[0091]

[0092] in, represents the adaptive weight of the i-th neighborhood pixel, represents the distance weight of the i-th neighborhood pixel, represents the grayscale weight of the i-th neighborhood pixel, Represents the normalized distance between the central pixel and the i-th neighboring pixel. Represents the normalized value of the grayscale difference between the central pixel and the i-th neighboring pixel. represents the standard deviation of the Gaussian kernel function, and exp() represents the exponential function with the natural constant e as the base.

[0093] It should be noted that The value of is 1. There is no restriction here. The implementer can set it according to the implementation scenario. The smaller the value, the closer the distance between the central pixel and the i-th neighboring pixel is, and the distance weight of the i-th neighboring pixel is The larger the value of, the larger the adaptive weight of the i-th neighborhood pixel. The larger the value of ; The smaller the value, the smaller the grayscale difference between the central pixel and the i-th neighboring pixel, the greater the grayscale value similarity, and the grayscale weight of the i-th neighboring pixel. The larger the value of, the larger the adaptive weight of the i-th neighborhood pixel. The larger the value of .

[0094] Step S104, obtaining the adaptive weight of each neighborhood pixel within a preset neighborhood range of the pixel point, performing mean shift clustering on all pixels in the grayscale image according to the adaptive weight of each neighborhood pixel within the preset neighborhood range of each pixel in the grayscale image to obtain at least one cluster, and obtaining the lung tumor area in the grayscale image according to the grayscale values ​​of the pixels included in each cluster.

[0095] According to step S102 and step S103, the adaptive weight of each neighborhood pixel in the neighborhood of the central pixel is obtained, that is, the adaptive weight of all pixels included in the first window. Similarly, the adaptive weight of each neighborhood pixel in the neighborhood of each pixel in the grayscale image is obtained. According to each adaptive weight, a weighted vector of the corresponding neighborhood pixel is obtained. Then, according to the weighted vector of each neighborhood pixel, a weighted offset mean of the central pixel is obtained. At this point, the optimization of step 2 in the mean shift clustering algorithm is completed, and the optimized weighted offset mean is obtained. Further, the central pixel is moved to the position of the weighted offset mean (that is, step 3), and the preset threshold in step 4 is set to 0.35. There is no restriction here. The implementer can set it according to the implementation scenario. After each drift, the position change between the moved point and the original point is calculated. If the position change is less than 0.35, the clustering ends and multiple clusters are obtained.

[0096] Furthermore, after obtaining multiple clusters, each cluster represents a different area, such as a normal cavity area, a tumor area, a normal tissue area, etc. Since the shadow density of the lung tumor area is significantly different from that of the normal tissue area, the tumor area can be obtained by comparing the grayscale values ​​of the pixels contained in each cluster.

[0097] Among them, according to the gray value of the pixel points contained in each cluster, the lung tumor area is obtained, including:

[0098] The grayscale value mean of all pixels contained in each cluster is calculated, the cluster corresponding to the maximum grayscale value mean is taken as the tumor cluster, and the area composed of all pixels contained in the tumor cluster is taken as the lung tumor area in the grayscale image.

[0099] Calculate the grayscale value mean of all pixels contained in each cluster, select the cluster corresponding to the maximum grayscale value mean as the tumor cluster, and the area composed of all pixels contained in the tumor cluster is the lung tumor area in the grayscale image. At this point, the accurate extraction of tumor areas in CT images using the mean shift algorithm is completed.

[0100] It is worth noting that the focus of the present invention is how to optimize the weighted offset mean in the mean shift clustering algorithm to improve the accuracy of tumor region extraction in CT images using the mean shift algorithm. Using the mean shift clustering algorithm to obtain the lung tumor region based on the weighted offset mean belongs to the prior art and will not be described in detail here.

[0101] In summary, the present invention obtains a lung CT image of a patient, performs grayscale processing on the lung CT image, and obtains a grayscale image of the lung CT image; for any pixel point in the grayscale image, obtains the neighborhood pixel points of the pixel point within a preset neighborhood range, takes any neighborhood pixel point as a target neighborhood pixel point, and obtains the grayscale difference between the pixel point and the target neighborhood pixel point according to the grayscale value difference between the pixel point and the target neighborhood pixel point; obtains the grayscale weight of the target neighborhood pixel point according to the grayscale difference, and obtains the grayscale weight of the target neighborhood pixel point according to the grayscale difference between the pixel point and the target neighborhood pixel point. The distance between the target neighborhood pixels is used to obtain a distance weight, and the distance weight is optimized according to the grayscale weight to obtain an adaptive weight of the target neighborhood pixel; the adaptive weight of each neighborhood pixel within a preset neighborhood range of the pixel is obtained, and according to the adaptive weight of each neighborhood pixel within a preset neighborhood range of each pixel in the grayscale image, all pixels in the grayscale image are clustered by mean shift to obtain at least one cluster, and according to the grayscale values ​​of the pixels included in each cluster, the lung tumor area in the grayscale image is obtained. Among them, the lung CT image is denoised to obtain a grayscale image, and the coordinates of each pixel in the grayscale image are obtained. Any pixel in the grayscale image is selected to obtain the neighboring pixels within the neighborhood of the pixel. Since there is a distribution relationship of high grayscale similarity and close relative distance between the pixels in the tumor area and its neighboring pixels, the grayscale weight and distance weight are calculated for each neighboring pixel, and the distance weight is optimized according to the grayscale weight to obtain an adaptive weight, so that when using the mean shift clustering algorithm, the pixels belonging to the tumor area can be better clustered together to obtain multiple clusters. The lung tumor area is obtained according to the average grayscale value of the pixels contained in each cluster, and the distance weight is optimized according to the grayscale weight, which improves the accuracy of tumor area extraction in CT images using the mean shift algorithm.

[0102] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.

Claims

1. A method for detecting tumor lesion areas in CT images based on machine learning, characterized in that: The method for detecting tumor lesion areas in CT images based on machine learning includes: Acquire a lung CT image of the patient, and perform grayscale processing on the lung CT image to obtain a grayscale image of the lung CT image; For any pixel point in the grayscale image, obtain the neighboring pixel points of the pixel point within a preset neighborhood range, take any neighboring pixel point as a target neighborhood pixel point, and obtain the grayscale difference between the pixel point and the target neighborhood pixel point according to the grayscale value difference between the pixel point and the target neighborhood pixel point; According to the grayscale difference, a grayscale weight of the target neighborhood pixel point is obtained, according to the distance between the pixel point and the target neighborhood pixel point, a distance weight is obtained, and according to the grayscale weight, the distance weight is optimized to obtain an adaptive weight of the target neighborhood pixel point; Obtaining an adaptive weight of each neighboring pixel within a preset neighborhood of the pixel, performing mean shift clustering on all pixels in the grayscale image according to the adaptive weight of each neighboring pixel within a preset neighborhood of each pixel in the grayscale image to obtain at least one cluster, and obtaining a lung tumor region in the grayscale image according to the grayscale values ​​of the pixels included in each cluster; The step of obtaining the grayscale difference between the pixel point and the target neighborhood pixel point according to the grayscale value difference between the pixel point and the target neighborhood pixel point comprises: Obtaining a first grayscale value mean and a first grayscale value variance of all pixels within a preset neighborhood of the pixel, calculating a first absolute value of a difference between the grayscale value of the pixel and the first grayscale value mean, calculating a product of the first absolute value of the difference and the first grayscale value variance, and obtaining a first grayscale distribution correlation coefficient within a preset neighborhood of the pixel; According to the grayscale values ​​of all pixels within a preset neighborhood range of the target neighborhood pixel point, a second grayscale distribution correlation coefficient within a preset neighborhood range of the target neighborhood pixel point is obtained; Calculating the absolute value of the difference between the first grayscale distribution correlation coefficient and the second grayscale distribution correlation coefficient to obtain the grayscale difference between the pixel point and the target neighborhood pixel point; The step of obtaining a second grayscale distribution correlation coefficient within a preset neighborhood range of the target neighborhood pixel point according to the grayscale values ​​of all pixels within a preset neighborhood range of the target neighborhood pixel point comprises: Obtaining a second grayscale value mean and a second grayscale value variance of all pixels within a preset neighborhood range of the target neighborhood pixel point, calculating a second absolute value of a difference between the grayscale value of the target neighborhood pixel point and the second grayscale value mean, calculating a product between the second absolute value of the difference and the second grayscale value variance, and obtaining a second grayscale distribution correlation coefficient within a preset neighborhood range of the target neighborhood pixel point; The step of optimizing the distance weight according to the grayscale weight to obtain the adaptive weight of the target neighborhood pixel point includes: The product of the grayscale weight and the distance weight is used as the adaptive weight of the target neighborhood pixel.

2. The method for detecting tumor lesion areas in CT images based on machine learning according to claim 1, characterized in that: The step of obtaining the grayscale weight of the target neighborhood pixel according to the grayscale difference comprises: Normalizing the grayscale difference to obtain a grayscale difference normalized value; The grayscale difference normalized value is used as the independent variable of the Gaussian kernel function to obtain the grayscale weight of the target neighborhood pixel.

3. The method for detecting tumor lesion areas in CT images based on machine learning according to claim 1, characterized in that: The obtaining of the distance weight according to the distance between the pixel point and the target neighborhood pixel point comprises: According to the coordinates of the pixel point and the target neighborhood pixel point, the distance between the pixel point and the target neighborhood pixel point is obtained, and the distance is normalized to obtain a distance normalization value; The distance normalization value is used as an independent variable of a Gaussian kernel function to obtain a distance weight of the target neighborhood pixel.

4. The method for detecting tumor lesion areas in CT images based on machine learning according to claim 1, characterized in that: The step of acquiring the lung tumor region in the grayscale image according to the grayscale values ​​of the pixels included in each of the clusters includes: The grayscale value mean of all pixels contained in each cluster is calculated, the cluster corresponding to the maximum grayscale value mean is taken as the tumor cluster, and the area composed of all pixels contained in the tumor cluster is taken as the lung tumor area in the grayscale image.