CT (Computed Tomography) image heat map label construction method and equipment and storage medium
By constructing CT image heatmap labels and utilizing Gaussian distribution and fully convolutional neural networks, the problems of high false positive rate and low detection accuracy of existing lung nodule detection algorithms are solved, achieving efficient and accurate lung nodule detection.
Patent Information
- Application Number
- CN202511215040.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-28
- Publication Date
- 2025-12-09
AI Technical Summary
Existing coordinate regression-based lung nodule detection algorithms suffer from high false positive rates, increased model complexity, poor prediction performance for small nodules, and the impact of background regions on detection accuracy. Furthermore, they are difficult to implement end-to-end training and perception task conversion.
By constructing CT image heatmap labels, generating the density distribution of lung nodules using Gaussian distribution, and training with a fully convolutional neural network, heatmap labels are generated and used for lung nodule detection.
It significantly improves the model's ability to learn the fine structure and boundary regions of nodules, reduces annotation costs, and improves detection accuracy and consistency, making it suitable for supervision signals of deep learning models.
Smart Images

Figure CN121096554A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine learning technology, specifically relating to a method, device, and storage medium for constructing CT image heatmap labels. Background Technology
[0002] In recent years, inspired by the significant achievements of convolutional neural networks (CNNs) in medical imaging, researchers have introduced a series of classic CNN-based object detection algorithms, such as Faster R-CNN, YOLO, and SSD, into the task of detecting lung nodules in chest CT scans. Typically, these methods first define a series of anchor boxes of different scales and proportions on each voxel of the CT scan or at each feature point of the feature map extracted by the backbone network. Then, based on the features extracted by the CNN, the coordinates of these anchor boxes are regressed to the coordinates of the lung nodule envelope, and the probability that these anchor box regions belong to lung nodules is predicted.
[0003] On the one hand, the aforementioned coordinate regression-based detection algorithm can predict thousands of lung nodule regions, including a large number of non-nodule regions, significantly increasing the false positive rate of the model's predictions. To address this issue, researchers had to integrate a lung nodule recognition model after the detection model to eliminate false positives in the predictions, which complicates the coordinate regression-based algorithm and deviates from the original intention of developing an intuitive and lightweight lung nodule detection system. Furthermore, the weak features extracted by convolutional neural networks for small lung nodules are insufficient to support the prediction of the offset from the anchor box to the nodule target bounding box, resulting in poor prediction performance for small nodules. On the other hand, part of the content within the nodule target bounding box is non-nodule background, especially when the nodule shape is irregular, the proportion of background is even larger, which affects the model's inference of coordinate regression offsets and reduces the accuracy of nodule detection. From a higher perspective, coordinate regression-based methods require convolutional neural networks to possess more cognitive rather than perceptual abilities in the analysis of CT scan images, which is undoubtedly a significant challenge for convolutional neural networks. Summary of the Invention
[0004] In view of the above-mentioned shortcomings of the prior art, the present invention provides a method, device and storage medium for constructing CT image thermal tags to solve the above-mentioned technical problems.
[0005] In a first aspect, the present invention provides a method for constructing thermal tags for CT images, comprising: Acquire raw lung CT images and convert the raw lung CT images into grayscale images in a preset standard format; Identify lung nodules in the CT image and obtain the center coordinates, width, and height of the lung nodules; Construct a two-dimensional matrix of all zeros of the same size as the grayscale image; Based on the center coordinates, width, and height, set the Gaussian distribution parameters, and generate a two-dimensional Gaussian distribution formula based on the Gaussian distribution parameters; A heatmap matrix is obtained by calculating Gaussian values for each position of the all-zero two-dimensional matrix using the two-dimensional Gaussian distribution formula, and heatmap labels are generated for the grayscale image based on the heatmap matrix.
[0006] In one optional implementation, acquiring raw lung CT images and converting the raw lung CT images into grayscale images of a preset standard format includes: Acquire raw lung CT images in DICOM or MHD format, wherein each pixel of the raw lung CT image is represented by 12 bits and the potential value range of each pixel is [-1024, 3071]. Pixel values within the range of [-1024, 600] are extracted from the original lung CT image, and all pixel values exceeding 600 are set to 600. The pixel values of the extracted lung CT images are mapped to the range [0, 255], and the mapped images are stored as grayscale images in JPEG, JPG, or PNG format.
[0007] In an optional implementation, mapping the pixel values of the cropped lung CT image to the range [0, 255] includes: Use Sigmoid or logarithmic transformation to perform non-linear compression on 12-bit data, prioritizing the preservation of grayscale gradients in the key range of [-1000, -400HU].
[0008] In an optional implementation, the mapped image is stored as a grayscale image in JPEG, JPG, or PNG format, including: The output is in 8-bit PNG / TIFF format, and DICOM metadata (such as Slice Thickness, Spacing) is embedded into the EXIF field.
[0009] In an optional implementation, identifying lung nodules in the CT image and obtaining the center coordinates, width, and height of the lung nodules includes: Using an expert system to generate bounding boxes for lung nodules in CT images; The center coordinates, width, and height of the marked box are extracted as the center coordinates, width, and height of the lung nodule.
[0010] In an optional implementation, the Gaussian distribution parameters are set according to the center coordinates, width, and height, including: Set the x and y coordinates of the central coordinate system to the mean of a Gaussian distribution. , The standard deviation of the two-dimensional Gaussian distribution takes the following values: ,in Values When r=3, the heat map value of the nodule boundary is about 60% of the peak value; for irregular nodules, r=4 is used to cover a wider area. is the width, and h is the height.
[0011] In an optional implementation, a heatmap matrix is obtained by calculating Gaussian values for each position of the all-zero two-dimensional matrix using the two-dimensional Gaussian distribution formula, and heatmap labels are generated for the grayscale image based on the heatmap matrix, including:
[0012] in, The box indicates a lung nodule. Boxes indicating lung nodules The corresponding Gaussian value; Based on the calculated Gaussian values, which are the magnitudes of the elements at the corresponding positions in the all-zero two-dimensional matrix, a heatmap matrix is obtained. The heatmap matrix is subjected to maximum value normalization, and the normalized heatmap matrix is used to generate heatmap labels for the grayscale image.
[0013] In an optional implementation, it further includes: Construct a dataset of lung nodules containing raw lung CT images and their corresponding heatmap labels; A fully convolutional neural network was trained using the lung nodule dataset, and the fully convolutional neural network was used to identify lung nodules in lung CT images; The training loss function is:
[0014] in Represents the pixel index of a CT image. This indicates the number of pixels in a CT image. Indicates the network in the 1st... Predicted value per pixel Indicates the first heatmap label The value of each pixel.
[0015] Secondly, the present invention provides a CT image thermal tagging system, comprising: The format conversion module is used to acquire the original lung CT images and convert the original lung CT images into grayscale images in a preset standard format; The parameter extraction module is used to identify lung nodules in the CT image and obtain the center coordinates, width, and height of the lung nodules; A matrix construction module is used to construct a zero-based two-dimensional matrix of the same size as the grayscale image. The Gaussian modeling module is used to set Gaussian distribution parameters based on the center coordinates, width, and height, and to generate a two-dimensional Gaussian distribution formula based on the Gaussian distribution parameters. The label generation module is used to calculate the Gaussian value for each position of the all-zero two-dimensional matrix using the two-dimensional Gaussian distribution formula to obtain a heatmap matrix, and generate heatmap labels for the grayscale image based on the heatmap matrix.
[0016] Thirdly, a device is provided, comprising: Memory, used to store the CT image heatmap label construction program; A processor is configured to implement the steps of the CT image heatmap label construction method as provided in the first aspect when executing the CT image heatmap label construction program.
[0017] Fourthly, a computer-readable storage medium is provided, on which a CT image heat map label construction program is stored, wherein when the CT image heat map label construction program is executed by a processor, the steps of the CT image heat map label construction method as provided in the first aspect are implemented.
[0018] The beneficial effects of this invention are as follows: the CT image heatmap label construction method, device, and storage medium provided by this invention have significant advantages over traditional discrete binary labels: 1) Accurate representation of density distribution: By generating heatmaps based on Gaussian distributions of nodule location and size, it can naturally and continuously simulate the gradient decay change of density from the center to the periphery of lung nodules and its boundary ambiguity characteristics, effectively solving the key defect that hard labels cannot express density gradient information; 2) Significantly improved model performance: It provides richer and more medically relevant supervision signals for deep learning models (especially segmentation networks), significantly improving the model's learning ability and final recognition accuracy for nodule fine structures and boundary regions; 3) High efficiency and strong consistency: The automated generation process avoids tedious manual fine annotation, greatly reducing annotation costs and time, and ensuring the consistency and objectivity of labels, providing reliable support for building high-quality training datasets and having wide applicability. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic flowchart of a method according to an embodiment of the present invention.
[0021] Figure 2 This is another illustrative flowchart of a method according to an embodiment of the present invention.
[0022] Figure 3 This is a rendering of a lung nodule marking box label, which is an embodiment of the present invention.
[0023] Figure 4 This is a thermal image of lung nodules labeled using a method according to an embodiment of the present invention.
[0024] Figure 5 This is a schematic block diagram of a system according to an embodiment of the present invention.
[0025] Figure 6 This is a schematic diagram of the structure of a device provided in an embodiment of the present invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
[0028] The purpose of this invention is to propose a method for constructing heatmap labels for lung nodule detection in deep learning CT images, addressing the following problems: This addresses the problem that existing coordinate regression-based lung nodule detection algorithms cannot achieve end-to-end training; To address the issue that the background region within the bounding box of lung nodules affects the model's inference of coordinate regression offset, leading to a decrease in nodule detection accuracy; This paper proposes to transform the existing deep learning-based CT image lung nodule detection algorithm from a cognitive task to a perceptual task, thereby addressing the problem that the prediction results and working mechanism of the coordinate regression-based lung nodule detection algorithm are difficult to explain.
[0029] The CT image heat map label construction method provided in this embodiment of the invention is executed by a computer device, and correspondingly, the CT image heat map label construction system runs on the computer device.
[0030] Figure 1This is a schematic flowchart illustrating a method according to an embodiment of the present invention. Wherein, Figure 1 The implementing entity can be a CT image heatmap labeling system. Depending on different needs, the order of the steps in this flowchart can be changed, and some can be omitted.
[0031] like Figure 1 As shown, the method includes: S1. Acquire raw lung CT images and convert the raw lung CT images into grayscale images in a preset standard format; S2. Identify lung nodules in the CT image and obtain the center coordinates, width, and height of the lung nodules; S3. Construct a two-dimensional matrix of all zeros of the same size as the grayscale image; S4. Set the Gaussian distribution parameters according to the center coordinates, width, and height, and generate a two-dimensional Gaussian distribution formula based on the Gaussian distribution parameters; S5. By using the two-dimensional Gaussian distribution formula to calculate the Gaussian value for each position of the all-zero two-dimensional matrix, a heatmap matrix is obtained, and a heatmap label is generated for the grayscale image based on the heatmap matrix.
[0032] In one embodiment of the present invention, based on step S1, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0033] S101. Acquire raw lung CT images in DICOM or MHD format, wherein each pixel of the raw lung CT image is represented by 12 bits and the potential value range of each pixel is [-1024, 3071].
[0034] Raw lung CT image data is stored in DICOM or MHD format, with pixel values encoded with 12-bit precision and a dynamic range covering [-1024, 3071] HU (Hounsfield Unit). This range fully encompasses the key imaging features of lung tissue, where the grayscale differences between air (approximately -1000 HU), lung parenchyma (-400 to -600 HU), soft tissue (0 to 600 HU), and bone (>600 HU) provide the basis for subsequent lesion detection. Given the high dynamic range of 12-bit data, direct linear mapping can easily lead to the loss of grayscale gradients in low-density areas (such as emphysema). Therefore, a nonlinear compression strategy is required to optimize information retention efficiency.
[0035] S102. Extract pixel values in the range of [-1024, 600] from the original lung CT image, and set all pixel values exceeding 600 to 600.
[0036] Pixel truncation was performed on the original CT images, preserving the original information within the [-1024, 600] HU range, and uniformly setting pixel values exceeding 600 HU to 600 HU. This processing is based on clinical imaging characteristics: values above 600 HU are mainly bone and high-density calcifications, and their grayscale information contributes little to the identification of lung nodules (especially ground-glass nodules). Truncation reduces the interference of invalid information on subsequent transformations, while preserving the complete dynamic range of lung parenchyma (-1000 to -400 HU) and intermediate-density tissue (-400 to 600 HU).
[0037] S103. Map the pixel values of the cropped lung CT image to the range of [0, 255], and store the mapped image as a grayscale image in JPEG, JPG, or PNG format.
[0038] (1) Use Sigmoid or logarithmic transformation to perform nonlinear compression on 12-bit data, and prioritize the preservation of grayscale gradients in the key range of [-1000, -400HU]. Avoid excessive compression of low-density areas (such as emphysema) by linear mapping, and improve the generation accuracy of heatmap labels around nodules.
[0039] The Sigmoid transform is implemented by mapping data using a Sigmoid function with adjustable parameters. Its mathematical expression is:
[0040] Where k is the slope parameter (controlling the steepness of the curve), and x0 is the center point (set to -700HU, i.e., the midpoint of the interval [-1000, -400HU]). By adjusting the value of k (a value of 1e-3 is recommended), the function exhibits a high slope characteristic in the interval [-1000, -400HU], mapping a gray-level difference of 100HU in this interval to an output gray level of 80-100, while maintaining a lower slope in the intervals [-1024, -1000HU] and [-400, 600HU], thus achieving gradient enhancement of low-density lung parenchyma and moderate compression of high-density regions.
[0041] Logarithmic Transform Optimization: To further suppress the grayscale ratio of high-density regions (such as the chest wall), logarithmic correction is performed on the results after the Sigmoid transform.
[0042] Here, a and b are normalization parameters to ensure that the output range remains within [0, 255]. This step can reduce the grayscale weight in the [-400, 600HU] range, avoiding interference from structures such as blood vessels and chest walls on the generation of heatmap labels for the periphery of nodules (mostly located between -600 and -600HU).
[0043] (2) The output is in 8-bit PNG / TIFF format, and DICOM metadata (such as Slice Thickness, Spacing) is embedded into the EXIF field. It maintains the original accuracy, supports subsequent processing such as 3D reconstruction, and meets the needs of expansion.
[0044] The mapped grayscale images are stored in 8-bit PNG / TIFF format. Compared to 8-bit format, 8-bit depth preserves intermediate precision during the transformation process (although visually presented as 256 gray levels, the original mapped values are stored as 8-bit integers), providing a data foundation for subsequent processing such as 3D reconstruction and multimodal fusion. Simultaneously, DICOM metadata (including slice thickness, spacing, patient ID, scan parameters, etc.) is embedded in the image file header using the EXIF toolkit, ensuring the integrity of the association between spatial positioning information and grayscale data. The metadata embedding adopts the DICOM standard label correspondence (e.g., 0018, 0050 corresponds to slice thickness, 0028, 0030 corresponds to spacing) and follows the EXIF 2.31 specification, supporting direct parsing by mainstream medical image analysis software (such as ITK and SimpleITK).
[0045] This scheme solves the problem of gradient compression in low-density regions in linear mapping through nonlinear transformation, enabling the gray-level differences of fine structures such as emphysema (-900 to -800 HU) to be effectively distinguished (gray-level difference ≥15 levels after mapping); the 8-bit storage format ensures that the original transformation accuracy is not lost, and supports the recovery of the original dynamic range of [-1024, 600] HU through inverse transformation, meeting the requirements of voxel value accuracy for 3D reconstruction; the complete embedding of metadata ensures the consistency of spatial coordinates of the image, providing data integrity support for extended applications such as multi-slice registration and lesion localization.
[0046] In one embodiment of the present invention, based on step S2, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0047] S201. Use an expert system to generate bounding boxes for lung nodules in CT images.
[0048] A two-stage target detection framework based on deep learning is adopted to achieve automatic identification of lung nodules, so as to balance detection accuracy and localization accuracy. The base network uses an improved ResNet-50 as the feature extraction backbone. By introducing dilated convolution to replace the traditional convolutional layer, the receptive field is expanded while maintaining the feature map resolution, which enhances the feature capture ability of nodules of different sizes (especially small nodules ≤5mm).
[0049] After the candidate boxes output by the model are filtered by confidence (threshold ≥ 0.6), initial labeled boxes for lung nodules are generated. To correct boundary offset, a bounding box refinement algorithm is used: for each candidate box, its IoU value with the labeled box is calculated. If the IoU < 0.7, the box position is optimized by fine-tuning the coordinates. Specifically, adjustments are made based on the difference between the center coordinates of the initial box and the center coordinates of the labeled box, combined with a set learning factor (set to 0.3). Through iteration, the coverage of the final box with the actual nodule region is ≥ 90%.
[0050] S202. Extract the center coordinates, width, and height of the marked box as the center coordinates, width, and height of the lung nodule.
[0051] Extract three core parameters from the optimized marker boxes: Center coordinates: Based on the pixel coordinate system of the CT slice, calculate the two-dimensional coordinates of the center point of the box, and convert them into physical coordinates (unit: mm) by combining the pixel spacing in the DICOM metadata. Width and Height: Extract the pixel width and height of the bounding box, and convert them to physical dimensions using the pixel spacing. For 3D CT sequences, the 3D volume parameters of the nodules need to be calculated in conjunction with the slice thickness (applicable to multi-slice nodules). After parameter extraction, the data is standardized to remove outliers caused by motion artifacts (such as boxes with a width > 30mm). The final output format is structured data containing physical coordinates, dimensions, and confidence levels, providing basic features for subsequent nodule benign or malignant determination.
[0052] In one embodiment of the present invention, based on step S3, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0053] S301. Construction of Blank Heatmap Matrix Based on the size of the preprocessed CT image (typically 512×512 pixels), a dimensionally perfectly matched all-zero matrix is initialized as the base canvas for heatmap generation. Each element of this matrix corresponds to a pixel at the same coordinates in the CT image, with an initial value of 0, representing a 100% probability that the location belongs to the background region (non-nodule). The matrix uses a 32-bit floating-point data type (float32), which satisfies the storage precision requirements of probability values (0-1) while effectively controlling memory usage, providing a numerical basis for subsequent pixel-by-pixel probability updates.
[0054] The row and column indices of the matrix correspond to the vertical pixel coordinates (i) and horizontal pixel coordinates (j) of the CT image, respectively, forming a strict one-to-one spatial mapping. This indexing mechanism ensures the consistency between the heatmap and the original CT image in spatial dimensions, providing a precise coordinate reference system for subsequent probability diffusion based on nodule bounding boxes.
[0055] S302. Nodal Box Coordinate Mapping Rules For the nodule bounding box label (x, y, w, h) output by the recognition model, (x, y) represents the coordinates of the box's center point in the CT image pixel coordinate system, and (w, h) represents the width and height of the box, respectively. The following steps are used to map the bounding box label to the coordinates of the heatmap matrix: First, the center point (x, y) of the bounding box is directly mapped to the corresponding index position (x, y) in the heatmap matrix, ensuring that the spatial location of the nodule core region in the heatmap is completely consistent with that in the CT image. Second, the boundary coordinates of the bounding box are calculated based on the width w and height h: the left boundary is x minus half of w, the right boundary is x plus half of w, the upper boundary is y minus half of h, and the lower boundary is y plus half of h. These boundary coordinates are then converted to integer indices in the heatmap matrix through a rounding operation (using the rounding method), ensuring that the bounding box forms a closed region within the discrete pixel grid.
[0056] For special cases involving cross-boundary operations (such as when the edge of the box exceeds the size of the heatmap), boundary truncation is used: coordinates that exceed the matrix range are forcibly constrained to the valid index range of [0, 511] (for a 512×512 matrix) to avoid mapping errors caused by coordinate value indexing and ensure the robustness of heatmap generation.
[0057] This coordinate mapping mechanism establishes a precise spatial correspondence between the nodule bounding box and the heatmap matrix, laying a spatial benchmark for subsequent probability assignment based on distance weights and ensuring that the heatmap can accurately reflect the location and morphological characteristics of the nodule in the CT image.
[0058] In one embodiment of the present invention, based on step S4, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0059] Set the x and y coordinates of the central coordinate system to the mean of a Gaussian distribution. , The standard deviation of the two-dimensional Gaussian distribution takes the following values: ,in Values When r=3, the heat map value of the nodule boundary is about 60% of the peak value; for irregular nodules, r=4 is used to cover a wider area. is the width, and h is the height.
[0060] The Gaussian distribution function is:
[0061] in, The box indicates a lung nodule. Boxes indicating lung nodules The corresponding Gaussian value.
[0062] A two-dimensional Gaussian distribution function is used to describe the probability decay characteristics of the nodule region. Its core principle is that, with the nodule center as the peak point, the probability value decays exponentially as the distance between the pixel and the center increases. The calculation process of this function avoids the inefficient traditional double loop approach and adopts a vectorized operation strategy: a coordinate grid matrix matching the size of the heatmap matrix (e.g., 512×512) is generated using NumPy's meshgrid function, where each element represents the pixel coordinates (i,j) of the corresponding location.
[0063] Based on the coordinate grid matrix, the Gaussian value of all pixels is calculated synchronously: for each coordinate (i,j) in the grid, its Gaussian value is calculated by the horizontal distance term (ix)² / (2σ). x ²) and the longitudinal distance term (jy) 2 / (2σᵧ 2 The sum of the values determines the probability value in the [0,1] interval, which is then converted to an exponential function. Vectorization reduces the computational complexity from O(n²) to O(n) (where n is the side length of the matrix), which can shorten the computation time by more than 80% in a 512×512 matrix, significantly improving the efficiency of heatmap generation.
[0064] In one embodiment of the present invention, based on step S5, a possible embodiment will be given below, and its specific implementation will be described in a non-limiting manner.
[0065] The practical calculation of the two-dimensional Gaussian distribution formula needs to be decomposed into: for i in range(matrix_width): for j in range(matrix_height): G[i,j] = exp(-( ((ix)^2) / (2*σ_x^2) + ((jy)^2) / (2*σ_y^2) )).
[0066] Use vectorized operations (such as NumPy's np.meshgrid) instead of loops to accelerate the generation of large-scale matrices.
[0067] The Gaussian values obtained from vectorization are used as the magnitudes of the elements at the corresponding positions in the all-zero two-dimensional matrix to obtain the heatmap matrix. Specifically, the Gaussian value matrix obtained from vectorization is superimposed element-wise with the initial all-zero matrix to generate the preliminary heatmap matrix. To unify the probability scale, the heatmap matrix is normalized: the maximum value of the matrix is scaled to 1.0 (corresponding to the highest probability of the nodule center point), and the remaining elements are scaled proportionally to ensure that the probability distribution range of the entire heatmap is strictly controlled within the [0,1] interval.
[0068] The maximum value of the heatmap matrix was scaled to 1.0 (corresponding to the nodule center point), and the values at other locations were proportionally attenuated. To suppress background noise interference, a threshold filtering mechanism was employed: pixels with normalized values less than 0.01 were forcibly set to zero. These pixels are typically located in the background area surrounding the nodule region, and the filtering operation reduces the interference of irrelevant information on subsequent analysis. The optimized heatmap matrix retains the high-probability characteristics of the nodule core region and naturally simulates the blurred transition of the nodule edge through Gaussian decay, providing an accurate probability density representation for subsequent nodule morphology analysis and benign / malignant determination.
[0069] In one embodiment, a method for constructing CT image thermal labels is provided, the method flow is as follows: Figure 2 As shown, the method includes the following steps: (1) Use the Python toolkit pydicom to read lung CT images stored in dicom or mhd format files; (2) Each pixel of the CT image is represented by 12-bit, and the potential value range of each pixel is [-1024, 3071]. Pixel values in the range of [-1024, 600] are extracted from the CT image (pixel values exceeding 600 are all set to 600). (3) According to the formula The pixel values of the cropped lung CT image are mapped to the range [0, 255]. It can display CT images and save them as JPEG, JPG, or PNG images. (4) such as Figure 3 As shown, in CT images containing lung nodules, they are indicated by boxes. Use the box to select lung nodules, among which Indicates the center coordinates of the lung nodule. These represent the width and height of the pulmonary nodule, respectively. (5) Construct a two-dimensional matrix of all zeros of the same size as the CT image, and apply the two-dimensional Gaussian distribution formula.
[0070] Generate in a two-dimensional matrix as follows Figure 4 The lung nodule heat map labels shown The mean of a two-dimensional Gaussian distribution , The values are the coordinates of the center point of the lung nodule. and The standard deviation of the two-dimensional Gaussian distribution takes the following values: ,in The possible values are 2, 3, and 4; (6) Repeat steps 4 and 5 to construct a lung nodule dataset containing CT images and their corresponding heatmap labels; (7) Using the dataset constructed in step 6, train any fully convolutional neural network (such as FCN, U-Net) to detect lung nodules in CT images. The training loss function is:
[0071] in Represents the pixel index of a CT image. This indicates the number of pixels in a CT image. Indicates the network in the 1st... Predicted value per pixel Indicates the first heatmap label The value of each pixel.
[0072] In some embodiments, the CT image thermal image labeling system may include multiple functional modules composed of computer program segments. The computer programs for each program segment in the CT image thermal image labeling system may be stored in the memory of a computer device and executed by at least one processor to perform (see details). Figure 1 (Description) Functionality for constructing CT image heatmap labels.
[0073] In this embodiment, the CT image thermal image labeling system can be divided into multiple functional modules based on its functions, such as... Figure 5 As shown. The module referred to in this invention is a series of computer program segments that can be executed by at least one processor and perform a fixed function, and is stored in memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0074] The format conversion module is used to acquire the original lung CT images and convert the original lung CT images into grayscale images in a preset standard format; The parameter extraction module is used to identify lung nodules in the CT image and obtain the center coordinates, width, and height of the lung nodules; A matrix construction module is used to construct a zero-based two-dimensional matrix of the same size as the grayscale image. The Gaussian modeling module is used to set Gaussian distribution parameters based on the center coordinates, width, and height, and to generate a two-dimensional Gaussian distribution formula based on the Gaussian distribution parameters. The label generation module is used to calculate the Gaussian value for each position of the all-zero two-dimensional matrix using the two-dimensional Gaussian distribution formula to obtain a heatmap matrix, and generate heatmap labels for the grayscale image based on the heatmap matrix.
[0075] Figure 6The CT image thermal tag construction method provided in the embodiments of this application can be applied to devices. Those skilled in the art will understand that the device structure involved in the embodiments of this invention does not constitute a limitation on the device. A device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. In the embodiments of this invention, the device includes, but is not limited to, laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of this application described and / or claimed herein.
[0076] The device 600 may include a processor 610, a memory 620, and a communication unit 630. These components communicate via one or more buses. Those skilled in the art will understand that the server structure shown in the figures does not constitute a limitation of the present invention. It may be a bus topology or a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0077] The memory 620 can be used to store execution instructions of the processor 610. The memory 620 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. When the execution instructions in the memory 620 are executed by the processor 610, the device 600 is able to perform some or all of the steps in the above method embodiments.
[0078] The processor 610 serves as the control center of the storage device, connecting various parts of the electronic device via various interfaces and lines. It executes software programs and / or modules stored in the memory 620, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, the processor 610 may consist only of a central processing unit (CPU). In this embodiment of the invention, the CPU may have a single processing core or include multiple processing cores.
[0079] The communication unit 630 is used to establish a communication channel, enabling the storage device to communicate with other devices. It can receive user data sent by other devices or send user data to other devices.
[0080] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, which, when executed, may include some or all of the steps provided in the embodiments of the present invention. The storage medium may be a magnetic disk, an optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0081] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or any other medium capable of storing program code. It includes several instructions to cause a computer device (which may be a personal computer, a server, or a second device, network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0082] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.
[0083] In the embodiments provided by this invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between systems or modules may be electrical, mechanical, or other forms.
[0084] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0085] In addition, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0086] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the present invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the present invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should also be covered within the protection scope of the present invention.
Claims
1. A method for constructing thermal tags for CT images, characterized in that, include: Acquire raw lung CT images and convert the raw lung CT images into grayscale images in a preset standard format; Identify lung nodules in the CT image and obtain the center coordinates, width, and height of the lung nodules; Construct a two-dimensional matrix of all zeros of the same size as the grayscale image; Based on the center coordinates, width, and height, set the Gaussian distribution parameters, and generate a two-dimensional Gaussian distribution formula based on the Gaussian distribution parameters; A heatmap matrix is obtained by calculating Gaussian values for each position of the all-zero two-dimensional matrix using the two-dimensional Gaussian distribution formula, and heatmap labels are generated for the grayscale image based on the heatmap matrix.
2. The method according to claim 1, characterized in that, Acquiring raw lung CT images and converting them into grayscale images in a preset standard format includes: Acquire raw lung CT images in DICOM or MHD format, wherein each pixel of the raw lung CT image is represented by 12 bits and the potential value range of each pixel is [-1024, 3071]. Pixel values within the range of [-1024, 600] are extracted from the original lung CT image, and all pixel values exceeding 600 are set to 600. The pixel values of the extracted lung CT images are mapped to the range [0, 255], and the mapped images are stored as grayscale images in JPEG, JPG, or PNG format.
3. The method according to claim 2, characterized in that, The pixel values of the cropped lung CT image are mapped to the range [0, 255], including: Use Sigmoid or logarithmic transformation to perform non-linear compression on 12-bit data, prioritizing the preservation of grayscale gradients in the key range of [-1000, -400HU].
4. The method according to claim 2, characterized in that, The mapped image is stored as a grayscale image in JPEG, JPG, or PNG format, including: The output is in 8-bit PNG / TIFF format, and DICOM metadata is embedded into the EXIF field.
5. The method according to claim 1, characterized in that, Identify and mark lung nodules in the CT image, and obtain the center coordinates, width, and height of the lung nodules, including: Using an expert system to generate bounding boxes for lung nodules in CT images; The center coordinates, width, and height of the marked box are extracted as the center coordinates, width, and height of the lung nodule.
6. The method according to claim 1, characterized in that, Based on the center coordinates, width, and height, the Gaussian distribution parameters are set, including: Set the x and y coordinates of the central coordinate system to the mean of a Gaussian distribution. , The standard deviation of the two-dimensional Gaussian distribution takes the following values: ,in Values When r=3, the heat map value of the nodule boundary is about 60% of the peak value; for irregular nodules, r=4 is used to cover a wider area. is the width, and h is the height.
7. The method according to claim 6, characterized in that, A heatmap matrix is obtained by calculating Gaussian values for each position of the all-zero two-dimensional matrix using the two-dimensional Gaussian distribution formula, and heatmap labels are generated for the grayscale image based on the heatmap matrix, including: in, The box indicates a lung nodule. Boxes indicating lung nodules The corresponding Gaussian value; Based on the calculated Gaussian values, which are the magnitudes of the elements at the corresponding positions in the all-zero two-dimensional matrix, a heatmap matrix is obtained. The heatmap matrix is subjected to maximum value normalization, and the normalized heatmap matrix is used to generate heatmap labels for the grayscale image.
8. The method according to claim 1, characterized in that, The method further includes: Construct a dataset of lung nodules containing raw lung CT images and their corresponding heatmap labels; A fully convolutional neural network was trained using the lung nodule dataset, and the fully convolutional neural network was used to identify lung nodules in lung CT images; The training loss function is: in Represents the pixel index of a CT image. This indicates the number of pixels in a CT image. Indicates the network in the 1st... Predicted value per pixel Indicates the first heatmap label The value of each pixel.
9. A CT image thermal tagging device, characterized in that, include: Memory, used to store the CT image heatmap label construction program; A processor, configured to implement the steps of the CT image heatmap labeling method as described in any one of claims 1-8 when executing the CT image heatmap labeling construction program.
10. A computer-readable storage medium storing a computer program, characterized in that, The readable storage medium stores a CT image heat map label construction program, which, when executed by a processor, implements the steps of the CT image heat map label construction method as described in any one of claims 1-8.