Intelligent Segmentation Method for Skull Defect Regions Based on Medical Images
By optimizing the template matching algorithm, combining grayscale histogram and skull growth direction analysis, and integrating adaptive threshold segmentation and grayscale change index, the skull defect area is accurately located, solving the problem of misjudging osteoporosis in existing technologies and improving the accuracy and safety of skull defect segmentation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-03-06
AI Technical Summary
Existing template-matching-based methods for segmenting skull defects cannot accurately define abnormal areas at the pathological level, and are prone to misidentification of osteoporosis as defect areas, affecting the accuracy of personalized implant design and the safety of surgical planning.
By constructing a window centered on each pixel, combining the Bach distance of the grayscale histogram and the neighborhood similarity analysis of the skull growth direction, the template matching algorithm is optimized. Combined with OTU adaptive threshold segmentation and grayscale change index, the skull defect area is accurately located.
It improves the accuracy of cranial defect segmentation in cranial CT images, reduces misdiagnosis of osteoporosis, provides reliable defect segmentation reference, and provides precise anatomical reference for personalized implant design and surgical planning.
Smart Images

Figure CN121259005B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically to an intelligent segmentation method for skull defect regions based on medical images. Background Technology
[0002] The skull, as a vital skeletal structure protecting the brain, serves as a crucial physical barrier for the normal functioning of the central nervous system. An intact cranial cavity maintains a stable intracranial environment, effectively buffering external impacts. However, skull abnormalities caused by trauma, surgery, or disease can disrupt this seal, leaving the brain without local protection and potentially causing dynamic disturbances in the contents of the cranial cavity. This can lead to complications such as flap depression or encephalocele, severely impacting the patient's neurological function and quality of life. Therefore, accurate segmentation and assessment of abnormal skull areas are prerequisites for personalized cranioplasty planning, implant design, and surgical outcome evaluation. Currently, template-matching algorithms are widely used for intelligent segmentation of abnormal skull areas in medical imaging. The core of this method lies in precisely registering and pixel-level comparing a healthy skull template with the patient's skull in three dimensions. Finally, by calculating the morphological and grayscale differences between the two templates, abnormal areas are identified and segmented, providing precise anatomical references for subsequent repair surgery.
[0003] Existing template-matching-based methods for segmenting skull defects, while effectively identifying abnormal areas that differ from standard templates in density or morphology, have significant clinical limitations: they can only provide preliminary localization of abnormal areas and cannot precisely define these abnormalities at the pathological level. Furthermore, in clinical practice, skull defects are a type of abnormality, and the osteoporotic characteristics exhibited by individual patients due to localized bone density loss can easily be misinterpreted as defect areas on imaging due to decreased density. This misinterpretation directly leads to an exaggeration of the defect extent, severely impacting the accuracy of subsequent personalized implant design and the safety of surgical planning. Summary of the Invention
[0004] To address the aforementioned technical problems, the present invention aims to provide an intelligent segmentation method for skull defect regions based on medical images. The specific technical solution adopted is as follows:
[0005] One embodiment of the present invention provides an intelligent segmentation method for skull defect regions based on medical images, the method comprising:
[0006] Acquire skull CT images and preprocess them to obtain images to be analyzed; obtain template images using skull CT images of each healthy individual;
[0007] A window is constructed centered on each pixel; the difference evaluation index between the two windows in the image to be analyzed is obtained based on the similarity of pixels in a window in the image to be analyzed and a window in the template image that is at the same position as the window.
[0008] Extract skeleton pixels from the template image and perform linear fitting to obtain skeleton lines; obtain the pixel on the skeleton line corresponding to the minimum distance between a pixel in the template image and each pixel on each skeleton line as the corresponding pixel of that pixel; draw tangents to the skeleton lines through the corresponding pixels of each pixel, and take the angle between each tangent and the horizontal direction as the angle between each pixel in the image to be analyzed and the pixel in the same position in the template image.
[0009] The neighboring windows of each window in the image to be analyzed are obtained according to the included angle of each pixel in the image to be analyzed; the difference evaluation index between a window in the image to be analyzed, its neighboring windows and windows in the same position in the template image is used to determine whether the window is an initial abnormal window;
[0010] Determine whether the initial abnormal window is a suspected skull defect window based on the grayscale difference of pixels within a window located in the same position as the template image; determine whether the suspected skull defect window is an abnormal window based on the grayscale changes of pixels within the suspected skull defect window; and segment the image to be analyzed based on the abnormal window to obtain the skull defect region.
[0011] Preferably, the difference evaluation index between the two windows in the image to be analyzed is obtained based on the similarity of pixels within a window in the image to be analyzed and a window in the template image at the same position as the window in the template image, including:
[0012] The gray levels are quantized into B bins, and the gray level distribution of pixels within a window of the image to be analyzed is statistically analyzed to obtain the gray level histogram of that window. The Bach distance between the gray level histograms of the two windows is calculated based on the frequency of occurrence of pixels at each gray level in the gray level histogram of the window in the template image at the same position as the window, and is used as the difference evaluation index between the two windows.
[0013] Preferably, the neighborhood windows of each window in the image to be analyzed are obtained according to the included angle of each pixel in the image to be analyzed, including:
[0014] For a window in the image to be analyzed, half the difference between the window size and a first preset value is used as the basic neighborhood pixel step size. The x-coordinate and y-coordinate of the pixel located at the center of a window in the image to be analyzed are recorded as the x-coordinate and y-coordinate of the center point, respectively. The sine and cosine values of the angle between the pixels located at the center of the window are recorded as the sine and cosine values of the center point, respectively. When the angle between the pixels located at the center of the window is greater than or equal to 90 degrees, the basic neighborhood pixel step size and the cosine value of the center point are subtracted from the x-coordinate of the center point. The product of the values yields the x-coordinate of the left neighborhood. The y-coordinate of the left neighborhood is obtained by adding the product of the basic neighborhood pixel step size and the sine value of the center point to the y-coordinate of the center point. The x-coordinate of the left neighborhood and the y-coordinate of the left neighborhood form the center point of the left neighborhood window. The x-coordinate of the right neighborhood is obtained by adding the product of the basic neighborhood pixel step size and the cosine value of the center point to the x-coordinate of the center point. The y-coordinate of the right neighborhood is obtained by subtracting the product of the basic neighborhood pixel step size and the sine value of the center point from the y-coordinate of the center point. The x-coordinate of the right neighborhood and the y-coordinate of the right neighborhood form the center point of the right neighborhood window.
[0015] When the angle between the center pixel in the window is less than 90 degrees, the left neighborhood x-coordinate is obtained by subtracting the product of the basic neighborhood pixel step size and the center point cosine value from the center point x-coordinate. The left neighborhood y-coordinate is obtained by subtracting the product of the basic neighborhood pixel step size and the center point sine value from the center point y-coordinate. The left neighborhood x-coordinate and the left neighborhood y-coordinate together form the center point of the left neighborhood window. The right neighborhood x-coordinate is obtained by adding the product of the basic neighborhood pixel step size and the center point cosine value to the center point x-coordinate. The right neighborhood y-coordinate is obtained by adding the product of the basic neighborhood pixel step size and the center point sine value to the center point y-coordinate. The right neighborhood x-coordinate and the right neighborhood y-coordinate together form the center point of the right neighborhood window.
[0016] The left and right neighboring windows are the neighboring windows of this window, and they are the same size as this window.
[0017] Preferably, determining whether a window is an initial anomalous window based on a difference evaluation index between a window in the image to be analyzed, its neighboring windows, and windows in the same position in the template image includes:
[0018] Obtain the difference evaluation indexes of the left and right neighboring windows of a window in the image to be analyzed and the windows at the same position in the template image, respectively. Then, calculate the average difference evaluation index of the difference evaluation indexes corresponding to the left and right neighboring windows to obtain the neighborhood average difference evaluation index. Multiply the difference evaluation index of the window and the windows at the same position in the template image by the neighborhood average difference evaluation index and normalize to obtain the local matching score of the window.
[0019] When the local matching score of the window is greater than the first discrimination threshold, the window is an initial abnormal window.
[0020] Preferably, determining whether the initial abnormal window is a suspected skull defect window based on the grayscale difference of pixels within a window at the same location in the template image includes:
[0021] The OSTU adaptive threshold segmentation algorithm automatically determines the optimal segmentation threshold by maximizing the inter-class variance, dividing the pixels within an initial anomaly window into two categories: foreground pixels and background pixels. Similarly, foreground and background pixels in windows in the template image that are at the same position as the initial anomaly window are obtained. The pixel difference of the initial anomaly window is obtained by subtracting the number of foreground pixels in the initial anomaly window from the number of foreground pixels in the windows in the template image that are at the same position as the initial anomaly window and normalizing the result. When the pixel difference of an initial anomaly window is greater than a second discrimination threshold, the initial anomaly window is considered a suspected skull defect window.
[0022] Preferably, determining whether a suspected skull defect window is an abnormal window based on the grayscale changes of pixels within the window includes:
[0023] The first grayscale feature is obtained by obtaining the coefficient of variation of the grayscale values of each pixel in a suspected skull defect window and normalizing it; the second grayscale feature is obtained by obtaining the average gradient magnitude of each pixel in the suspected skull defect window and normalizing it; the grayscale change index of the suspected skull defect window is obtained by weighted summation of the first grayscale feature and the second grayscale feature.
[0024] When the grayscale change index of the suspected skull defect window is greater than the third discrimination threshold, the suspected skull defect window is an abnormal window.
[0025] Preferably, the image to be analyzed is segmented based on the abnormal window to obtain the skull defect region, including:
[0026] The regions covered by each abnormal window in the image to be analyzed are denoted as the regions to be analyzed. Regions in the template image that are in the same position as the regions to be analyzed in the image to be analyzed are denoted as template regions. Edge detection is performed on the template regions to obtain the edges of healthy skulls. The edges of healthy skulls in each template region are mapped to the regions to be analyzed that are in the same position as the template regions, resulting in the edges of healthy skulls in each region to be analyzed. The pixels with the smallest gray values within the edges of healthy skulls in each template region are mapped to the regions to be analyzed that are in the same position as the template regions, serving as the initial seed points for each region to be analyzed. Based on the edges of healthy skulls and the initial seed points in each region to be analyzed, region growth is performed in each region to obtain the skull defect regions in each region to be analyzed. The edges of healthy skulls in each region to be analyzed serve as the growth stopping condition for region growth.
[0027] The embodiments of the present invention have at least the following beneficial effects: This application acquires skull CT images and preprocesses them to obtain images to be analyzed, and then uses skull CT images of healthy individuals; then, windows are constructed with each pixel as the center; the difference evaluation index between the two windows in the image to be analyzed is obtained based on the similarity of pixels in a window in the image to be analyzed and a window in the template image that is in the same position as the window; further, skeleton pixels in the template image are extracted and linearly fitted to obtain skeleton lines, and then the corresponding pixels of a pixel in the template image on the skeleton line are obtained; tangents to the skeleton lines are drawn through the corresponding pixels of each pixel, and the angles between each tangent and the horizontal direction are used as the angles between each pixel in the image to be analyzed and the pixels in the template image that are in the same position; the neighborhood windows of each window in the image to be analyzed are obtained based on the angles between each pixel in the image to be analyzed; the difference evaluation index between a window in the image to be analyzed, its neighborhood windows, and the window in the template image that is in the same position is used to determine whether the window is an initial abnormal window, and the traditional template matching algorithm is optimized by combining the growth and extension direction of the skull, thereby accurately locating the initial abnormal window located in the skull;
[0028] Finally, based on the grayscale difference of pixels within an initial abnormal window and a window in the same position in the template image, it is determined whether the initial abnormal window is a suspected skull defect window. Then, based on the grayscale changes of pixels within the suspected skull defect window, it is determined whether the suspected skull defect window is an abnormal window. By analyzing the abnormality of pixels within the window, the actual window containing the skull defect is further identified. Subsequently, the image to be analyzed is segmented based on the abnormal window to obtain the skull defect region, providing a reliable reference for the final defect segmentation and improving the accuracy of skull defect region segmentation in skull CT images. Attached Figure Description
[0029] To more clearly illustrate the technical solutions and advantages 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, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 A flowchart illustrating an intelligent segmentation method for skull defect regions based on medical images, provided in an embodiment of the present invention;
[0031] Figure 2 A first schematic diagram of a neighborhood window for an intelligent segmentation method for skull defect regions based on medical images provided in an embodiment of the present invention;
[0032] Figure 3 This is a second schematic diagram of a neighborhood window for an intelligent segmentation method for skull defect regions based on medical images, provided in an embodiment of the present invention. Detailed Implementation
[0033] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of an intelligent segmentation method for cranial defect regions based on medical images proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0034] 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.
[0035] The following description, in conjunction with the accompanying drawings, details a specific scheme for an intelligent segmentation method for skull defect regions based on medical images provided by this invention.
[0036] Example: The main application scenario of this invention is as follows: This application optimizes the traditional template matching algorithm by combining the growth extension direction of the skull, thereby accurately locating the abnormal area in the skull, and further extracting the suspected skull defect area and distinguishing between the real skull with osteoporosis and the real skull defect, so as to provide a reliable reference for the final defect segmentation and localization.
[0037] Please see Figure 1 The diagram illustrates a flowchart of an intelligent segmentation method for skull defect regions based on medical images, provided by an embodiment of the present invention. The method includes the following steps:
[0038] Step S1: Acquire skull CT images and preprocess them to obtain the images to be analyzed; obtain template images using skull CT images of each healthy individual.
[0039] First, CT images of the patient's skull were acquired using a standard clinical CT scanner, covering the entire skull region from the top to the base, ensuring complete inclusion of any potential defects. Next, the acquired skull CT images underwent preprocessing to obtain the images to be analyzed. Preprocessing included filtering for noise reduction and geometric correction.
[0040] Specifically, median filtering is used to denoise the original skull CT images, effectively suppressing image noise while preserving the sharp edges of the skull structures. Median filtering effectively suppresses salt-and-pepper noise and random noise, while maintaining the sharpness of the skull edges, preventing noise from being misidentified as abnormal areas during template matching and improving segmentation robustness. During geometric correction, based on equipment calibration parameters, geometric distortions and scan offsets of the images are corrected to ensure the spatial accuracy of the skull anatomical structures and avoid segmentation errors caused by distortion. Geometric correction eliminates equipment-related spatial distortions, ensuring precise anatomical alignment between the patient image and the healthy template, reducing segmentation deviations caused by registration errors, and laying the foundation for template matching.
[0041] Finally, it is necessary to obtain skull CT images of healthy individuals to generate template images for reference. Specifically, skull CT images of each healthy individual (typically around 20 to 30 people) are obtained. Rigid registration and pixel-level averaging are then performed on each individual's skull CT images to generate a representative average healthy skull template. This template image captures the typical features of a healthy skull (healthy skull boundaries are typically smooth, continuous, and have specific anatomical morphology) and effectively reduces the influence of individual random variations.
[0042] Step S2: Construct a window centered on each pixel; obtain the difference evaluation index between the two windows in the image to be analyzed based on the similarity of pixels in a window in the image to be analyzed and a window in the template image that is in the same position as the window.
[0043] Traditional template matching methods can identify abnormal areas of the skull, but they struggle to effectively distinguish between inward-concave bone defects and outward-bulging abnormal growths—two structural lesions. To address this issue, this application establishes a mechanism for locating suspected defect areas based on anatomical features; therefore, the basic template matching method must first be designed.
[0044] Specifically, a window is constructed centered on each pixel, with the window size set to N×N. The choice of N typically needs to balance computational efficiency and detail capture capability (too small a window may lose global features, while too large a window may reduce local sensitivity). This scheme provides a reference value of N=7, aiming to balance computational efficiency and coverage density. In practical applications, it should be fine-tuned according to the resolution of the CT image and the scene. Setting N to an odd number ensures that the coordinates of its center point can be effectively obtained, facilitating accurate positioning.
[0045] This allows us to identify windows in the same position in both the image to be analyzed and the template image, enabling further analysis. A rigid registration algorithm is used to precisely align the patient's image to the spatial coordinate system of the template image.
[0046] Then, based on the similarity of pixels in a window of the image to be analyzed and a window in the template image that is in the same position as the window, the difference evaluation index between the two windows in the image to be analyzed is obtained.
[0047] Specifically, the gray levels are quantized into B bins, and the gray level distribution of pixels within a window of the image to be analyzed is statistically analyzed to obtain the gray level histogram of that window. Based on the frequency of pixel occurrence at each gray level in the gray level histogram of the window in the image to be analyzed and the gray level histogram of a window in the template image at the same position as the window in the template image, the Bartlett distance between the two gray level histograms is calculated and used as an evaluation index for the difference between the two windows. The first preset value is 1; preferably, in this application, the value of B is 16.
[0048] Here, the Bartlett distance between the two gray-level histograms is calculated by measuring the frequency of pixel occurrences at each gray level. This distance measures the similarity between the two windows. A larger Bartlett distance (difference evaluation index) indicates a greater distance between the density distribution of the window in the analyzed image and the template, resulting in lower similarity and a better match to the characteristics of abnormal skull regions. Conversely, a smaller value indicates a closer distance between the density distribution of the window in the analyzed image and the template, resulting in higher similarity and a better match to the characteristics of healthy skull regions. Using Bartlett distance effectively captures differences in gray-level distribution, avoiding reliance on a single gray-level value and improving sensitivity to density changes.
[0049] This allows us to obtain a difference evaluation index for any two windows at the same location in the image to be analyzed and the template image.
[0050] Step S3: Extract skeleton pixels from the template image and perform linear fitting to obtain skeleton lines; obtain the pixel on the skeleton line corresponding to the minimum distance between a pixel in the template image and each pixel on each skeleton line as the corresponding pixel of that pixel; draw tangents to the skeleton lines through the corresponding pixels of each pixel, and take the angle between each tangent and the horizontal direction as the angle between each pixel in the image to be analyzed and the pixel in the same position in the template image.
[0051] The above steps obtain the difference evaluation index of any two windows with the same position in the image to be analyzed and the template image. However, this only considers simple template matching and does not take into account the actual growth direction of the skull. Therefore, it is necessary to combine the neighborhood similarity analysis of the actual growth direction of the skull to initially identify the abnormal areas of the skull.
[0052] Therefore, in the template image, the Zhang-Suen skeleton extraction algorithm is used to obtain the skeleton pixels of all the skull skeletons. Linear fitting is then performed on all the skeleton pixels in the template image to obtain multiple fitting curves. Each fitting curve serves as a skeleton line. The acquisition of the skeleton lines is a current technique and will not be elaborated upon here. This allows the extraction of all skeleton lines in the template image.
[0053] Next, the skeleton line closest to each pixel needs to be found in the template image. This skeleton line represents the direction of skull growth for each pixel. Specifically, for a pixel in the template image, the distance between that pixel and each pixel on each skeleton line is obtained. The pixel on the skeleton line with the smallest distance is taken as the corresponding pixel of that pixel. Furthermore, a tangent line is drawn to the skeleton line containing that pixel through its corresponding pixel. The angle between the tangent line and the horizontal direction is the angle corresponding to that pixel. Thus, the angles corresponding to each pixel in the template image can be obtained.
[0054] Next, the angles corresponding to each pixel in the template image are used as the angles between the pixels in the image to be analyzed that are at the same position as those in the template image. These angles can represent the theoretical growth direction of the skull at each pixel position.
[0055] Step S4: Obtain the neighboring windows of each window in the image to be analyzed based on the included angle of each pixel in the image to be analyzed; determine whether a window is an initial abnormal window based on the difference evaluation index between a window in the image to be analyzed, its neighboring windows, and windows in the same position in the template image.
[0056] The above steps obtain the included angle of each pixel in the image to be analyzed, and then obtain the neighborhood window of each window in the image to be analyzed based on the included angle of each pixel.
[0057] Specifically, for a window in the image to be analyzed, half the difference between the window size and a first preset value is used as the basic neighborhood pixel step size; the x-coordinate and y-coordinate of the pixel located at the center of a window in the image to be analyzed are recorded as the x-coordinate and y-coordinate of the center point, respectively; the sine and cosine values of the angle between the pixel located at the center of the window are recorded as the sine and cosine values of the center point, respectively; when the angle between the pixel located at the center of the window is greater than or equal to 90 degrees, the x-coordinate of the center point is subtracted from the basic neighborhood pixel step size and the center point... The product of the cosine values yields the x-coordinate of the left neighborhood. The y-coordinate of the left neighborhood is obtained by adding the product of the basic neighborhood pixel step size and the sine value of the center point to the y-coordinate of the center point. The x-coordinate of the left neighborhood and the y-coordinate of the left neighborhood together form the center point of the left neighborhood window. The x-coordinate of the right neighborhood is obtained by adding the product of the basic neighborhood pixel step size and the cosine value of the center point to the x-coordinate of the center point. The y-coordinate of the right neighborhood is obtained by subtracting the product of the basic neighborhood pixel step size and the sine value of the center point from the y-coordinate of the center point. The x-coordinate of the right neighborhood and the y-coordinate of the right neighborhood together form the center point of the right neighborhood window.
[0058] When the angle between the center pixel in the window is less than 90 degrees, the left neighborhood x-coordinate is obtained by subtracting the product of the basic neighborhood pixel step size and the center point cosine value from the center point x-coordinate. The left neighborhood y-coordinate is obtained by subtracting the product of the basic neighborhood pixel step size and the center point sine value from the center point y-coordinate. The left neighborhood x-coordinate and the left neighborhood y-coordinate together form the center point of the left neighborhood window. The right neighborhood x-coordinate is obtained by adding the product of the basic neighborhood pixel step size and the center point cosine value to the center point x-coordinate. The right neighborhood y-coordinate is obtained by adding the product of the basic neighborhood pixel step size and the center point sine value to the center point y-coordinate. The right neighborhood x-coordinate and the right neighborhood y-coordinate together form the center point of the right neighborhood window.
[0059] The left and right neighboring windows are the neighboring windows of this window, and they are the same size as this window.
[0060] For example, if the x-coordinate and y-coordinate of the center pixel in a window of an image to be analyzed are x and y respectively, and the included angle is θ, then when the included angle is greater than or equal to 90 degrees, the coordinates of the center point of the left neighboring window are (xk·cosθ, y+k·sinθ), and the coordinates of the center point of the right neighboring window are (x+k·cosθ, yk·sinθ). Figure 2As shown in the figure, 1 is the tangent line, 2 is a window in the image to be analyzed, and 3 and 4 are the right and left neighboring windows of this window, respectively. When the included angle is less than 90 degrees, the coordinates of the center point of the left neighboring window are (xk·cosθ, yk·sinθ), and the coordinates of the center point of the right neighboring window are (x+k·cosθ, y+k·sinθ). Figure 3 As shown in the figure, 5 is the tangent line, 6 is a window in the image to be analyzed, and 7 and 8 are the left and right neighboring windows of the window, respectively.
[0061] sinθ and cosθ are the sine and cosine values of the center point, respectively. k is the basic neighborhood pixel step size, k=(N-1) / 2, ensuring that the neighborhood and the current window are continuous in anatomical space, avoiding interference from irrelevant regions, and focusing on detecting the skull extension path. The coordinates of the center points of the left and right neighborhood windows are obtained using the included angle, aiming to overcome the orientation deviation caused by the skeleton pixels deviating from the fitted curve, thereby ensuring that the neighborhood windows are distributed along the skull anatomical student length path. From this, the neighborhood windows (left and right neighborhood windows) of each window in the window to be analyzed can be obtained.
[0062] Next, based on the difference evaluation index between a window in the image to be analyzed, its neighboring windows, and windows in the same position in the template image, it is determined whether the window is an initial abnormal window.
[0063] Specifically, the difference evaluation indexes of the left and right neighboring windows of a window in the image to be analyzed are obtained from the windows at the same position in the template image. The average difference evaluation index of the left and right neighboring windows is calculated to obtain the neighborhood average difference evaluation index. The difference evaluation index of the window and the windows at the same position in the template image is multiplied by the neighborhood average difference evaluation index and normalized to obtain the local matching score of the window.
[0064] The product of the difference evaluation index corresponding to a window in the image to be analyzed and the average difference evaluation index of its neighborhood was calculated, forming a spatial contextual AND logic. That is, only when the window and its neighborhood regions show low similarity will a very low score be obtained, highlighting the abnormal region. By combining neighborhood information, the robustness of anomaly detection is significantly enhanced, the sensitivity to isolated noise is reduced, and the accuracy of identifying real abnormal regions is improved.
[0065] Finally, a first discrimination threshold is set. When the local matching score of a window in the image to be analyzed is greater than the first discrimination threshold, the window is considered an initial abnormal window. When the local matching score of the window is less than or equal to the first discrimination threshold, the window is considered a healthy skull window. The reference value for the first discrimination threshold is 0.7. Setting a higher threshold aims to prioritize specificity, that is, to minimize the misclassification of healthy tissue as abnormal. Implementers can adjust the first discrimination threshold according to actual clinical application.
[0066] This allows us to obtain the initial anomaly window in the image to be analyzed.
[0067] Step S5: Determine whether the initial abnormal window is a suspected skull defect window based on the grayscale difference of pixels within the window at the same position in the template image; determine whether the suspected skull defect window is an abnormal window based on the grayscale changes of pixels within the suspected skull defect window; segment the image to be analyzed based on the abnormal window to obtain the skull defect region.
[0068] After obtaining the selected initial abnormal windows, an adaptive segmentation method based on grayscale distribution characteristics is used to extract bone pixels. Since the grayscale distribution within a single analysis window naturally exhibits a bimodal distribution characteristic between bone and background soft tissue, the OTU adaptive threshold segmentation algorithm can process the pixels within the initial abnormal window and the windows in the template image at the same location. Furthermore, based on the grayscale difference between the pixels within an initial abnormal window and the windows at the same location in the template image, it is determined whether the initial abnormal window is a suspected skull defect window.
[0069] Specifically, the OTU adaptive thresholding algorithm is used to automatically determine the optimal segmentation threshold by maximizing the inter-class variance. Pixels within an initial anomaly window are divided into two categories: foreground pixels and background pixels. Similarly, foreground and background pixels in windows at the same location as the initial anomaly window in the template image are obtained. The pixel difference of the initial anomaly window is obtained by subtracting the number of foreground pixels in the initial anomaly window from the number of foreground pixels in windows at the same location in the template image and then normalizing the result. Pixels with high grayscale values (like those of skeletons) within the window are marked as foreground, while pixels with low grayscale values (like those of non-skeletons) are marked as background.
[0070] The specific calculation model for pixel differences is as follows:
[0071] ,
[0072] Where F represents the pixel difference of an initial abnormal window. This represents the number of foreground pixels within the window that is at the same position as the initial abnormal window in the template image. F represents the number of foreground pixels within the initial abnormality window. F is the core indicator quantifying the difference in the number of foreground pixels between the initial abnormality window and the healthy skull template. Its core function is to accurately distinguish between two core types of skull abnormalities—inward-concave skull defects and outward-bulging abnormalities—by comparing the number of foreground pixels, providing an objective basis for subsequent screening of suspected defects. When F approaches 1, it indicates that the number of foreground pixels within the initial abnormality window is significantly less than that of the healthy template. This phenomenon corresponds to the anatomical feature of inward-concave skull defects. Due to the absence of bone structure, the defect area lacks complete skull tissue within its boundary, containing only soft tissue or cavities, resulting in a significantly reduced number of foreground pixels, consistent with the core morphology of skull defects. When F approaches 0, it indicates that the number of foreground pixels within the initial abnormality window is greater than that of the healthy template. This phenomenon corresponds to the anatomical feature of outward-bulging skull defects, such as encephalocele and osteophyte formation, which cause local tissue to extend beyond the healthy skull boundary, increasing the number of pixels, completely opposite to the morphological characteristics of defects.
[0073] Therefore, a second discrimination threshold is set. When the pixel difference of an initial abnormal window is greater than the second discrimination threshold, the initial abnormal window is considered a suspected skull defect window; when the pixel difference of an initial abnormal window is less than or equal to the second discrimination threshold, the initial abnormal window is considered another skull abnormality window. This scheme provides a reference value of 0.5 for the second discrimination threshold, using the median value as the initial threshold, reflecting a balancing strategy. In practical applications, it can be fine-tuned according to actual clinical needs. This allows for the identification of suspected skull defect windows.
[0074] After obtaining a suspected skull defect window, traditional methods struggle to distinguish between true structural defects and osteoporotic regions that only show reduced density. A grayscale change index, which integrates grayscale distribution and edge gradient features, is needed. This index leverages the uniform density and smooth edges of osteoporotic regions to create a stark contrast with the uneven density and sharp edges of true defects, thus enabling accurate differentiation between the two.
[0075] The determination of whether a suspected skull defect window is an abnormal window is based on the grayscale changes of pixels within that window. Specifically, the coefficient of variation of the grayscale values of each pixel within the suspected skull defect window is obtained and normalized to obtain the first grayscale feature; the average gradient magnitude of each pixel within the suspected skull defect window is obtained and normalized to obtain the second grayscale feature; the first and second grayscale features are weighted and summed to obtain the grayscale change index of the suspected skull defect window.
[0076] The specific calculation model for the grayscale change index is as follows:
[0077] ,
[0078] in, The grayscale change index for a suspected skull defect window; and These represent the mean and standard deviation of the grayscale values of each pixel within the suspected skull defect window, respectively. The ratio of these two values is the coefficient of variation of the grayscale values within the suspected skull defect window. In osteoporotic areas, due to reduced trabecular bone but preserved structure, the grayscale value distribution is relatively uniform, and the coefficient of variation is small. In areas with actual defects, due to bone loss, soft tissue or air is often exposed, resulting in a sharp drop in grayscale values and uneven distribution, leading to a larger coefficient of variation. The first grayscale feature is considered; however, in actual CT images, the defect area may have uniform grayscale due to filling material (such as blood or tissue), while the osteoporotic area still exhibits a higher coefficient of variation in grayscale values due to uneven bone density. Therefore, the coefficient of variation needs to be combined with gradient information for comprehensive judgment. This represents the gradient magnitude of the i-th pixel within the suspected skull defect window, referring to the gradient magnitude of the grayscale value, which can be calculated using the Sobel operator. The average gradient magnitude quantifies the sharpness of the edges. The boundary between the actual defect and healthy bone tissue is clearly defined, resulting in a higher average gradient value. In contrast, osteoporotic areas show slower density changes and a lower average gradient value. This is the second grayscale feature;
[0079] α is a weighting parameter used to balance the contribution of gray-level distribution features and gradient change features. This application provides a reference value of α=0.5, which can be adjusted according to the data distribution in practical applications. The gray-level change index integrates gray-level distribution features and gradient change features: when the gray-level change index approaches 1, it indicates that the suspected skull defect window has both uneven gray-level distribution and relatively sharp edges, and the confidence level of the actual skull defect is high; when the gray-level change index approaches 0, it indicates that the suspected skull defect window has both uniform gray-level distribution and relatively smooth edges, and the confidence level of the actual skull defect is low, which is more consistent with the interference features of osteoporosis.
[0080] A third discrimination threshold is set. When the grayscale change index of the suspected skull defect window is greater than the third discrimination threshold, the suspected skull defect window is an abnormal window, that is, a window of real skull defect. When the grayscale change index of the suspected skull defect window is less than or equal to the third discrimination threshold, the suspected skull defect window is judged as a healthy skull window with osteoporosis. The reference value of the third discrimination threshold set in this application is 0.7. Setting a higher threshold ensures high confidence, strictly screens real defects, and reduces misjudgment of osteoporosis. In practical applications, it can be fine-tuned according to specific requirements.
[0081] This yields all the abnormal windows (the windows of the actual skull defects) in the image to be analyzed. The region growing algorithm is then performed within the area covered by all the abnormal windows to segment out the skull defect region.
[0082] Specifically, the regions covered by each abnormal window in the image to be analyzed are denoted as the regions to be analyzed; regions in the template image that are in the same position as the regions to be analyzed in the image to be analyzed are denoted as template regions; edge detection is performed on the template regions to obtain the edges of healthy skulls; the edges of healthy skulls in each template region are mapped to the regions to be analyzed that are in the same position as the template regions to obtain the edges of healthy skulls in each region to be analyzed; the pixels with the smallest gray values in the edges of healthy skulls in each template region are mapped to the regions to be analyzed that are in the same position as the template regions to be analyzed, serving as the initial seed points for each region to be analyzed; based on the edges of healthy skulls in each region to be analyzed and the initial seed points, region growth is performed in each region to be analyzed to obtain the skull defect regions in each region to be analyzed, and the edges of healthy skulls in each region to be analyzed serve as the growth stopping condition for region growth.
[0083] It's also important to note that the core growth criterion for region growing is the grayscale similarity between pixels. Post-growing operations are then performed on the results to conduct morphological operations, including boundary smoothing and cavity filling, thus optimizing the morphological representation of the skull defect area. Based on this, quantitative indicators such as the area, location, and perimeter of the skull defect area are calculated to provide data support for clinical assessment of defect severity and personalized implant design. Finally, the optimized skull defect area is saved as a binary image mask, which can be used for subsequent 3D reconstruction and surgical planning.
[0084] In summary, this application optimizes the traditional template matching algorithm by combining the growth and extension direction of the skull, thereby accurately locating the initial abnormal window in the skull. Then, it further extracts suspected skull defect windows and distinguishes between osteoporotic real skulls and real skull defects, providing a reliable reference for the final defect segmentation and localization.
[0085] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. Additionally, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0086] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0087] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for intelligent segmentation of skull defect region based on medical images, characterized in that, The method comprises: Collecting a skull CT image and preprocessing to obtain an image to be analyzed; using the skull CT image of each person in a healthy population to obtain a template image; Respectively constructing a window centered on each pixel point; obtaining a difference evaluation index of two windows in the image to be analyzed according to the pixel points in one window of the image to be analyzed and the window in the template image with the same position as the window, including: quantizing the gray level into B bins, and counting the gray distribution of the pixel points in the window of the image to be analyzed to obtain the gray histogram of the window; calculating the Bhattacharyya distance of the gray histograms of the two windows according to the frequency of the pixel points of each gray level in the gray histogram of one window of the image to be analyzed and the gray histogram of the window in the template image with the same position as the window, as the difference evaluation index of the two windows; Extracting the skeleton pixel points in the template image and performing linear fitting to obtain a skeleton line; obtaining the pixel point on the skeleton line corresponding to the minimum value of the distance between each pixel point in the template image and each pixel point on the skeleton line as the corresponding pixel point of the pixel point; making a tangent of the skeleton line through the corresponding pixel point of each pixel point, and taking the included angle between each tangent and the horizontal direction as the included angle of each pixel point in the image to be analyzed with the same position as the template image; According to the included angle of each pixel point in the image to be analyzed, respectively obtaining the neighborhood window of each window of the image to be analyzed; judging whether one window of the image to be analyzed, the neighborhood window of the window and the window in the template image with the same position are initial abnormal windows according to the difference evaluation index of the three windows; According to the gray difference of the pixel points in one initial abnormal window and the window in the template image with the same position, judging whether the initial abnormal window is a suspected skull defect window; according to the gray change of the pixel points in the suspected skull defect window, judging whether the suspected skull defect window is an abnormal window; segmenting the image to be analyzed according to the abnormal window to obtain a skull defect region. 2.The skull defect region intelligent segmentation method based on medical images according to claim 1, characterized in that, The method comprises: For a window in the image to be analyzed, a half of a difference value between a size of the window and a first preset value is obtained as a basic neighborhood pixel step; a horizontal coordinate and a vertical coordinate of a pixel point at a center of the window in the image to be analyzed are recorded as a center point horizontal coordinate and a center point vertical coordinate respectively; a sine value and a cosine value of an angle of the pixel point at the center of the window are recorded as a center point sine value and a center point cosine value respectively; when the angle of the pixel point at the center of the window is greater than or equal to 90 degrees, a left side neighborhood horizontal coordinate is obtained by subtracting a product of the basic neighborhood pixel step and the center point cosine value from the center point horizontal coordinate, a left side neighborhood vertical coordinate is obtained by adding a product of the basic neighborhood pixel step and the center point sine value to the center point vertical coordinate, and the left side neighborhood horizontal coordinate and the left side neighborhood vertical coordinate form a center point of a left side neighborhood window; a right side neighborhood horizontal coordinate is obtained by adding a product of the basic neighborhood pixel step and the center point cosine value to the center point horizontal coordinate, a right side neighborhood vertical coordinate is obtained by subtracting a product of the basic neighborhood pixel step and the center point sine value from the center point vertical coordinate, and the right side neighborhood horizontal coordinate and the right side neighborhood vertical coordinate form a center point of a right side neighborhood window; When the angle of the pixel point at the center of the window is less than 90 degrees, a left side neighborhood horizontal coordinate is obtained by subtracting a product of the basic neighborhood pixel step and the center point cosine value from the center point horizontal coordinate, a left side neighborhood vertical coordinate is obtained by subtracting a product of the basic neighborhood pixel step and the center point sine value from the center point vertical coordinate, and the left side neighborhood horizontal coordinate and the left side neighborhood vertical coordinate form a center point of a left side neighborhood window; a right side neighborhood horizontal coordinate is obtained by adding a product of the basic neighborhood pixel step and the center point cosine value to the center point horizontal coordinate, a right side neighborhood vertical coordinate is obtained by adding a product of the basic neighborhood pixel step and the center point sine value to the center point vertical coordinate, and the right side neighborhood horizontal coordinate and the right side neighborhood vertical coordinate form a center point of a right side neighborhood window; The left side neighborhood window and the right side neighborhood window are neighborhood windows of the window and have the same size as the window. 3.The skull defect region intelligent segmentation method based on medical images according to claim 1, characterized in that, The method for determining whether the window is an initial abnormal window according to a difference evaluation index of the window in the image to be analyzed, a window at a same position in the template image and a window at a same position in the template image, comprises: A difference evaluation index of the window in the image to be analyzed, a window at a same position in the template image and a window at a same position in the template image is obtained, and a mean value of the difference evaluation indexes corresponding to the left side neighborhood window and the right side neighborhood window is obtained as a neighborhood average difference evaluation index; a local matching score of the window is obtained by multiplying the difference evaluation index of the window at the same position in the template image by the neighborhood average difference evaluation index and normalizing; When the local matching score of the window is greater than a first discrimination threshold, the window is an initial abnormal window. 4.The skull defect region intelligent segmentation method based on medical images according to claim 1, characterized in that, The method for determining whether the initial abnormal window is a suspected skull defect window according to a gray scale difference of pixel points in the initial abnormal window and a window at a same position in the template image, comprises: The OSTU adaptive threshold segmentation algorithm is used to automatically determine the optimal segmentation threshold by maximizing the inter-class variance, and the pixel points in an initial abnormal window are divided into two categories, i.e. foreground pixel points and background pixel points. Similarly, the foreground pixel points and background pixel points in the window in the template image with the same position as the initial abnormal window are obtained. The pixel difference of the initial abnormal window is obtained by subtracting the number of foreground pixel points in the initial abnormal window from the number of foreground pixel points in the window in the template image with the same position as the initial abnormal window and normalizing. When the pixel difference of an initial abnormal window is greater than a second discrimination threshold, the initial abnormal window is a suspected skull defect window.
5. The intelligent skull defect region segmentation method based on medical images according to claim 1, characterized in that, The method for determining whether the suspected skull defect window is an abnormal window according to the grayscale variation of the pixel points in the suspected skull defect window comprises: a coefficient of variation of the grayscale values of the pixel points in a suspected skull defect window is obtained and normalized to obtain a first grayscale feature; an average value of the gradient amplitudes of the pixel points in the suspected skull defect window is obtained and normalized to obtain a second grayscale feature; and the first grayscale feature and the second grayscale feature are weighted and summed to obtain a grayscale variation index of the suspected skull defect window. When the grayscale variation index of the suspected skull defect window is greater than a third discrimination threshold, the suspected skull defect window is an abnormal window. 6.The skull defect region intelligent segmentation method based on medical images according to claim 1, characterized in that, The method for obtaining the skull defect region by segmenting the image to be analyzed according to the abnormal window comprises: regions covered by the abnormal windows in the image to be analyzed are recorded as analysis regions; regions in the template image with the same positions as the analysis regions in the image to be analyzed are obtained and recorded as template regions; edge detection is performed on the template regions to obtain healthy skull edges; the healthy skull edges in the template regions are respectively mapped to the analysis regions with the same positions as the template regions to obtain the healthy skull edges in the analysis regions; the pixel points with the smallest grayscale values in the healthy skull edges in the template regions are respectively mapped to the analysis regions with the same positions as the template regions as initial seed points of the analysis regions; and region growing is performed in the analysis regions based on the healthy skull edges and the initial seed points in the analysis regions to obtain skull defect regions in the analysis regions, and the healthy skull edges in the analysis regions are used as the growth stop conditions of the region growing.
Citation Information
Patent Citations
Intracranial hematoma region segmentation method based on CT image
CN116485814A
Method, device, equipment, product and storage medium for identifying skull defect by constructing characteristic spectrum through nuclear magnetic image
CN120953270A