Image segmentation labeling method and system based on machine learning
Through the machine learning-based image segmentation method, combined with data preprocessing, deep learning and dynamic geometric feature analysis, efficient and accurate lesion labeling of lung CT images is achieved, solving the problem of time-consuming and labor-consuming and inaccurate segmentation in the existing technology, and improving the efficiency and accuracy of lesion detection.
Patent Information
- Application Number
- CN202510815142.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-06-18
AI Technical Summary
The prior art has problems such as time-consuming and labor-consuming, inaccurate segmentation results, and imbalance in lesion detection efficiency and accuracy in lung CT image segmentation and lesion labeling, especially in complex boundaries and overlapping areas, which are difficult to meet the needs of large-scale screening.
Through machine learning-based image segmentation methods, including data preprocessing, deep learning segmentation, dynamic geometric feature analysis and boundary correction, end-to-end lesion annotation is achieved, dynamic triangular grid units and preset threshold ranges are used for boundary correction, and lesion type annotation is combined with multimodal feature analysis.
It improves the efficiency and accuracy of medical imaging analysis, reduces the work burden of doctors, improves the accuracy and efficiency of lesion detection, especially the detection rate of micro lesions, and meets the needs of large-scale screening.
Smart Images

Figure CN120339733A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision, and particularly to an image segmentation and annotation method and system based on machine learning. Background Art
[0002] In the field of medical image diagnosis, the accurate segmentation and lesion annotation of lung CT images are crucial for early lung cancer screening, preoperative planning, and efficacy evaluation. However, the traditional method of manually outlining the boundaries and annotating lesions may be time-consuming and laborious, with a long processing time for a single CT image, and may be difficult to meet the efficiency requirements of large-scale screening.
[0003] With the development of deep learning, models such as U-Net and DeepLab have achieved automated extraction of lung contours, and the segmentation time has been shortened to the second level. However, there may still be many problems in the existing technology: complex boundaries such as the interlobar fissure and the diaphragmatic attachment may cause boundary deviation of the segmentation model due to low CT image contrast, noise interference, or anatomical structure variation, and the incidence of over-segmentation or under-segmentation exceeds 15%, which may affect the integrity of lesion detection; some existing models rely on data-driven learning and may not incorporate geometric priors of normal lung anatomical structures such as the smoothness, area, and aspect ratio of the lung lobe edge. The boundary processing of lesion overlapping regions such as nodules adhering to the pleura may deviate from medical common sense, and the segmentation results do not meet clinical anatomical standards; some traditional manual lesion detections have a high missed diagnosis rate, especially for micro-nodules less than 5 mm, and automated annotation based on a rule engine or a single deep learning model may have a mislabeling rate exceeding 10% in the classification of fuzzy lesions such as inflammation and ground-glass nodules, resulting in an imbalance between efficiency and accuracy. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide an image segmentation and annotation method and system based on machine learning, which can reduce the workload of doctors through end-to-end operations from image acquisition to lesion annotation, and based on the segmentation results, the lesion annotation unit can accurately locate the lesion position.
[0005] To solve the above technical problems, the technical solution of the present invention is as follows: In the first aspect, an image segmentation and annotation method based on machine learning, the method includes: Step S1: Obtain lung CT image data; Step S2: Preprocess the lung CT image data to generate an optimized CT image; Step S3: Input the optimized CT image into an image segmentation model, and output an initial segmentation result including the boundary coordinates of the lung tissue; Step S4: Based on the boundary morphology of the initial segmentation result, dynamically select three detection points in the key area of the segmentation boundary to construct a dynamic triangular mesh unit; calculate geometric feature values according to the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature values include the proportional relationship between the area and side length of the triangular mesh unit; Step S5: Compare the geometric feature values with the preset dynamic threshold range. When the geometric feature value exceeds the upper threshold, calculate the excess amount and convert it into an inward contraction offset according to the preset proportional coefficient; when the geometric feature value is lower than the lower threshold, calculate the shortage amount and convert it into an outward expansion offset according to the preset proportional coefficient; generate boundary coordinate correction parameters in the corresponding direction based on the above offsets; adjust the boundary coordinates of the lung region segmentation result according to the correction parameters to generate a corrected lung region segmentation result; Step S6: Perform lesion annotation on the corrected lung region segmentation result to generate a final lung image with lesion type labels.
[0006] Further, in Step S1: Obtain lung CT image data, including: Obtain the original lung CT scan data transmitted from a medical imaging device; Perform data parsing and processing on the original lung CT scan data to generate lung CT image data in a standard format.
[0007] Further, in Step S2: Preprocess the lung CT image data to generate an optimized CT image, including: Perform noise suppression processing on the lung CT image data to generate an intermediate image with reduced noise; Perform contrast enhancement processing on the intermediate image with reduced noise to generate an optimized CT image.
[0008] Further, in Step S3: Input the optimized CT image into an image segmentation model and output an initial segmentation result including the boundary coordinates of the lung tissue, including: Perform multi-scale feature encoding on the optimized CT image through the feature extraction path of a pre-trained deep learning segmentation model to generate a hierarchical feature map; wherein, the feature extraction path includes multiple cascaded feature extraction stages, and each stage includes at least one convolutional layer and one downsampling layer; generate a multi-scale hierarchical feature map with decreasing spatial resolution and increasing semantic information through successive downsampling operations; Perform decoding and feature fusion processing on the multi-scale hierarchical feature map through the feature reconstruction path of the image segmentation model, wherein the feature reconstruction path includes multiple cascaded reconstruction stages, and each stage performs an upsampling operation and a cross-path feature fusion operation, and generates an initial segmentation probability map of the lung tissue through successive processing; Perform binarization processing on the initial segmentation probability map to obtain a binary mask image of the lung tissue; Perform a contour extraction algorithm on the binary mask image, identify and obtain the sequence of boundary pixel coordinates of the lung tissue, and form an initial segmentation result containing the boundary coordinates of the lung tissue.
[0009] Further, step S4: Based on the boundary morphology of the initial segmentation result, dynamically select three detection points in the key regions of the segmentation boundary to construct a dynamic triangular mesh cell; calculate the geometric feature values according to the vertex coordinates of the dynamic triangular mesh cell, and the geometric feature values include the proportional relationship between the area and side length of the triangular mesh cell, including: Based on the boundary coordinate sequence of the initial segmentation result, identify the key regions in the lung tissue boundary that meet any of the following conditions: the suspected lesion area where the curvature change rate exceeds the preset threshold; the boundary fuzzy area where the gray gradient value difference between adjacent boundary points is lower than the preset threshold; in the key region, dynamically select three non-collinear detection points according to the principle of spatial interval uniformity. The principle of spatial interval uniformity requires that the detection points are evenly distributed in the boundary point sequence of the key region so that the spatial distances between the points are equal and non-collinearity is satisfied at the same time; Connect the three detection points in the order of spatial adjacency to construct a dynamic triangular mesh cell, where: the vertex coordinates of each come from the pixel positions of the boundary coordinate sequence; Calculate the ratio value of the area of the dynamic triangular mesh cell to the longest side length as the geometric feature value.
[0010] Further, adjust the boundary coordinates of the lung region segmentation result according to the correction parameters to generate a corrected lung region segmentation result, including: Based on the correction parameters, perform local translation or contraction adjustment on the boundary coordinates of the initial segmentation result to generate a corrected lung region segmentation result.
[0011] Further, step S6: Perform lesion annotation on the corrected lung region segmentation result to generate a final lung image with lesion type labels, including: Based on the corrected lung region segmentation result, extract all connected components as candidate lesion regions; Perform bimodal feature analysis on each candidate lesion region, including morphological features and imaging features; based on the pre-trained lesion classification model, divide the candidate regions into three categories: nodule region, tumor region, and inflammation region, and output a dataset of lesion region positions with spatial coordinates; Perform type label encoding on each region in the lesion region position dataset, and at the same time perform structured label generation, add lesion type labels to the DICOM image header file, and overlay a text annotation layer containing lesion type statistical information in the lower right corner of the image; finally, fuse the label information with the original CT image to generate a final lung image with lesion type labels.
[0012] Second aspect, an image segmentation and annotation system based on machine learning, comprising: An acquisition module, configured to acquire lung CT image data; A preprocessing module, configured to preprocess the lung CT image data to generate an optimized CT image; A segmentation processing module, configured to input the optimized CT image into an image segmentation model, and output an initial segmentation result including the boundary coordinates of the lung tissue; A calculation module, configured to dynamically select three detection points in the key areas of the segmentation boundary based on the boundary morphology of the initial segmentation result, and construct a dynamic triangular mesh unit; calculate geometric feature values according to the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature values include the proportional relationship between the area and side length of the triangular mesh unit; A correction module, configured to compare the geometric feature values with a preset dynamic threshold range. When the geometric feature values exceed the upper threshold, calculate the excess amount, and convert it into an inward contraction offset according to a preset proportional coefficient; when the geometric feature values are lower than the lower threshold, calculate the deficiency amount, and convert it into an outward expansion offset according to a preset proportional coefficient; generate boundary coordinate correction parameters in the corresponding directions based on the above offsets; adjust the boundary coordinates of the lung region segmentation result according to the correction parameters to generate a corrected lung region segmentation result; An annotation module, configured to perform lesion annotation on the corrected lung region segmentation result to generate a final lung image with lesion type labels.
[0013] Third aspect, a computing device, comprising: One or more processors; A storage device, configured to store one or more programs, and when the one or more programs are executed by the one or more processors, enable the one or more processors to implement the method.
[0014] Fourth aspect, a computer-readable storage medium, in which a program is stored, and when the program is executed by a processor, the method is implemented.
[0015] The above solution of the present invention has at least the following beneficial effects: Through the whole process operations such as standardized data acquisition, preprocessing optimization, deep learning automated segmentation, dynamic geometric feature analysis, boundary intelligent correction, and automated lesion annotation, the efficiency and accuracy of medical image analysis are improved: data parsing and format unification eliminate the barriers of device differences, and noise suppression and contrast enhancement lay the foundation for accurate segmentation; deep learning enables rapid segmentation and captures multi-scale features, dynamic geometric analysis focuses on the key areas with blurred boundaries, and the boundary correction mechanism combined with medical prior thresholds reduces segmentation errors, effectively correcting over-segmentation or under-segmentation problems; automated annotation reduces the time of manual annotation, and balances efficiency and accuracy through model pre-screening and manual review, improving the detection rate of small lesions. Brief Description of the Drawings
[0016] Figure 1 It is a schematic flowchart of a machine learning-based image segmentation and annotation method provided by an embodiment of the present invention.
[0017] Figure 2 It is a schematic diagram of a machine learning-based image segmentation and annotation system provided by an embodiment of the present invention. Detailed Embodiments
[0018] Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.
[0019] As Figure 1 shown, an embodiment of the present invention proposes a machine learning-based image segmentation and annotation method, and the method includes the following steps: Step S1: Obtain lung CT image data; Step S2: Preprocess the lung CT image data to generate an optimized CT image; Step S3: Input the optimized CT image into an image segmentation model, and output an initial segmentation result including the boundary coordinates of the lung tissue; Step S4: Based on the boundary morphology of the initial segmentation result, dynamically select three detection points in the key areas of the segmentation boundary to construct a dynamic triangular mesh unit; calculate geometric feature values according to the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature values include the proportional relationship between the area and side length of the triangular mesh unit; Step S5: Compare the geometric feature values with a preset dynamic threshold range. When the geometric feature value exceeds the upper threshold, calculate the excess amount and convert it into an inward contraction offset according to a preset proportional coefficient; when the geometric feature value is lower than the lower threshold, calculate the deficiency amount and convert it into an outward expansion offset according to a preset proportional coefficient; generate boundary coordinate correction parameters in the corresponding direction based on the above offsets; adjust the boundary coordinates of the lung region segmentation result according to the correction parameters to generate a corrected lung region segmentation result. Step S6: Perform lesion annotation on the corrected lung region segmentation result to generate a final lung image with lesion type labels.
[0020] In the embodiment of the present invention, through preprocessing, the original lung CT image data is denoised and contrast enhanced, effectively suppressing device noise and respiratory artifacts, improving the gray contrast between lung tissues and lesion areas, enhancing the recognition ability of tiny lesions in low-contrast images, and reducing the risk of missed labeling; with the help of a dynamic geometric feature correction mechanism, dynamic detection points are set in the key areas of the segmentation boundary to construct triangular grid units. By calculating the geometric feature values of the area-to-side length ratio and comparing them with the preset threshold, the intelligent correction of fuzzy and adherent lesion boundaries is realized, solving the problem of adhesion or fracture in traditional model segmentation; the whole process is automatically processed from image acquisition to end-to-end operation of lesion annotation, reducing the workload of doctors; based on the high-precision segmentation result, the lesion annotation unit can accurately locate the lesion position.
[0021] In a preferred embodiment of the present invention, the above step S1: Obtain lung CT image data, which may include: Step S11, obtain the original lung CT scan data transmitted from a medical imaging device; Step S12, perform data parsing processing on the original lung CT scan data to generate lung CT image data in a standard format.
[0022] In the embodiment of the present invention, obtaining the original data transmitted from a medical imaging device ensures the authority and integrity of the data source, while being compatible with the output formats of different devices, avoiding data transmission loss or damage; through data parsing processing, the original data is converted into a standard format, breaking the data barrier between devices, realizing efficient cross-platform interaction, and improving the data circulation efficiency. In addition, the standardization process unifies parameters such as pixel spacing and gray value range of the image, eliminates data deviation caused by device differences, helps the algorithm focus on lung tissue characteristics, and improves segmentation accuracy and analysis accuracy.
[0023] In the embodiment of the present invention, when specifically applied, it can be realized through the following technical solutions, for example: In the above step S11, a network connection is established with devices such as a CT scanner and a PACS (Picture Archiving and Communication System) through the DICOM (Digital Imaging and Communications in Medicine) protocol, and data transmission requests are monitored in real time.
[0024] Receive the original scan data in the DICOM standard format, including the image pixel matrix, patient information, and scan parameters (slice thickness, window width and level, etc.). During the process, automatically verify the data integrity, such as checking the file header identifier and data block checksum, to ensure that there is no data loss or byte error during transmission.
[0025] If multi-sequence scan data such as plain scan and enhanced scan are received simultaneously, sequence matching is performed based on metadata such as time stamps and examination numbers to ensure accurate association of multiple groups of data for the same patient.
[0026] In the above step S12, parse the pixel data field in the DICOM file, convert the original grayscale values with a depth of 12 bits or 16 bits into standard floating-point numerical values (such as normalized values in the range of 0-1), and at the same time extract spatial parameters such as the image size (number of rows and columns) and slice spacing; according to the image positioning matrix (ImagePositionPatient, ImageOrientationPatient) in the DICOM header file, uniformly convert the spatial coordinates of each slice into standardized coordinates based on the patient's body coordinate system to ensure the spatial position accuracy during multi-slice three-dimensional reconstruction; encapsulate the decoded pixel data and standardized metadata into a standard format recognizable by the system (such as NIfTI, NPY, or preprocessed PNG sequences), and establish an index for storage according to the patient ID and examination time for subsequent batch calls.
[0027] In a preferred embodiment of the present invention, the above step S2: preprocess the lung CT image data to generate an optimized CT image, which may include: Step S21, perform noise suppression processing on the lung CT image data to generate an intermediate image with reduced noise; Step S22, perform contrast enhancement processing on the intermediate image with reduced noise to generate an optimized CT image.
[0028] In the embodiments of the present invention, through noise suppression processing, the noise of the scanning device and the patient's respiratory motion artifacts are effectively eliminated, a pure image base is constructed, the edges of fine structures such as lung blood vessels and nodules are made clearer, and boundary misjudgment caused by noise is avoided; at the same time, by selecting and adjusting the parameters of the adaptive filtering algorithm, the edge gradient information of the lung parenchyma and lesion areas is maximally retained during the noise reduction process; through local contrast enhancement processing, the edges and internal textures of low-contrast lesions such as ground-glass nodules and thickened interlobular septa are made prominent.
[0029] In the embodiments of the present invention, when specifically applied, it can be implemented through the following technical solutions, for example: In step S21 above, by analyzing the local gray-scale fluctuation characteristics of the image (such as the gray-scale difference between adjacent pixels, regional variance), the type of noise (such as Gaussian noise, salt-and-pepper noise, electronic noise, etc.) is automatically determined.
[0030] If salt-and-pepper noise is detected, the median filtering algorithm is adopted. A 3×3 or 5×5 rectangular neighborhood is defined with the current pixel as the center, and the current pixel value is replaced with the median of the pixel gray-scales in the neighborhood, eliminating isolated noise points while preserving edge details; if Gaussian noise exists, Gaussian filtering or bilateral filtering is selected, and the filter kernel size and weight distribution are dynamically adjusted according to the noise standard deviation, and the gray-scales of the neighborhood pixels are weighted and averaged, suppressing high-frequency noise while avoiding excessive blurring of the tissue boundary; for the common quantum noise in CT images, non-local means filtering (NLM) can be combined, and the weighted average is performed by searching for similar local blocks in the image, achieving noise attenuation globally.
[0031] The filtered image is detected twice, and the noise power spectral density or peak signal-to-noise ratio (PSNR) before and after preprocessing is compared to ensure that the noise level is reduced to below the preset threshold.
[0032] In step S22 above, based on the preliminary lung segmentation mask (which can be obtained by simple threshold segmentation or morphological operations), the lung parenchyma region is automatically recognized, excluding the interference of background tissues such as the chest wall and bones on the contrast calculation; the histogram equalization (HE) or contrast-limited adaptive histogram equalization (CLAHE) algorithm is used to adjust the gray-scale distribution of the lung parenchyma region; among them, CLAHE divides the image into multiple sub-blocks, and local histogram equalization is performed on each sub-block respectively, avoiding the over-enhanced noise problem that occurs at the junction of the lung field (low gray-scale region) and the mediastinum (high gray-scale region) in traditional global equalization; combined with the window width and window level characteristics of CT images, through a gray-scale linear transformation function (such as piecewise linear stretching), the gray-scale values within the lung window range are mapped to the display interval of 0-255, highlighting the gray-scale difference between lung lesions (such as nodules, exudative foci) and normal lung tissues.
[0033] Calculate the contrast index (such as the average gray-scale difference between adjacent regions) or structural similarity index (SSIM) of the enhanced image to ensure that the gray-scale contrast of subtle lung lesions (such as ground-glass opacity) is increased by more than 30% compared to the original image.
[0034] In a preferred embodiment of the present invention, step S3 above: inputting the optimized CT image into an image segmentation model and outputting an initial segmentation result including the coordinates of the lung tissue boundary may include: Step S31: Perform multi-scale feature encoding on the optimized CT image through the feature extraction path of a pre-trained deep learning segmentation model to generate a hierarchical feature map. The feature extraction path includes multiple cascaded feature extraction stages, and each stage includes at least one convolutional layer and one downsampling layer. Through step-by-step downsampling operations, a multi-scale hierarchical feature map with decreasing spatial resolution and increasing semantic information is generated. Step S32: Decode and perform feature fusion processing on the multi-scale hierarchical feature map through the feature reconstruction path of the image segmentation model. The feature reconstruction path includes multiple cascaded reconstruction stages, and each stage performs an upsampling operation and a cross-path feature fusion operation. Through step-by-step processing, an initial segmentation probability map of the lung tissue is generated. Step S33: Perform binarization processing on the initial segmentation probability map to obtain a binary mask image of the lung tissue. Step S34: Perform a contour extraction algorithm on the binary mask image to identify and obtain the sequence of boundary pixel coordinates of the lung tissue, forming an initial segmentation result including the boundary coordinates of the lung tissue.
[0035] In the embodiment of the present invention, through the multi-stage convolution and downsampling operations of the pre-trained deep learning model, the feature expression ability can be enhanced and the integrity of semantic information can be improved, enabling the model to take into account the detailed texture and overall contour of the lung tissue and reducing the segmentation error caused by semantic confusion. In the decoding and fusion stage, by using upsampling and cross-path feature fusion, the spatial details are accurately restored and the quality of the segmentation probability map is optimized, ensuring that the boundary segmentation is more consistent with the actual situation. Binarization and contour extraction further simplify the result and accurately obtain the boundary coordinates, outputting structured data for clinical applications.
[0036] In the embodiment of the present invention, when specifically applied, it can be realized through the following technical solutions, for example: In the above step S31, the deep learning image segmentation model is constructed based on the encoder-decoder architecture, combined with the multi-scale feature fusion and pre-trained transfer learning strategy: Adopt a backbone network such as ResNet or UNet++ to gradually extract multi-scale features from shallow to deep through convolutional layers; decoder path (feature reconstruction): Through deconvolution and skip connections, fuse deep semantic features and shallow detail features, and gradually restore the spatial resolution to generate the final segmentation map; pre-training strategy: Pre-train the model weights on a publicly available medical image dataset (such as LIDC-IDRI), and then fine-tune for a specific task (such as lung boundary segmentation) to improve the generalization ability of the model.
[0037] Uniformly adjust the optimized CT image (usually 512×512×N layers) to the model input size (such as 512×512) to ensure consistency with the training data format.
[0038] Map the CT value (HU) to the range of 0 - 1 to eliminate the differences in scanning parameters between different devices; for example: linearly scale the region of interest in the lungs (usually -1000~+1000HU) to the interval of 0 - 1; bones (greater than 400HU) and air (less than -1000HU) outside the range are clipped to fixed values.
[0039] Shallow feature extraction (the first layer of convolution), use a 3×3 convolution kernel to scan the input image, extract underlying features such as edges and textures, and the generated feature map retains a high resolution (512×512), containing detailed information such as the lung wall contour and thick blood vessels.
[0040] Middle - layer feature encoding (the middle convolution layer), through multiple groups of convolution - BN - ReLU modules, gradually extract middle - layer structural features such as the lung lobe interface and segmental bronchi; use a 2×2 max - pooling layer to reduce the resolution (such as 512→256→128), expand the receptive field, and capture regional - level structural relationships.
[0041] Deep - layer semantic encoding (ResNet residual block / Transformer), utilize residual connections or attention mechanisms to extract high - level features such as the overall morphology of the lung parenchyma and the semantic differences between lesions and normal tissues, generating a low - resolution (such as 32×32) but high - semantic feature map, containing global information about the overall lung contour and lesion location.
[0042] Store the feature maps at different levels (such as the shallow 512×512, the middle 128×128, and the deep 32×32) in descending order of spatial resolution; each layer of the feature map retains unique semantic information: the shallow layer focuses on details, and the deep layer focuses on the global view.
[0043] In the above step S32, starting from the deep - layer low - resolution feature map, perform upsampling (such as restoring from 32×32 to 64×64) through deconvolution (such as transposed convolution) or interpolation (such as bilinear interpolation). In each upsampling step, fuse the encoder features and decoder features of the same scale through skip connections; for example, add the 128×128 feature map after upsampling in the decoder and the 128×128 feature map of the corresponding level in the encoder element - by - element to retain edge details.
[0044] The fused feature map contains both high-level semantic information (such as the overall judgment of the "lung region") and low-level detailed information (such as the precise position of the tissue edge), ensuring the accuracy of the segmentation boundary; the fused feature map is mapped into a binary classification probability map (lung tissue / background) through a 1×1 convolutional layer; the Sigmoid activation function is used to compress the output value to the range of 0-1, and each pixel value represents the probability of belonging to the lung tissue; a dedicated boundary loss function (such as BoundaryLoss) or attention mechanism (such as the edge attention module) is introduced to enhance the sensitivity of the model to the boundary region and optimize the boundary segmentation accuracy.
[0045] In the above step S33, according to the characteristics of the probability heat map, a threshold can be selected. The fixed threshold method (such as 0.5) or the adaptive threshold method (such as determining the optimal threshold by maximizing the inter-class variance through the Otsu algorithm, and the local threshold method of block calculation to adapt to regional contrast differences) can be used; each pixel value is compared with the threshold, and if it is greater than or equal to the threshold, it is determined as lung tissue (assigned 1), and if it is less than the threshold, it is determined as the background (assigned 0), and GPU acceleration or multi-threading is used to improve the processing efficiency of large-size images; after the pixel-level determination, morphological post-processing is performed. The opening operation (erosion first and then dilation) is used to eliminate isolated noise points and separate adhesive non-target regions, and the closing operation (dilation first and then erosion) is used to fill small holes and enhance the connectivity of the lung tissue. A small-size (such as 3×3 to retain fine boundaries) or large-size (such as 5×5 to process significant noise) structural element is selected according to the noise level.
[0046] After identifying all connected regions, only the region with the largest area is retained as the effective lung tissue, and the residual noise regions with an area smaller than the preset threshold are removed; to optimize the boundary, Gaussian filtering can be performed on the probability map before binarization to reduce jaggedness, and median filtering can be applied to the mask image after binarization to eliminate salt-and-pepper noise; at the same time, quality verification is carried out, the area of the mask is calculated and compared with the expected range. When abnormal, re-segmentation or manual intervention is triggered, the closure of the outer contour is detected, and the broken part is repaired through morphological operations or interpolation algorithms; a multi-scale strategy combining rough segmentation and fine refinement is adopted to balance efficiency and accuracy, and the region growing method is supplemented to optimize the boundary fitting degree from known regions such as the hilum of the lung. For specific clinical scenarios, the extremely low-density region of pneumothorax is marked separately, and the boundary of pleural effusion is distinguished through gray-scale morphology or edge detection; finally, the binary mask is visualized through pseudo-color mapping for doctors to evaluate, and it is stored in a standardized manner according to the DICOM or NIFTI format and associated with the original CT image.
[0047] In the above step S34, through a contour detection algorithm (such as Canny edge detection or contour extraction based on connected components), the closed contour of the lung tissue in the binary image is identified; the pixel coordinates on the contour are extracted to generate an ordered sequence of boundary coordinates (such as (x1, y1), (x2, y2),..., (x n , y n), to form an initial segmentation result containing the boundary coordinates of the lung tissue.
[0048] In a preferred embodiment of the present invention, in the above step S4: based on the boundary morphology of the initial segmentation result, three detection points are dynamically selected in the key area of the segmentation boundary to construct a dynamic triangular mesh unit; according to the vertex coordinates of the dynamic triangular mesh unit, geometric feature values are calculated, and the geometric feature values include the proportional relationship between the area and the side length of the triangular mesh unit, which may include: Step S41, based on the boundary coordinate sequence of the initial segmentation result, identify the key areas in the lung tissue boundary that meet any of the following conditions: the suspected lesion area where the curvature change rate exceeds the preset threshold; the boundary blur area where the difference in gray gradient values between adjacent boundary points is lower than the preset threshold; within the key area, three non-collinear detection points are dynamically selected according to the principle of spatial interval uniformity. The principle of spatial interval uniformity requires that the detection points are evenly distributed in the boundary point sequence of the key area so that the spatial distances between the points are equal and non-collinearity is satisfied at the same time; Step S42, connect the three detection points in the order of spatial adjacency to construct a dynamic triangular mesh unit, where: the vertex coordinates of each come from the pixel positions of the boundary coordinate sequence; Step S43, calculate the ratio of the area of the dynamic triangular mesh unit to the longest side length as the geometric feature value.
[0049] In the embodiment of the present invention, the suspected lesion area and the boundary blur area of the lung boundary are dynamically identified through the curvature change rate and the gray gradient difference, and three non-collinear detection points are selected in the key area according to the principle of spatial interval uniformity to accurately locate the local features of abnormal morphology while adapting to the individual differences of the boundaries of different patients; the detection points are connected in sequence to construct a dynamic triangular mesh unit, and the abstract boundary morphology is transformed into a structured geometric model to quantitatively analyze features such as concavity, convexity, and irregularity, and local modeling can reduce the computational complexity compared with global contour analysis, balancing efficiency and accuracy; furthermore, calculate the ratio of the area of the triangular mesh unit to the longest side length as the geometric feature value, and the value can sensitively reflect the abnormal boundary morphology.
[0050] In the embodiment of the present invention, when specifically applied, it can be implemented through the following technical solutions, for example: In the above step S41, the curvature of the boundary pixels of the initial segmentation result is calculated, that is, the local curvature value is estimated by the included angle of the normal vectors of adjacent points or the second derivative; the regions with curvature values exceeding a preset threshold (such as 1.5 times the standard deviation) are screened to locate the areas where the boundary concavity and convexity change violently (such as the edge of a lobulated tumor); combined with the gray information of the CT image, the gradient change rate of the boundary region is calculated, and the lower the gradient value, the more blurred the boundary (such as the transition region between an inflammatory lesion and normal lung tissue); the regions with gray gradient values lower than the threshold (such as 50 HU / mm) are identified and marked as boundary blurred regions (such as the junction between a ground-glass nodule and the surrounding lung parenchyma).
[0051] In each key region, three non-collinear detection points are selected according to the following rules: Point A is the point with the maximum curvature (representing the most prominent feature of the boundary, such as the tip of a tumor lobe); Point B is the boundary point farthest from Point A (to expand the coverage of the triangular mesh unit); Point C is the intermediate point between Point A and Point B, and the component of its curvature direction perpendicular to the AB connection line is the largest (to enhance the sensitivity of the triangular mesh unit to the local morphology).
[0052] In the above step S42, the two-dimensional pixel coordinates (x1, y1), (x2, y2), (x3, y3) of the three detection points, as well as the slice thickness and pixel spacing of the CT image (pixel spacing, that is, the physical size of a single pixel in the horizontal / vertical direction, usually in mm) are obtained and converted into three-dimensional physical coordinates.
[0053] Assuming that the three points are on the same layer of the CT sequence (i.e., the z coordinates are the same), the three-dimensional coordinates of each point are: (x i × pixel spacing, y i × pixel spacing, slice thickness × number of layers), where the number of layers is determined by the index of the CT sequence, and the product of the slice thickness and the number of layers is the z-axis physical coordinate; if the three points are distributed on different layers (such as a cross-layer lesion), the z coordinates of each are calculated separately according to the layer number where they are located.
[0054] For three points (X1, Y1, Z1), (X2, Y2, Z2), (X3, Y3, Z3) in three-dimensional space, the least squares method is used to fit the best plane on which they lie. The general equation of the plane is ax + by + cz + d = 0, and the goal of fitting is to find a set of coefficients a, b, c, d such that the sum of the squares of the distances from these three points to the plane reaches the minimum.
[0055] The three-dimensional coordinates of each point are vertically projected onto the fitted plane to obtain the two-dimensional coordinates (u i , v i) to eliminate redundant information in the z-axis direction; according to the projected 2D coordinates, determine the order of the points by the vector cross product to ensure that the three points are connected in a clockwise or counterclockwise direction to form a closed triangular mesh unit; for example, calculate the cross product of the vectors (X2−X1, Y2−Y1) and (X3−X1, Y3−Y1). If the result is positive, the three points are arranged counterclockwise, otherwise they are arranged clockwise; check whether the first and last points are connected to ensure that there is no gap in the triangular mesh unit to form a complete triangular mesh unit area.
[0056] When calculating the three internal angles θ1, θ2, and θ3 of the triangular mesh unit, the vector dot product formula is used. For each vertex i, take the two edge vectors with the vertex as the common endpoint, divide the dot product of these two vectors by the product of their moduli, and the result is the cosine value of the angle θᵢ, which can then be used to calculate the size of the internal angle.
[0057] If the internal angle is too small (such as less than 30°) or too large (such as greater than 150°), it indicates that the triangular mesh unit is morphologically deformed (such as sharp or flat), which may affect the accuracy of subsequent geometric feature calculations; fine-tune the position of point C: select the vertex with abnormal angle (assuming it is point C), move it a short distance (such as 1-3 pixels of physical size) along the curvature direction of its boundary (determined by local gradient or edge direction), and recalculate the new triangular mesh unit internal angle until all angles are within a reasonable range (such as 30°~150°); determine the curvature direction: determine the convexity of the boundary by detecting the gradient direction of the boundary pixels near point C, and ensure that the movement direction conforms to the morphological trend of the actual lung structure (such as smooth movement to the inside or outside of the lung parenchyma).
[0058] In the above step S43, in the fitting plane, a triangular mesh unit is constructed with the projected two-dimensional coordinates, and its area is calculated using the vector cross product method. The specific steps are as follows: Select any two points (such as point A and point B) to form vector AB=(u2-u1, v2-v1), and then select another point (such as point C) to form vector AC=(u3-u1, v3-v1); the modulus of the cross product of vectors AB and AC is equal to the area of the parallelogram formed by the two vectors, and its calculation formula can be simplified to the absolute value of the difference between the product of the horizontal coordinate difference and the vertical coordinate difference; the area of the triangular mesh unit formed by the three non-collinear detection points is half of the area of the parallelogram, so the true area value of the triangular mesh unit can be obtained by half of the cross product modulus.
[0059] Calculate the Euclidean distance (i.e., the straight-line distance between two points) of the three sides of the triangular mesh unit to determine the longest side; compare the distance values of the three sides and take the maximum value as the longest side; for example, if AB=5mm, BC=7mm, CA=6mm, then the longest side is BC=7mm.
[0060] Divide the calculated area of the triangular mesh cell by the length of the longest side to obtain the area-to-side ratio (ALSR), which is used as a geometric feature value to quantify the abnormality degree of the boundary morphology.
[0061] In a preferred embodiment of the present invention, adjusting the boundary coordinates of the lung region segmentation result according to the correction parameter to generate a corrected lung region segmentation result may include: Perform local translation or contraction adjustment on the boundary coordinates of the initial segmentation result based on the correction parameter to generate a corrected lung region segmentation result.
[0062] In the embodiments of the present invention, by comparing the geometric feature value with a preset threshold range, the region that does not conform to the normal lung morphology in the segmentation result can be quickly located, providing a basis for subsequent correction; the correction parameter is dynamically generated based on the deviation degree, which can not only effectively correct the abnormal region, but also maintain the stability of the normal region, avoiding anatomical structure distortion caused by overcorrection; through local fine adjustment, the accuracy of the segmentation result is improved, especially for the adhesion region and the boundary blurred region, and at the same time, the natural morphological characteristics of the lung are maintained.
[0063] In the embodiments of the present invention, when specifically applied, the above step S5 can be implemented by the following technical solutions, for example: Step S51, according to the anatomical characteristics of the normal lung, set a reasonable range of geometric features, for example: area ratio: the ratio of the lung region area to the total thoracic cavity area, which is usually between 0.65 and 0.85 for normal adults (slightly different due to body type differences); length-width ratio: the ratio of the left-right diameter to the up-down diameter of the lung, and the normal range is about 1.2 to 1.5 (upright position CT scan). For the characteristics of specific diseases (such as emphysema, pulmonary fibrosis), adjust the threshold range, for example: the lung area ratio of patients with emphysema may increase significantly (greater than 0.9), and the length-width ratio decreases (less than 1.0); set different thresholds according to different stages of CT scans (such as inspiration phase, expiration phase), for example: the threshold range of the lung area ratio in the inspiration phase is [0.7, 0.85], and in the expiration phase is [0.6, 0.75]; divide the lung into regions such as the upper lobe and the lower lobe, and set independent thresholds for each region, for example: the length-width ratio threshold of the right upper lobe of the lung may be [1.1, 1.4], while the lower lobe is [1.3, 1.6].
[0064] Collect a large amount of lung CT data of healthy individuals, calculate the distribution of each geometric feature (such as mean ± standard deviation), for example: calculate the area ratio of 1000 healthy samples, and obtain the mean μ = 0.75 and the standard deviation σ = 0.05, then the threshold range can be set as [μ - 2σ, μ + 2σ] = [0.65, 0.85]; identify and remove extreme outliers through methods such as box plot (BoxPlot) to ensure that the threshold range reflects the true physiological characteristics.
[0065] Consider the correlation between multiple geometric features and construct a multi-dimensional threshold space. For example, when the area ratio > 0.8, the aspect ratio is required to be > 1.2 at the same time; otherwise, it is determined as abnormal. Dynamically adjust the threshold according to the values of other features. For example, when the density of the lung field is lower than a certain threshold, appropriately relax the upper limit of the area ratio (allowing abnormal enlargement in patients with emphysema).
[0066] Based on a database of healthy individuals, calculate the mean (μ) and standard deviation (σ) of each geometric feature. For example, count the area ratios of 1000 healthy samples to obtain a mean μ = 0.75 and a standard deviation σ = 0.05. For each original feature value (x), use the formula "(original value - mean) ÷ standard deviation" for conversion to obtain a standardized value (x'). For example, if the original value of the area ratio of a sample is 0.85, the standardized value is (0.85 - 0.75) ÷ 0.05 = 2.
[0067] Determine the minimum value (min(x)) and maximum value (max(x)) of each feature in the healthy samples. For example, the minimum value of a certain feature in the healthy samples is 0.6, and the maximum value is 0.9. For each original feature value (x), use the formula "(original value - minimum value) ÷ (maximum value - minimum value)" for conversion to map the feature value to the interval [0, 1]. For example, if the original value of the feature of a sample is 0.75, the standardized value is (0.75 - 0.6) ÷ (0.9 - 0.6) = 0.5.
[0068] The purpose of threshold interval mapping is to align the preset threshold range (based on medical knowledge or statistical analysis) with the standardized feature values for easy judgment of the deviation degree.
[0069] According to the standardization method (such as Z-score or Min-Max), convert the preset original threshold range into a standardized interval. For example, if the preset area ratio threshold is [0.65, 0.85] and Z-score standardization (μ = 0.75, σ = 0.05) is adopted, the corresponding standardized interval is [-2, 2].[[]END]]
[0070] Further map the standardized feature value (x') to the interval [0, 1], and the rules are as follows: If x' ≤ the lower limit of the standardized threshold, the mapped value is 0 (indicating completely below the normal range); If x' ≥ the upper limit of the standardized threshold, the mapped value is 1 (indicating completely above the normal range); If x' is between the upper and lower limits, the mapped value is "(x' - lower limit of standardization) ÷ (upper limit of standardization - lower limit of standardization)", reflecting the relative position of the feature value within the normal range.
[0071] For example: If the standardized area ratio is 1.5 (within the interval [-2, 2]), then the mapping value is (1.5 - (-2)) ÷ (2 - (-2)) = 3.5 ÷ 4 = 0.875.
[0072] The purpose of deviation degree calculation is to quantify the degree to which the eigenvalue deviates from the preset threshold range, providing a basis for boundary correction; when the standardized eigenvalue (x') exceeds the upper limit of the standardized threshold, calculate the excess ratio: (x' - upper limit of standardization) ÷ upper limit of standardization, and convert it into an inward contraction offset according to the preset proportional coefficient (such as 0.1). For example: If the standardized area ratio is 2.5 (the upper limit is 2), then the excess ratio is (2.5 - 2) ÷ 2 = 0.25 (i.e., exceeding the upper limit by 25%); when the standardized eigenvalue (x') is lower than the lower limit of the standardized threshold, calculate the deficiency ratio: (lower limit of standardization - x') ÷ lower limit of standardization, and convert it into an outward expansion offset. For example: If the standardized length-width ratio is 0.8 (the lower limit is 1), then the deficiency ratio is (1 - 0.8) ÷ 1 = 0.2 (i.e., 20% lower than the lower limit).
[0073] According to the calculated deviation degree, convert the deviation degree into a specific offset value through a preset mapping function (such as a linear function or a non-linear function); determine the correction direction according to the deviation direction of the eigenvalue (greater than the upper limit or less than the lower limit). For example: When the area ratio is too large, the correction direction is inward contraction; when the area ratio is too small, the correction direction is outward expansion.
[0074] Combining the offset and the correction direction, generate the correction parameters for the boundary coordinates. The parameter form can be coordinate offsets (Δx, Δy) or scaling factors (such as a contraction coefficient of 0.95 or an expansion coefficient of 1.05); generate targeted correction parameters according to the deviation degree of the characteristics of the local area of the lung boundary (such as high-curvature areas, fuzzy areas).
[0075] Step S52, select a local adjustment strategy according to the correction requirements. If it is an overall size abnormality, adopt overall offset correction, directly add the offset (Δx, Δy) to the boundary point coordinates. If it is a proportion imbalance, perform radial scaling correction based on the centroid of the lung parenchyma, and multiply the distance along the vector direction from the boundary point to the centroid by the scaling factor; divide the boundary into multiple local areas based on the curvature distribution or anatomical structure (such as interlobar fissures, hilar regions) and apply exclusive correction parameters to different areas. For example, for high-curvature lesion areas, use a smaller scaling factor to retain details.
[0076] During the coordinate adjustment execution phase, traverse the boundary coordinate sequence, and perform translation or scaling operations point by point according to the correction parameters of the affiliated region. If it involves cross-layer boundaries, synchronously adjust the z-axis component of the three-dimensional coordinates in combination with the CT slice thickness and pixel pitch. After adjustment, repair local discontinuities through B-spline curve fitting to eliminate jaggedness or mutations, and then apply Gaussian filtering to the boundary coordinate sequence to balance detail retention and smoothing effects, avoiding excessive blurring of the true anatomical structure.
[0077] In a preferred embodiment of the present invention, the above step S6: performing lesion annotation on the corrected lung region segmentation result to generate a final lung image with lesion type labels may include: Step S61, based on the corrected lung region segmentation result, extract all connected components as candidate lesion regions; Step S62, perform bimodal feature analysis on each candidate lesion region, including morphological features and imaging features; based on a pre-trained lesion classification model, divide the candidate regions into three categories: nodule regions, tumor regions, and inflammation regions, and output a dataset of the positions of lesion regions with spatial coordinates; Step S63, perform type marking encoding on each region in the lesion region position dataset, and at the same time generate a structured label, add a lesion type label to the DICOM image header file, and overlay a text annotation layer containing lesion type statistical information in the lower right corner of the image; finally, fuse the marked information with the original CT image to generate a final lung image with lesion type labels.
[0078] In the embodiment of the present invention, by extracting all connected components in the corrected segmentation result as candidate lesion regions, potential lesions of different sizes and shapes in the lungs can be captured, preventing missed detections caused by manual screening and laying a foundation for accurate diagnosis; perform bimodal feature analysis of morphology and imaging on each candidate region, and use a pre-trained lesion classification model to divide it into three categories: nodules, tumors, and inflammation, and output a position dataset with spatial coordinates. While realizing multi-dimensional lesion characterization, the accuracy of automatic classification is improved through the generalization ability of the model; perform type marking encoding on the lesion regions and generate structured labels embedded in the DICOM image header file, combined with the lesion type statistical information annotation layer in the lower right corner of the image, which not only realizes standardized data storage and cross-device sharing, but also makes the lesion location, type and anatomical structure intuitively corresponding through the fusion of the marked information and the original CT image, reducing the doctor's reading time of the image and providing a visual basis for treatment plan formulation.
[0079] In the embodiment of the present invention, when specifically applied, it can be realized through the following technical solutions, for example: In the above step S61, analyze the density characteristics (such as the HU value range) of the corrected lung CT image, identify abnormal density regions (such as the high density of nodules and the ground-glass opacity of inflammation), mark the high-density regions with HU values greater than 300 (suspected nodules or calcifications), and mark the ground-glass density regions between -300 and -100 (suspected inflammation); combine morphological characteristics (such as circularity greater than 0.5 and edge smoothness) to distinguish nodules from blood vessel shadows, which are mostly elongated and have low circularity.
[0080] Perform a four-neighborhood search on the binary mask image, extract all connected regions, retain the regions with an area greater than 3 pixels², and use the region growing algorithm with suspected lesion points (such as pixels with HU greater than 300) as seeds to expand the region in combination with the Otsu adaptive threshold.
[0081] Use a pre-trained object detection model (such as Faster R-CNN, YOLO) to scan the lung region and output the bounding box (BoundingBox) or mask (Mask) of the lesion candidate region; the input of the model is the corrected segmented image, spatial features are extracted through convolutional layers, and the anchor box mechanism is used to match lesions of different sizes (such as small nodules and large tumors); use suspected lesion points (such as pixels with HU values greater than 300) as seed points, expand the connected region through the region growing algorithm, and segment the lesion region in combination with an adaptive threshold (such as the Otsu algorithm); exclude regions with too small an area (such as less than 3 pixels²) to reduce noise interference.
[0082] Convert the pixel coordinates of the lesion region into coordinates in the global coordinate system of the image, record the upper left and lower right coordinates (x1, y1, x2, y2) or the vertex coordinates of the triangular mesh cells; add metadata to each lesion region, including: the lung lobe to which the annotation belongs (such as the upper lobe of the right lung), the distance from the pleura, etc.; the morphological parameters are area, perimeter, and longest diameter; the density characteristics are the average HU value and density uniformity; exclude regions with logical contradictions through a rule engine (such as regions with an area greater than 30% of the total lung area are considered invalid), and retain the detection results with a confidence level greater than 0.8.
[0083] In the above step S62, calculate the area, perimeter, ratio of the long axis to the short axis, circularity, edge roughness (such as lobulation, spiculation), and solidity of the candidate region; statistically calculate the mean, standard deviation, and density uniformity of the CT values within the region, mark features such as ground-glass density and calcification foci, extract the HU value range [-1000, 400] and map it to [0, 1]; uniformly adjust the lesion ROIs of different sizes to 224×224 pixels, use bilinear interpolation, and add random rotation (±15°), flipping, scaling (0.9 to 1.1 times), and Gaussian noise to enhance sample diversity.
[0084] Adopt the ResidualBlock structure to alleviate the vanishing gradient problem through skip connections, which is suitable for dealing with deep networks (such as ResNet50 / 101); the feature maps are densely connected between layers, enhancing feature reuse and reducing the number of parameters, being more friendly to small-sample data.
[0085] Initialize the network with the model parameters pre-trained on large-scale datasets such as ImageNet, retaining the extraction ability of low-level visual features (such as edges and textures); for the characteristics of medical images, fine-tune the parameters of the convolutional layers to adapt to the characteristics of lung lesions (such as adjusting the statistics of the BatchNormalization layer).
[0086] Uniformly adjust the ROI (with different sizes) of the lesion area to 224×224 pixels, and use bilinear interpolation to avoid image distortion; truncate the HU value range [-1000, 400] and linearly map it to the [0, 1] interval to enhance the contrast; randomly rotate (±15°), flip (horizontally / vertically), and scale (0.9~1.1 times) to increase sample diversity, and add Gaussian noise (σ = 0.01) to the CT images to simulate the noise characteristics of different scanning devices.
[0087] The ROI images pass through the convolutional layers of the pre-trained network (such as the 5 stages of ResNet) in sequence to extract multi-scale features; shallow features (such as the first convolutional layer) capture low-level information such as edges and textures; deep features (such as the last residual block) abstract the morphological and structural features of the lesions. Compress the feature maps into a fixed-length feature vector (such as 2048 dimensions) through Global Average Pooling; the feature vector passes through 2~3 fully connected layers (such as 2048→512→3), and Dropout (p = 0.5) is introduced to prevent overfitting; the output layer uses the Softmax function to convert the original scores into a class probability distribution (such as [nodule 0.92, tumor 0.03, inflammation 0.05]), and retain the results with a confidence > 0.8.
[0088] Freeze the first few layers of the pre-trained network (such as the first 3 stages), only train the subsequent layers and the classification head, and gradually unfreeze the shallow layers to avoid catastrophic forgetting; use weighted cross-entropy loss to handle the class imbalance problem (such as reducing the weight of nodule samples when they account for a high proportion); use the Adam optimizer (initial learning rate 1e-4), and decay the learning rate to 0.1 times every 10 epochs; terminate the training when the validation set accuracy does not improve for 5 consecutive rounds, and save the optimal model.
[0089] In the above step S63, a unique identifier (such as Lesion_001) is assigned to each lesion area, the marking type (nodule / tumor / inflammation) is marked, the morphological parameters (area, longest diameter), density characteristics (average HU value), and spatial position metadata are recorded; following the DICOM standard, the lesion information, including type, coordinates, and characteristic parameters, is embedded in the private tag segment (0x7000 - 0x7FFF) of the image header file to ensure compatibility with the PACS system.
[0090] On the original lung image, the lesion areas are marked with bounding boxes or masks of different colors: Nodule: Red bounding box, marked with "Nodule + diameter + confidence"; Tumor: Blue mask, marked with "Tumor"; Inflammation: Green dashed bounding box, marked with "Inflammation".
[0091] Statistical information: A semi-transparent text layer is generated in the lower right corner of the image to summarize the number of lesion types (such as "Nodules × 2, Tumors × 1"), and the font color corresponds to the category (red for tumors, blue for nodules, green for inflammation).
[0092] A global view of the distribution of all lung lesions and a local magnified view of a single lesion are generated, ensuring that the marking information is aligned with the anatomical structure and avoiding blocking key areas; DICOM format images (including structured tags) and PNG / JPEG format visualization images are output, and a JSON / CSV format dataset of lesion locations is saved synchronously, including all metadata and classification results.
[0093] As Figure 2 shown, an embodiment of the present invention also provides an image segmentation and annotation system based on machine learning, including: An acquisition module for acquiring lung CT image data; A preprocessing module for preprocessing the lung CT image data to generate an optimized CT image; A segmentation processing module for inputting the optimized CT image into an image segmentation model and outputting an initial segmentation result including the boundary coordinates of the lung tissue; A calculation module for dynamically selecting three detection points in the key areas of the segmentation boundary based on the boundary morphology of the initial segmentation result to construct a dynamic triangular mesh unit; calculating geometric feature values according to the vertex coordinates of the dynamic triangular mesh unit, where the geometric feature values include the proportional relationship between the area and side length of the triangular mesh unit; A correction module is used to compare the geometric feature values with a preset dynamic threshold range. When the geometric feature value exceeds the upper threshold, the excess amount is calculated and converted into an inward contraction offset according to a preset proportional coefficient. When the geometric feature value is lower than the lower threshold, the shortage amount is calculated and converted into an outward expansion offset according to a preset proportional coefficient. Based on the above offsets, boundary coordinate correction parameters in the corresponding directions are generated. According to the correction parameters, the boundary coordinates of the lung region segmentation result are adjusted to generate a corrected lung region segmentation result. A labeling module is used to label the lesions in the corrected lung region segmentation result to generate a final lung image with lesion type labels.
[0094] It should be noted that this system corresponds to the above method. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0095] An embodiment of the present invention further provides a computing device, including: a processor and a memory storing a computer program. When the computer program is run by the processor, the above-mentioned method is executed. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0096] An embodiment of the present invention further provides a computer-readable storage medium storing instructions. When the instructions are run on a computer, the computer is made to execute the above-mentioned method. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0097] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraint conditions of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0098] The above is the preferred implementation manner of the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. An image segmentation annotation method based on machine learning, characterized in that, The method includes: Step S1: Obtain lung CT image data; Step S2: Preprocess the lung CT image data to generate an optimized CT image; Step S3: Input the optimized CT image into an image segmentation model and output an initial segmentation result including the boundary coordinates of the lung tissue; Step S4: Based on the boundary morphology of the initial segmentation result, dynamically select three detection points in the key areas of the segmentation boundary to construct a dynamic triangular mesh unit; calculate geometric feature values according to the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature values include the proportional relationship between the area and side length of the triangular mesh unit; Step S5: Compare the geometric feature values with a preset dynamic threshold range. When the geometric feature value exceeds the upper threshold, calculate the excess amount and convert it into an inward contraction offset according to a preset proportional coefficient; when the geometric feature value is lower than the lower threshold, calculate the shortage amount and convert it into an outward expansion offset according to a preset proportional coefficient; generate boundary coordinate correction parameters in the corresponding directions based on the above offsets; adjust the boundary coordinates of the lung region segmentation result according to the correction parameters to generate a corrected lung region segmentation result; Step S6: Perform lesion annotation on the corrected lung region segmentation result to generate a final lung image with lesion type labels.
2. The image segmentation annotation method based on machine learning according to claim 1, characterized in that Step S2: Preprocess the lung CT image data to generate an optimized CT image, including: Perform noise suppression processing on the lung CT image data to generate an intermediate image after noise reduction; Perform contrast enhancement processing on the intermediate image after noise reduction to generate an optimized CT image.
3. The method for image segmentation annotation based on machine learning according to claim 2, characterized in that Step S3: Input the optimized CT image into an image segmentation model and output an initial segmentation result including the boundary coordinates of the lung tissue, including: Perform multi-scale feature encoding on the optimized CT image through the feature extraction path of a pre-trained deep learning segmentation model to generate a hierarchical feature map; wherein, the feature extraction path includes multiple cascaded feature extraction stages, and each stage includes at least one convolutional layer and one downsampling layer; through the step-by-step downsampling operation, generate a multi-scale hierarchical feature map with decreasing spatial resolution and increasing semantic information; Perform decoding and feature fusion processing on the multi-scale hierarchical feature map through the feature reconstruction path of the image segmentation model, wherein the feature reconstruction path includes multiple cascaded reconstruction stages, and each stage performs an upsampling operation and a cross-path feature fusion operation, and generates an initial segmentation probability map of the lung tissue through step-by-step processing; Perform binarization processing on the initial segmentation probability map to obtain a binary mask image of the lung tissue; Perform a contour extraction algorithm on the binary mask image to identify and obtain the sequence of boundary pixel coordinates of the lung tissue, forming an initial segmentation result including the boundary coordinates of the lung tissue.
4. The method for image segmentation annotation based on machine learning according to claim 3, wherein Step S4: Based on the boundary morphology of the initial segmentation result, dynamically select three detection points in the key areas of the segmentation boundary to construct a dynamic triangular mesh unit; Calculate geometric feature values according to the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature values include the proportional relationship between the area and side length of the triangular mesh unit, including: Based on the boundary coordinate sequence of the initial segmentation result, identify the key regions in the lung tissue boundary that meet any of the following conditions: suspected lesion areas with a curvature change rate exceeding a preset threshold; boundary blur areas where the difference in gray gradient values between adjacent boundary points is lower than the preset threshold; within the key regions, dynamically select three non-collinear detection points according to the principle of spatial interval uniformity; the principle of spatial interval uniformity requires that the detection points be evenly distributed in the boundary point sequence of the key region so that the spatial distances between the points are equal and non-collinearity is satisfied. Connect the three detection points in the order of spatial adjacency to construct a dynamic triangular mesh unit, where: the vertex coordinates of each come from the pixel positions of the boundary coordinate sequence. Calculate the ratio of the area of the dynamic triangular mesh unit to the longest side length as the geometric feature value.
5. The method for image segmentation annotation based on machine learning according to claim 4, wherein Adjust the boundary coordinates of the lung region segmentation result according to the correction parameter to generate a corrected lung region segmentation result, including: Perform local translation or contraction adjustment on the boundary coordinates of the initial segmentation result based on the correction parameter to generate a corrected lung region segmentation result.
6. The method for image segmentation annotation based on machine learning according to claim 5, wherein Step S6: Perform lesion annotation on the corrected lung region segmentation result to generate a final lung image with lesion type labels, including: Based on the corrected lung region segmentation result, extract all connected components as candidate lesion regions. Perform bimodal feature analysis on each candidate lesion region, including morphological features and imaging features; based on a pre-trained lesion classification model, divide the candidate regions into three categories: nodule regions, tumor regions, and inflammation regions, and output a dataset of lesion region positions with spatial coordinates. Perform type label encoding on each region in the lesion region position dataset, and at the same time perform structured label generation, add lesion type labels to the DICOM image header file, and overlay a text annotation layer containing lesion type statistical information in the lower right corner of the image; finally, fuse the marked information with the original CT image to generate a final lung image with lesion type labels.
7. An image segmentation and annotation system based on machine learning, which implements the method described in any one of claims 1 to 6, characterized in that, Including: An acquisition module for acquiring lung CT image data. A preprocessing module for preprocessing the lung CT image data to generate an optimized CT image. A segmentation processing module for inputting the optimized CT image into an image segmentation model and outputting an initial segmentation result containing the boundary coordinates of the lung tissue. A calculation module for dynamically selecting three detection points in the key regions of the segmentation boundary based on the boundary morphology of the initial segmentation result and constructing a dynamic triangular mesh unit. Calculate the geometric feature value according to the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature value includes the ratio relationship between the area of the triangular mesh unit and the side length. A correction module for comparing the geometric feature value with a preset dynamic threshold range. When the geometric feature value exceeds the upper threshold, calculate the excess amount and convert it into an inward contraction offset according to a preset proportional coefficient. When the geometric feature value is lower than the lower threshold, calculate the shortage amount and convert it into an outward expansion offset according to a preset proportional coefficient; generate boundary coordinate correction parameters in the corresponding direction based on the above offsets; adjust the boundary coordinates of the lung region segmentation result according to the correction parameters to generate a corrected lung region segmentation result. A labeling module, configured to perform lesion labeling on the corrected lung region segmentation result to generate a final lung image with lesion type labels.
8. A computing device, characterized in that, Comprising: One or more processors; A storage device for storing one or more programs, which when executed by the one or more processors cause the one or more processors to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, A program is stored in the computer-readable storage medium, and when the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Automatic labeling method and device and storage medium
CN114092689A
Lung medical image processing method and device, equipment and storage medium
CN115409856A
Method and device for marking inside three-dimensional medical model
CN116051553A
Deep learning-based lung CT image pulmonary nodule full-automatic segmentation method and system
CN118072017A
Medical image segmentation method
CN119323587A
Cited By
Method for analyzing abnormal three-dimensional blood flow distribution in pulmonary ventilation-perfusion development area
CN120953282A
A lung ventilation-perfusion imaging region three-dimensional blood flow distribution abnormality analysis method
CN120953282B
Medical image segmentation system and method based on interactive click and adaptive ROI regulation and control
CN121564016A
Medical image segmentation system and method based on interactive point selection and adaptive ROI regulation
CN121564016B
Tumor pathological image typing and grading method and device based on deep learning and residual network technology
CN122049494A