Image processing method and system for dual-energy X-ray bone densitometer
Through technical means such as light and dark field correction, data fitting and image preprocessing, the image noise and artifact problems of dual-energy X-ray bone density meter are solved, and the accuracy and reliability of bone density measurement are improved, supporting the accurate diagnosis of osteoporosis.
Patent Information
- Application Number
- CN202510854480.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-25
AI Technical Summary
The existing dual-energy X-ray bone density meter has projection area measurement errors, tissue background deduction errors, image noise and artifact interference in image processing, resulting in insufficient bone density measurement accuracy and affecting the diagnostic effect.
The edge detection is performed using light and dark field correction, aluminum sheet and glass simulation data fitting, image preprocessing, region growth algorithm and Canny operator, combined with ROI extraction and index calculation, and the image processing flow is optimized.
Improve image quality, accurately extract ROI, enhance the accuracy and reliability of bone density measurement, and provide a more accurate basis for the diagnosis of osteoporosis.
Smart Images

Figure CN120374465B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical imaging technology, and in particular to an image processing method and system for a dual-energy X-ray bone densitometer. Background Art
[0002] Dual-energy X-ray absorptiometry (DXA) is a key device widely used in the diagnosis of osteoporosis and fracture risk assessment. It measures bone mineral content and calculates bone mineral density (BMD) by emitting high- and low-energy X-ray beams. However, existing DXA technologies still suffer from image processing issues, such as errors in projected area measurement, tissue background subtraction errors, image noise, and artifacts. These issues affect the accuracy and reliability of BMD measurements.
[0003] While existing methods exist to correct for detector non-uniformity and tube intensity variations, these methods are often imprecise and unable to completely eliminate the effects of noise and artifacts. Furthermore, existing technologies have limitations when extracting regions of interest (ROIs) and calculating bone density values. For example, inaccurate ROI boundary extraction leads to inaccurate calculated bone density and bone mineral content. These issues limit the effectiveness of dual-energy X-ray absorptiometry in clinical diagnosis.
[0004] While some existing methods attempt to improve image quality through image preprocessing, segmentation, and edge detection, these approaches often lack systematicity and integrity. For example, existing image preprocessing methods may not effectively remove noise, while existing image segmentation and edge detection methods may not accurately extract the boundaries of the ROI. Furthermore, existing technologies lack precise calibration and optimization methods for calculating bone density and bone mineral content, resulting in unreliable measurement results.
[0005] Therefore, the present invention proposes an image processing method and system for a dual-energy X-ray bone densitometer, which solves the problems existing in the prior art by optimizing the image processing process and improves the accuracy and reliability of bone density measurement. Summary of the Invention
[0006] The purpose of the present invention is to solve the problems of projection area measurement error, tissue background subtraction error, image noise and artifact interference, and insufficient bone density measurement accuracy in the prior art, and to propose an image processing method and system for dual-energy X-ray bone densitometer.
[0007] In order to achieve the above object, the present invention adopts the following technical solution: an image processing method of a dual-energy X-ray bone densitometer, comprising the following steps:
[0008] Step S1, collecting dual-energy X-ray images, including bright field data and dark field data, and performing bright field and dark field correction on the original projection data;
[0009] Step S2, based on the corrected projection data, using aluminum sheets to simulate bones and glass sheets to simulate tissues, performing data fitting to obtain bone density values and fitting the bone-to-aluminum conversion coefficient;
[0010] Step S3, preprocessing the image, including Gaussian smoothing filtering, threshold processing and corrosion operation;
[0011] Step S4, using the region growing algorithm to segment the image and using the Canny operator to perform edge detection;
[0012] Step S5, extracting the region of interest (ROI), and determining the boundary of the ROI by searching for coordinates that meet a preset threshold condition within a preset ratio range in the vertical direction of the image;
[0013] Step S6: Calculate the area of the ROI, the bone density value BMD, and the bone mineral content.
[0014] Furthermore, in step S1, the following sub-steps are also included:
[0015] S1-1, without placing any material on the stage, the tube is exposed, and an empty data is collected as bright field data, which is used to correct the non-uniformity of the detector and the intensity variation of the tube;
[0016] S1-2: No material is placed on the stage, the tube is closed, and empty data is collected as dark field data. The dark field data is used to correct the electronic noise and environmental noise of the detector;
[0017] S1-3, perform bright field and dark field correction on the collected original projection data to obtain the corrected projection data. The correction formula is:
[0018] ;
[0019] in, is the corrected projection data, is the original projection data, is the dark field data, The data are bright field data.
[0020] Furthermore, in step S2, the following sub-steps are also included:
[0021] S2-1: Using aluminum sheets to simulate bones and glass to simulate tissues, based on the corrected projection data, images of aluminum sheets and glass of different thicknesses were collected to obtain bone density values. The thickness of the aluminum sheets ranged from 0.1 mm to 10 mm in 0.1 mm increments, and the thickness of the glass ranged from 0.1 mm to 5 mm in 0.1 mm increments.
[0022] S2-2, based on the relationship between aluminum sheet thickness and bone density, the bone-to-aluminum conversion coefficient was fitted using the least squares method;
[0023] S2-3, selecting a rectangular area of a fixed size in the acquired image, calculating the average value of all pixel values within the rectangular area as the average value of the ROI of the corrected projection data, and recording the average value of the ROI and the thickness of the aluminum sheet; the rectangular area covers the center portion of the aluminum sheet or glass;
[0024] S2-4, multiply the thickness of the aluminum sheet by the bone-aluminum conversion coefficient to obtain the corresponding bone density value, and perform polynomial fitting on the relationship between the density value and the high and low energy values to obtain the fitting parameters. The polynomial fitting formula is:
[0025] ;
[0026] Among them, y is the bone density value, x is the high and low energy value, , , ,..., is the fitting parameter, and n is the fitting order.
[0027] Furthermore, in step S3, the following sub-steps are also included:
[0028] S3-1, perform Gaussian smoothing filtering on the high-energy image, generate a Gaussian kernel of size 3x3, set the sigma value of the Gaussian kernel to 1.0, traverse each pixel in the image, perform convolution operation with the Gaussian kernel, calculate the weighted average of the pixel and its neighborhood, and smooth the image;
[0029] S3-2, threshold processing is performed on the image to calculate the maximum value of all pixel values in the image, and the threshold is set to 4% of the maximum value of the image. Each pixel in the image is traversed. If the pixel value of the pixel point is less than the threshold, the pixel value of the pixel point is set to 0; otherwise, the pixel value of the pixel point remains unchanged;
[0030] S3-3, perform an erosion operation on the image, set a 3x3 all-1 matrix as the structural element, traverse each pixel in the image, and calculate the minimum value in its neighborhood for each pixel. If the pixel is less than the minimum value, set the pixel to 0, otherwise, the pixel remains unchanged.
[0031] Furthermore, in step S4, the following sub-steps are also included:
[0032] S4-1, find the second peak and valley of each row in the 40% to 50% area in the vertical direction of the image, and take the average value as the seed point;
[0033] S4-2, set the initial threshold to 40, start from the seed point, check the grayscale value difference of adjacent pixels, if the difference is less than or equal to the initial threshold, add the pixel to the region where the seed point is located and mark it as visited;
[0034] S4-3, taking the newly added pixel as the new seed point, continue to check its adjacent pixels and recursively merge regions until no new pixels meet the conditions;
[0035] S4-4, performing a dilation operation on the segmented image to fill small holes in the image and eliminate gaps between objects;
[0036] S4-5, use the Canny operator to perform edge detection on the processed image, set 8% of the maximum value of each row as the threshold, and find the leftmost and rightmost points greater than the threshold as the outermost contour;
[0037] S4-6, using a gradient operator to calculate the gradient magnitude and direction of the image, and applying non-maximum suppression to retain edge points with local maxima and remove other non-edge points. The gradient operator includes a Sobel operator, a Prewitt operator, and a Roberts operator;
[0038] S4-7, using dual threshold detection, setting a high threshold and a low threshold, starting from a strong edge point, tracing and connecting the edge along the edge direction to form an internal edge contour, the high threshold is used to determine the strong edge point, and the low threshold is used to connect the edge;
[0039] S4-8, merge the outermost contour and the inner edge contour to obtain the final contour.
[0040] Furthermore, in step S5, the following sub-steps are also included:
[0041] S5-1, in the range of 5%-20% in the vertical direction of the image, find the coordinates in each row that are greater than 5% of the maximum value of the row and store them in order;
[0042] S5-2, for each row of coordinates stored sequentially, calculate the difference between adjacent coordinates. If the difference is greater than 5, record the current row as the upper boundary of the ROI;
[0043] S5-3, in the range of 2%-40% in the vertical direction of the image, find the coordinates in each row that are greater than 10% of the maximum value of the row and store them in order;
[0044] S5-4, for each row of coordinates stored sequentially, calculate the difference between adjacent coordinates, record the length of consecutive differences of 1, save the length that is greater than 5% of the horizontal size of the image, and record the leftmost value of the first length and the rightmost value of the second length;
[0045] S5-5, for each row, calculate the difference between the rightmost value and the leftmost value, find the row with the narrowest difference among all rows, and record the current row as the lower boundary of the ROI;
[0046] S5-6, calculate the middle position between the upper boundary and the lower boundary, determine the middle horizontal line, and determine horizontal lines with fixed distances upward and downward from the middle horizontal line as the upper and lower auxiliary boundaries of the ROI;
[0047] S5-7, when calculating the lower boundary, record the row with the smallest difference between the left and right values among all rows, take the average of the left and right values as the vertical position, and determine the vertical boundary from the lower boundary to the bottom of the image;
[0048] S5-8, take the positions 5% away from the left and right sides of the image as the left and right boundaries of the ROI respectively.
[0049] Furthermore, in step S6, the following sub-steps are also included:
[0050] S6-1, combining the physical length and pixel number of the image, calculating the unit pixel size, and multiplying the number of pixels of the ROI by the unit pixel size to obtain the area of the ROI;
[0051] S6-2, calculate the average value of the pixel values in the ROI area, and take a small square area around the ROI as the background area, calculate the average value of the background area, and subtract the average value of the background area from the average value of the ROI to obtain the bone mineral density (BMD) value of the corresponding area;
[0052] S6-3, multiplying the area of the ROI by the bone density value BMD of the corresponding area to obtain the bone mineral content value.
[0053] Furthermore, an image processing system for a dual-energy X-ray bone densitometer includes:
[0054] An image acquisition module, used to acquire dual-energy X-ray images, including bright field data and dark field data;
[0055] A data correction module is used to perform bright and dark field correction on the original projection data;
[0056] The data fitting module is used to fit the relationship between bone density and high and low energy values. By collecting images of aluminum sheets and glass of different thicknesses, the bone density value is obtained and the bone-aluminum conversion coefficient is fitted.
[0057] Image preprocessing module, used to preprocess images, including Gaussian smoothing filtering, threshold processing and corrosion operations;
[0058] Image segmentation module, which uses region growing algorithm to perform image segmentation and extract target area;
[0059] The edge detection module uses the Canny operator to perform edge detection and obtain the outline of the target area;
[0060] ROI extraction module, used to extract the region of interest (ROI) and determine the boundary of the ROI by finding the coordinates that meet the preset threshold conditions within a preset ratio range in the vertical direction of the image;
[0061] The indicator calculation module is used to calculate the area of ROI, bone density value BMD, and bone mineral content.
[0062] The beneficial effects brought about by the technical solution provided by the present invention include at least:
[0063] The present invention is provided with an image acquisition module and a data correction module. By acquiring dual-energy X-ray images and performing bright and dark field correction, it can effectively correct the non-uniformity of the detector and the intensity variation of the tube, as well as the electronic noise and environmental noise of the detector, thereby improving the image quality.
[0064] The present invention is provided with a data fitting module and an image preprocessing module. By performing data fitting, the bone density value is obtained, and the bone-aluminum conversion coefficient is fitted to preprocess the image, which can effectively reduce noise and artifacts in the image and improve the image quality.
[0065] The present invention sets up an image segmentation module and an edge detection module. By adopting a region growing algorithm to segment the image and using the Canny operator for edge detection, it can achieve high-quality image segmentation and edge detection, extract accurate target area contours, and provide accurate boundary information.
[0066] The present invention sets up a ROI extraction module and an index calculation module. By searching for coordinates that meet preset threshold conditions within a preset ratio range in the vertical direction of the image, the boundary of the ROI is determined, and the area, bone density (BMD) and bone mineral content of the ROI are calculated. This can provide accurate bone assessment indicators and provide a more accurate basis for the diagnosis and treatment of osteoporosis. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0068] Figure 1 A flow chart of a method provided by an embodiment of the present invention;
[0069] Figure 2 This is a system architecture diagram provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0070] To further illustrate the technical means and effectiveness of the present invention in achieving its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the image processing method and system for a dual-energy X-ray bone absorptiometry device according to the present invention, including its specific implementation, structure, features, and effectiveness. In the following description, references to "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
[0071] Unless defined otherwise, 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 belongs.
[0072] The following examples are for illustrative purposes only and are not intended to limit the scope of the present invention.
[0073] The following describes in detail the image processing method and system of a dual-energy X-ray bone densitometer provided by the present invention with reference to the accompanying drawings.
[0074] See also Figure 1 , which shows a method flow chart of an image processing method of a dual-energy X-ray bone absorptiometry provided by one embodiment of the present invention, the method comprising the following steps:
[0075] Step S1, collecting dual-energy X-ray images, including bright field data and dark field data, and performing bright field and dark field correction on the original projection data;
[0076] Wherein, step S1 further includes the following sub-steps:
[0077] S1-1, no material is placed on the stage, the tube is exposed, and an empty data is collected as bright field data. The bright field data is used to correct the non-uniformity of the detector and the intensity variation of the tube;
[0078] S1-2, no material is placed on the stage, the tube is closed, and an empty data is collected as dark field data. The dark field data is used to correct the electronic noise and environmental noise of the detector;
[0079] S1-3, perform bright field and dark field correction on the collected original projection data to obtain the corrected projection data. The correction formula is:
[0080] ;
[0081] in, is the corrected projection data, is the original projection data, is the dark field data, The data are bright field data.
[0082] It should be noted that bright field data refers to the data collected when the X-ray tube is normally exposed without any object to be detected. It reflects the response characteristics of the detector under normal working conditions, including the non-uniformity of the detector and the intensity variation of the tube.
[0083] Detector non-uniformity refers to the inconsistent response of the detector at different positions, which will lead to image non-uniformity and affect the accuracy of the measurement results. By collecting bright field data, the detector non-uniformity can be quantified and corrected.
[0084] The intensity of the X-ray tube may vary over time, resulting in image inhomogeneity. Bright field data can reflect the intensity variation of the tube, and this effect can be eliminated through correction.
[0085] Dark field data refers to data collected when no object is placed and the X-ray tube is turned off. It reflects the background noise level of the detector when there is no X-ray irradiation.
[0086] The electronic noise of the detector refers to the electronic noise inside the detector when there is no X-ray irradiation. The noise will interfere with the background of the image and affect the image quality. By collecting dark field data, the electronic noise of the detector can be quantified and corrected.
[0087] Environmental noise includes background radiation and electromagnetic interference, which will interfere with the background of the image and affect the image quality. By collecting dark field data, the environmental noise can be quantified and corrected.
[0088] Bright and dark field correction refers to the correction of the collected original projection data to eliminate the influence of detector non-uniformity, intensity variation of the tube, electronic noise and environmental noise, make the image more uniform, reduce the interference of noise and artifacts, improve the image quality, and thus improve the accuracy and reliability of bone density measurement.
[0089] Step S2, based on the corrected projection data, using aluminum sheets to simulate bones and glass sheets to simulate tissues, performing data fitting to obtain bone density values and fitting the bone-to-aluminum conversion coefficient;
[0090] Wherein, in step S2, the following sub-steps are also included:
[0091] S2-1, using aluminum sheets to simulate bones and glass to simulate tissues, based on the corrected projection data, images of aluminum sheets and glass of different thicknesses were collected to obtain bone density values. The thickness of the aluminum sheets ranged from 0.1 mm to 10 mm with a step size of 0.1 mm, and the thickness of the glass ranged from 0.1 mm to 5 mm with a step size of 0.1 mm;
[0092] S2-2, based on the relationship between aluminum sheet thickness and bone density, the bone-to-aluminum conversion coefficient was fitted using the least squares method;
[0093] S2-3, selecting a rectangular area of a fixed size in the acquired image, calculating the average value of all pixel values within the rectangular area as the mean value of the ROI of the corrected projection data, and recording the mean value of the ROI and the thickness of the aluminum sheet, where the rectangular area covers the center portion of the aluminum sheet or glass;
[0094] S2-4, multiply the thickness of the aluminum sheet by the bone-aluminum conversion coefficient to obtain the corresponding bone density value, and perform polynomial fitting on the relationship between the density value and the high and low energy values to obtain the fitting parameters. The polynomial fitting formula is:
[0095] ;
[0096] Among them, y is the bone density value, x is the high and low energy value, , , ,..., is the fitting parameter, and n is the fitting order.
[0097] It should be noted that aluminum sheets are used to simulate bones and glass to simulate tissues: in a dual-energy X-ray densitometer, bones and soft tissues have different absorption characteristics of X-rays. The X-ray absorption characteristics of aluminum sheets are similar to those of bones, while the X-ray absorption characteristics of glass are similar to those of soft tissues. By using aluminum sheets and glass, the absorption characteristics of bones and soft tissues to X-rays can be simulated, thereby establishing a relationship between image data and bone density values.
[0098] Collect images of aluminum sheets and glass of different thicknesses: By collecting images of aluminum sheets and glass of different thicknesses, bone density values at different thicknesses can be obtained. These data are used to establish the relationship between thickness and bone density values, so that the actual bone density value can be predicted from the image data.
[0099] The thickness range of aluminum sheet from 0.1 mm to 10 mm and the thickness range of glass from 0.1 mm to 5 mm were chosen to cover the thickness range of actual bones and soft tissues, which ensure the applicability of the model.
[0100] The least squares method is a mathematical optimization technique used to find the best function match for a set of data. It finds the best fit between the data and the function by minimizing the sum of squares of the errors. In the present invention, the least squares method is used to fit the linear relationship between the thickness of the aluminum sheet and the bone density value. Through the least squares fitting, a linear relationship between the thickness of the aluminum sheet and the bone density value can be established, so that the bone density value can be predicted by the thickness of the aluminum sheet.
[0101] The bone-to-aluminum conversion coefficient is a proportional factor used to convert the thickness of the aluminum sheet into a bone density value. The bone-to-aluminum conversion coefficient can be calculated by fitting the linear relationship obtained by the least squares method.
[0102] Calculate the mean of the ROI: Provide a representative image feature value for subsequent bone density calculation. This mean reflects the average response of the image data at a preset proportional thickness and can serve as an important reference for the corrected projection data.
[0103] Select a rectangular area: In the acquired image, select a rectangular area of a fixed size that covers the center of the aluminum sheet or glass to ensure that the acquired data is representative. The size of the rectangular area can be adjusted according to actual needs, but it should be large enough to contain enough pixels to reduce the impact of random noise.
[0104] The calculated ROI mean and the corresponding aluminum sheet thickness were recorded, and these data were used for subsequent bone density value calculation and fitting process.
[0105] Polynomial fitting: Through polynomial fitting, a nonlinear relationship between bone density value and high and low energy values is established, so that bone density value can be predicted by high and low energy values. This fitting method can improve the accuracy and reliability of bone density measurement.
[0106] Step S3, preprocessing the image, including Gaussian smoothing filtering, threshold processing and corrosion operation;
[0107] Wherein, in step S3, the following sub-steps are also included:
[0108] S3-1, perform Gaussian smoothing filtering on the high-energy image, generate a Gaussian kernel of size 3x3, set the sigma value of the Gaussian kernel to 1.0, traverse each pixel in the image, perform convolution operation with the Gaussian kernel, calculate the weighted average of the pixel and its neighborhood, and smooth the image;
[0109] S3-2, threshold processing is performed on the image to calculate the maximum value of all pixel values in the image, and the threshold is set to 4% of the maximum value of the image. Each pixel in the image is traversed. If the pixel value of the pixel point is less than the threshold, the pixel value of the pixel point is set to 0; otherwise, the pixel value of the pixel point remains unchanged;
[0110] S3-3, perform an erosion operation on the image, set a 3x3 all-1 matrix as the structural element, traverse each pixel in the image, and calculate the minimum value in its neighborhood for each pixel. If the pixel is less than the minimum value, set the pixel to 0, otherwise, the pixel remains unchanged.
[0111] It should be noted that Gaussian smoothing filtering is an image smoothing technology based on Gaussian function, which is used to reduce noise in images. Gaussian function is widely used in smoothing operations in image processing because it can effectively reduce noise while retaining important features of the image.
[0112] The Gaussian kernel is a discretized form of the Gaussian function, which is used to implement smoothing operations in image processing. The shape of the Gaussian kernel is a two-dimensional Gaussian distribution.
[0113] Generate a 3x3 Gaussian kernel: The 3x3 Gaussian kernel is computationally efficient and can reduce the amount of computation while maintaining the smoothing effect. The 3x3 Gaussian kernel can smooth local areas of the image and is suitable for processing small-scale noise.
[0114] The sigma value of the Gaussian kernel is the standard deviation of the Gaussian kernel, which determines the width and smoothness of the Gaussian kernel. A larger sigma value will result in a wider smoothing effect, while a smaller sigma value will only slightly smooth the local area. In the present invention, sigma=1.0 is set to achieve a moderate smoothing effect, reducing noise while retaining important features of the image.
[0115] Threshold processing is an image segmentation technology that divides the pixels in the image into foreground and background by setting a threshold. The purpose of threshold processing is to reduce the interference of the background area and highlight the target area.
[0116] Setting the threshold to 4% of the maximum value of the image can effectively suppress the noise in the background area and highlight the target area. This threshold setting method can adapt to the brightness distribution of different images and ensure the robustness of threshold processing.
[0117] Erosion is a morphological image processing technique used to remove small noise points and refine the target area in the image. The erosion operation scans the image through the structural element, reduces the boundary of the target area, and thus removes small connected parts and isolated noise points.
[0118] Set a 3x3 all-1 matrix as the structural element: The 3x3 all-1 matrix structural element is simple and computationally efficient, suitable for processing small-scale noise. This structural element can operate on local areas of the image and is suitable for refining the boundaries of the target area and removing small connected parts and isolated noise points.
[0119] Step S4, using the region growing algorithm to segment the image and using the Canny operator to perform edge detection;
[0120] Wherein, in step S4, the following sub-steps are also included:
[0121] S4-1, find the second peak and valley of each row in the 40% to 50% area in the vertical direction of the image, and take the average value as the seed point;
[0122] S4-2, set the initial threshold to 40, start from the seed point, check the grayscale value difference of adjacent pixels, if the difference is less than or equal to the initial threshold, add the pixel to the region where the seed point is located and mark it as visited;
[0123] S4-3, taking the newly added pixel as the new seed point, continue to check its adjacent pixels and recursively merge regions until no new pixels meet the conditions;
[0124] S4-4, performing a dilation operation on the segmented image to fill small holes in the image and eliminate gaps between objects;
[0125] S4-5, use the Canny operator to perform edge detection on the processed image, set 8% of the maximum value of each row as the threshold, and find the leftmost and rightmost points greater than the threshold as the outermost contour;
[0126] S4-6, use the gradient operator to calculate the gradient magnitude and direction of the image, and apply non-maximum suppression to retain the edge points of the local maximum and remove other non-edge points. Gradient operators include Sobel operator, Prewitt operator and Roberts operator;
[0127] S4-7, using dual threshold detection, setting high threshold and low threshold, starting from the strong edge point, tracing and connecting the edge along the edge direction to form the internal edge contour, the high threshold is used to determine the strong edge point, and the low threshold is used to connect the edge;
[0128] S4-8, merge the outermost contour and the inner edge contour to obtain the final contour.
[0129] It should be noted that the region growing algorithm is an image segmentation method based on seed points. Starting from one or more seed points, pixels that meet the conditions in the neighborhood are gradually added to the current region until no new pixels meet the conditions.
[0130] Select the location of the seed point: The 40% to 50% area in the vertical direction of the image usually contains the center of the target area. The features of these areas are more obvious and are suitable as the starting position of the seed point.
[0131] The second peak and valley: The peak and valley represent the local minimum or maximum of the image grayscale value, which is located at the boundary or inside the target area and is suitable as a seed point.
[0132] Average value: Taking the average value of multiple peaks and valleys can reduce the impact of random noise and ensure that the position of the seed point is representative.
[0133] The initial threshold is the threshold used in the region growing algorithm to determine whether neighboring pixels belong to the same region. If the grayscale value difference between the neighboring pixel and the seed point is less than or equal to the initial threshold, the neighboring pixel is added to the current region. The initial threshold of 40 is a commonly used threshold that can effectively control the range of region growing and avoid overgrowth or undergrowth. The threshold of 40 can adapt to the grayscale distribution of most images and ensure the accuracy and reliability of region growing.
[0134] Grayscale value difference refers to the difference between the grayscale values of two pixels. In the region growing algorithm, grayscale value difference is used to determine whether neighboring pixels belong to the same region.
[0135] Recursive region merging is a key step in the region growing algorithm, which is used to gradually expand the target area until the entire target area is covered. Recursive region merging achieves gradual expansion of the region by continuously checking the neighboring pixels of the newly added pixels and adding the neighboring pixels that meet the conditions to the current region.
[0136] The dilation operation is a morphological image processing technique used to enlarge the target area in the image, fill small holes, and eliminate gaps between objects.
[0137] The code for segmenting the image using the region growing algorithm is:
[0138] import numpy as np
[0139] import cv2
[0140] def region_growing_segmentation(image, seed_point, threshold):
[0141] """
[0142] Image segmentation using region growing algorithm
[0143] :param image: input image
[0144] :param seed_point: seed point coordinates (x, y)
[0145] :param threshold: initial threshold
[0146] :return: Segmented binary image
[0147] """
[0148] # Get the size of the image
[0149] rows, cols = image.shape
[0150] # Create a binary image of the same size as the input image, with an initial value of 0
[0151] segmented_image = np.zeros((rows, cols), dtype=np.uint8)
[0152] # Create a visit mark matrix with initial value False
[0153] visited = np.zeros((rows, cols), dtype=np.bool_)
[0154] # Define the seed point queue
[0155] queue = [seed_point]
[0156] while queue:
[0157] # Take out a point from the queue
[0158] x, y = queue.pop(0)
[0159] # If the point has been visited, skip it
[0160] if visited[y, x]:
[0161] continue
[0162] # Mark this point as visited
[0163] visited[y, x] = True
[0164] # Get the grayscale value of the current point
[0165] current_value = image[y, x]
[0166] # Check the 8 neighbors of the current point
[0167] for dx, dy in [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1),(1, -1), (1, 0), (1, 1)]:
[0168] nx, ny = x + dx, y + dy
[0169] # Check if the neighborhood point is within the image range
[0170] if 0<= nx <cols and 0<= ny<rows:
[0171] # Get the grayscale value of the neighborhood point
[0172] neighbor_value = image[ny, nx]
[0173] # Calculate grayscale value difference
[0174] diff = abs(int(neighbor_value) - int(current_value))
[0175] # If the difference is less than or equal to the threshold, add the neighboring points to the current region
[0176] if diff<= threshold:
[0177] segmented_image[ny, nx] = 255
[0178] # Add neighboring points to the queue
[0179] queue.append((nx, ny))
[0180] return segmented_image
[0181] # Example Usage
[0182] # Read the image
[0183] image = cv2.imread('your_image_path.jpg', cv2.IMREAD_GRAYSCALE)
[0184] # Select seed point
[0185] seed_point = (100, 100) # Example seed point
[0186] # Set the initial threshold
[0187] threshold = 40
[0188] # Execute region growing algorithm
[0189] segmented_image = region_growing_segmentation(image, seed_point,threshold)
[0190] # Display the results
[0191] cv2.imshow('Segmented Image', segmented_image)
[0192] cv2.waitKey(0)
[0193] cv2.destroyAllWindows()
[0194] Canny edge detection is a classic edge detection algorithm that extracts edge information from an image by calculating the gradient magnitude and direction of the image and applying non-maximum suppression and double threshold detection.
[0195] 8% of the maximum value of each row is used as the threshold: it can adapt to the brightness distribution of different images and ensure the robustness of threshold processing. A lower threshold can effectively suppress noise in the background area, highlight the target area, and improve the contrast of the image. 8% is an experimentally verified threshold that can effectively balance background suppression and target retention.
[0196] The gradient operator is an operator used to calculate the magnitude and direction of image gradients and is often used in edge detection.
[0197] The Sobel operator is a commonly used gradient calculation method, which is used to calculate the horizontal and vertical gradients of an image.
[0198] The Prewitt operator is a simple gradient calculation method used to calculate the horizontal and vertical gradients of an image.
[0199] The Roberts operator is a simple gradient calculation method used to calculate the diagonal gradient of an image.
[0200] Non-maximum suppression is an edge detection technology used to remove non-edge points and retain edge points with local maxima. By using non-maximum suppression, the noise around the edge can be removed, making the edge clearer.
[0201] Dual threshold detection is an edge detection technology that distinguishes strong edge points from weak edge points by setting a high threshold and a low threshold.
[0202] A high threshold is used to determine strong edge points, which are usually significant parts of the edge. A high threshold can ensure that the significant parts of the edge are correctly detected and improve the reliability of edge detection.
[0203] A low threshold is used to connect edges. These points are usually the weaker parts of the edge. By connecting weak edge points, the continuity of the edge can be ensured and the integrity of edge detection can be improved.
[0204] The code for edge detection using the Canny operator is:
[0205] import cv2
[0206] import numpy as np
[0207] def canny_edge_detection(image, low_threshold, high_threshold):
[0208] """
[0209] Edge detection using the Canny operator
[0210] :param image: input image
[0211] :param low_threshold: low threshold
[0212] :param high_threshold: high threshold
[0213] :return: Image after edge detection
[0214] """
[0215] # Use Canny operator for edge detection
[0216] edges = cv2.Canny(image, low_threshold, high_threshold)
[0217] return edges
[0218] # Example Usage
[0219] # Read the image
[0220] image = cv2.imread('your_image_path.jpg', cv2.IMREAD_GRAYSCALE)
[0221] # Set the low and high thresholds
[0222] low_threshold = 50
[0223] high_threshold = 150
[0224] # Perform Canny edge detection
[0225] edges = canny_edge_detection(image, low_threshold, high_threshold)
[0226] # Display the results
[0227] cv2.imshow('Edges', edges)
[0228] cv2.waitKey(0)
[0229] cv2.destroyAllWindows()
[0230] Step S5, extracting the region of interest (ROI), and determining the boundary of the ROI by searching for coordinates that meet a preset threshold condition within a preset ratio range in the vertical direction of the image;
[0231] Wherein, in step S5, the following sub-steps are also included:
[0232] S5-1, in the range of 5%-20% in the vertical direction of the image, find the coordinates in each row that are greater than 5% of the maximum value of the row and store them in order;
[0233] S5-2, for each row of coordinates stored sequentially, calculate the difference between adjacent coordinates. If the difference is greater than 5, record the current row as the upper boundary of the ROI;
[0234] S5-3, in the range of 2%-40% in the vertical direction of the image, find the coordinates in each row that are greater than 10% of the maximum value of the row and store them in order;
[0235] S5-4, for each row of coordinates stored sequentially, calculate the difference between adjacent coordinates, record the length of consecutive differences of 1, save the length that is greater than 5% of the horizontal size of the image, and record the leftmost value of the first length and the rightmost value of the second length;
[0236] S5-5, for each row, calculate the difference between the rightmost value and the leftmost value, find the row with the narrowest difference among all rows, and record the current row as the lower boundary of the ROI;
[0237] S5-6, calculate the middle position between the upper boundary and the lower boundary, determine the middle horizontal line, and determine horizontal lines with fixed distances upward and downward from the middle horizontal line as the upper and lower auxiliary boundaries of the ROI;
[0238] S5-7, when calculating the lower boundary, record the row with the smallest difference between the left and right values among all rows, take the average of the left and right values as the vertical position, and determine the vertical boundary from the lower boundary to the bottom of the image;
[0239] S5-8, take the positions 5% away from the left and right sides of the image as the left and right boundaries of the ROI respectively.
[0240] It should be noted that the upper boundary of the ROI can be determined by searching for coordinates that meet the threshold condition within a preset vertical range of the image. This range usually includes the top features of the target area and is suitable as a reference for the upper boundary.
[0241] The range of 5%-20% in the vertical direction of the image usually contains the top features of the target area and is suitable as a reference for the upper boundary. By selecting a wider range, it can be ensured that the upper boundary can be accurately found even when there is noise in the image or the position of the target area is deviated.
[0242] Differences between adjacent coordinates: By calculating the differences between adjacent coordinates, changes in coordinates can be detected, thereby determining the location of boundaries.
[0243] A difference greater than 5 indicates that there is a significant coordinate change in the row, which is a feature of the boundary. The current row can be recorded as the upper boundary of the ROI to ensure the accuracy of the boundary position.
[0244] Determine the lower boundary of the ROI: The lower boundary of the ROI can be determined by finding coordinates that meet a threshold condition within a preset vertical range of the image. This range usually contains the bottom features of the target area and is a suitable reference for the lower boundary.
[0245] The range of 2%-40% in the vertical direction of the image usually contains the bottom features of the target area and is suitable as a reference for the lower boundary. By selecting a wider range, it can be ensured that the lower boundary can be accurately found even when there is noise in the image or the position of the target area is deviated.
[0246] By recording the length of continuous difference of 1, continuous coordinate areas can be detected. These areas are usually part of the target area. Saving the length greater than 5% of the horizontal size of the image can screen out significant continuous areas and exclude small noise areas.
[0247] By recording the leftmost value of the first length and the rightmost value of the second length, the left and right boundaries of the target area can be determined, ensuring the integrity of the boundary of the target area and improving the accuracy of ROI extraction.
[0248] By finding the row with the narrowest difference among all rows, the narrowest part of the target area can be determined, which is a feature of the lower boundary. The narrowest difference usually represents the bottom feature of the target area and is suitable as a reference for the lower boundary. By selecting the narrowest difference, the accuracy of the lower boundary can be ensured.
[0249] By determining the middle horizontal line and the upper and lower auxiliary boundaries, the boundary definition of the ROI can be optimized and the accuracy of segmentation can be improved.
[0250] The middle horizontal line is the middle position between the upper and lower boundaries and is used to determine the center position of the ROI.
[0251] Taking 5% of the left and right positions of the image as the left and right boundaries can adapt to the width of different images and ensure the accuracy of the boundary position. By taking a fixed proportion of the position, the boundary of the target area can be ensured to be complete, thereby improving the accuracy of ROI extraction.
[0252] The Python code for extracting the region of interest (ROI) is:
[0253] import numpy as np
[0254] import cv2
[0255] def extract_roi(image):
[0256] """
[0257] Extracting Region of Interest (ROI)
[0258] :param image: input image
[0259] :return: extracted ROI boundary
[0260] """
[0261] rows, cols = image.shape
[0262] roi_boundaries = {}
[0263] # S5-1: Determine the upper boundary of the ROI
[0264] upper_coords = []
[0265] for row in range(int(rows * 0.05), int(rows * 0.20)):
[0266] row_max = np.max(image[row, :])
[0267] threshold = 0.05 * row_max
[0268] coords = np.where(image[row, :]>threshold)[0]
[0269] if len(coords)>0:
[0270] upper_coords.append(coords)
[0271] if upper_coords:
[0272] upper_diffs = np.diff(upper_coords[0])
[0273] if np.any(upper_diffs>5):
[0274] roi_boundaries['upper'] = row
[0275] # S5-2: Record upper boundary
[0276] if 'upper' not in roi_boundaries:
[0277] roi_boundaries['upper'] = int(rows * 0.05)
[0278] # S5-3: Determine the lower boundary of the ROI
[0279] lower_coords = []
[0280] for row in range(int(rows * 0.02), int(rows * 0.40)):
[0281] row_max = np.max(image[row, :])
[0282] threshold = 0.10 * row_max
[0283] coords = np.where(image[row, :]>threshold)[0]
[0284] if len(coords)>0:
[0285] lower_coords.append(coords)
[0286] if lower_coords:
[0287] lower_diffs = np.diff(lower_coords[0])
[0288] lengths = np.where(lower_diffs == 1)[0]
[0289] if len(lengths)>0:
[0290] length = lengths[-1] - lengths[0]+ 1
[0291] if length>0.05 * cols:
[0292] roi_boundaries['lower'] = row
[0293] # S5-4: Record the lower boundary
[0294] if 'lower' not in roi_boundaries:
[0295] roi_boundaries['lower'] = int(rows * 0.40)
[0296] # S5-5: Determine the lower boundary of the ROI
[0297] min_width = float('inf')
[0298] for row in range(int(rows * 0.02), int(rows * 0.40)):
[0299] row_max = np.max(image[row, :])
[0300] threshold = 0.10 * row_max
[0301] coords = np.where(image[row, :]>threshold)[0]
[0302] if len(coords)>0:
[0303] width = np.max(coords) - np.min(coords)
[0304] if width <min_width:
[0305] min_width = width
[0306] roi_boundaries['lower'] = row
[0307] # S5-6: Determine the upper and lower auxiliary boundaries of the ROI
[0308] mid_row = (roi_boundaries['upper'] + roi_boundaries['lower']) / / 2
[0309] roi_boundaries['upper_aux'] = max(roi_boundaries['upper']- 10, 0)
[0310] roi_boundaries['lower_aux'] = min(roi_boundaries['lower']+ 10,rows - 1)
[0311] # S5-7: Determine the vertical boundaries of the ROI
[0312] min_diff = float('inf')
[0313] for row in range(roi_boundaries['lower'], rows):
[0314] row_max = np.max(image[row, :])
[0315] threshold = 0.10 * row_max
[0316] coords = np.where(image[row, :]>threshold)[0]
[0317] if len(coords)>0:
[0318] diff = np.max(coords) - np.min(coords)
[0319] if diff <min_diff:
[0320] min_diff = diff
[0321] roi_boundaries['vertical'] = (np.min(coords) + np.max(coords)) / / 2
[0322] # S5-8: Determine the left and right boundaries of the ROI
[0323] roi_boundaries['left'] = int(cols * 0.05)
[0324] roi_boundaries['right'] = int(cols * 0.95)
[0325] return roi_boundaries
[0326] # Example Usage
[0327] # Read the image
[0328] image = cv2.imread('your_image_path.jpg', cv2.IMREAD_GRAYSCALE)
[0329] # Extract ROI
[0330] roi_boundaries = extract_roi(image)
[0331] print("ROI Boundaries:", roi_boundaries)
[0332] Step S6, calculating the area of ROI, bone density value BMD and bone mineral content;
[0333] Wherein, in step S6, the following sub-steps are also included:
[0334] S6-1, combining the physical length and pixel number of the image, calculating the unit pixel size, and multiplying the number of pixels of the ROI by the unit pixel size to obtain the area of the ROI;
[0335] S6-2, calculate the average value of the pixel values in the ROI area, and take a small square area around the ROI as the background area, calculate the average value of the background area, and subtract the average value of the background area from the average value of the ROI to obtain the bone mineral density (BMD) value of the corresponding area;
[0336] S6-3, multiplying the area of the ROI by the bone density value BMD of the corresponding area to obtain the bone mineral content value.
[0337] It should be noted that in dual-energy X-ray absorptiometry (DXA), calculating the area of the region of interest (ROI), bone density (BMD) and bone mineral content is a key step. These indicators provide important quantitative information for the diagnosis and treatment of osteoporosis. By accurately calculating these indicators, bone health can be evaluated and support can be provided for clinical decision-making.
[0338] Calculate the area of ROI: By calculating the unit pixel size, the number of pixels is converted into the actual physical area to obtain the area of ROI.
[0339] Calculate the bone density value BMD: Calculate the average pixel value in the ROI area and subtract the average value of the background area to obtain the corrected bone density value BMD.
[0340] Calculation of bone mineral content: Bone mineral content is obtained by multiplying the area of ROI by the bone mineral density value (BMD), providing a quantitative indicator for bone quality assessment.
[0341] See also Figure 2 , which shows a system architecture diagram of an image processing system of a dual-energy X-ray bone absorptiometry device provided by one embodiment of the present invention, including:
[0342] An image acquisition module, used to acquire dual-energy X-ray images, including bright field data and dark field data;
[0343] A data correction module is used to perform bright and dark field correction on the original projection data;
[0344] The data fitting module is used to fit the relationship between bone density and high and low energy values. By collecting images of aluminum sheets and glass of different thicknesses, the bone density value is obtained and the bone-aluminum conversion coefficient is fitted.
[0345] Image preprocessing module, used to preprocess images, including Gaussian smoothing filtering, threshold processing and corrosion operations;
[0346] Image segmentation module, which uses region growing algorithm to perform image segmentation and extract target area;
[0347] The edge detection module uses the Canny operator to perform edge detection and obtain the outline of the target area;
[0348] ROI extraction module, used to extract the region of interest (ROI) and determine the boundary of the ROI by finding the coordinates that meet the preset threshold conditions within a preset ratio range in the vertical direction of the image;
[0349] The indicator calculation module is used to calculate the area of ROI, bone density value BMD, and bone mineral content.
[0350] It should be noted that the image acquisition module provides comprehensive data support for subsequent image correction by simultaneously collecting bright-field and dark-field data. This dual data acquisition method can more accurately correct detector non-uniformity and tube intensity changes, as well as detector electronic noise and environmental noise, thereby significantly improving image quality.
[0351] The bright and dark field correction formula used in the data correction module can effectively correct various errors in the image, ensuring the uniformity and accuracy of the image. This correction method performs well when processing dual-energy X-ray images, especially in reducing noise and artifacts.
[0352] The data fitting module collects images of aluminum sheets and glass of different thicknesses to fit the relationship between bone density values and high and low energy values. This method can more accurately simulate the characteristics of bones and tissues, thereby improving the accuracy of bone density measurement. The use of polynomial fitting further improves the accuracy and reliability of the fitting.
[0353] The image preprocessing module combines Gaussian smoothing filtering, threshold processing and corrosion operations to effectively reduce noise and artifacts in the image while retaining important image features. This comprehensive preprocessing method performs well in improving image quality and provides a solid foundation for subsequent image segmentation and edge detection.
[0354] The image segmentation module uses the region growing algorithm for image segmentation. This method can dynamically adjust the segmentation process according to the local features of the image, thereby extracting the target area more accurately. Compared with the traditional fixed threshold segmentation method, the region growing algorithm has higher adaptability and accuracy when processing complex images.
[0355] The edge detection module uses the Canny operator for edge detection. This method can accurately depict the boundaries of the target area and effectively distinguish strong edge points from weak edge points through dual threshold detection. This edge detection method performs well in dealing with noise and complex backgrounds and can provide clear and accurate edge information.
[0356] The ROI extraction module can accurately determine the boundaries of the ROI by searching for coordinates that meet the preset threshold conditions within a preset ratio range in the vertical direction of the image. This method not only takes into account the local features of the image, but also ensures the accuracy and reliability of ROI extraction through a multi-step boundary determination process.
[0357] The indicator calculation module provides comprehensive bone assessment indicators by calculating the area of ROI, bone density value BMD and bone mineral content. These indicators can not only quantify the health status of bones, but also provide important diagnostic information for clinicians.
[0358] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. An image processing method for a dual-energy X-ray bone densitometer, characterized in that: The method includes: Step S1, collecting dual-energy X-ray images, including bright field data and dark field data, and performing bright field and dark field correction on the original projection data; Step S2, based on the corrected projection data, using aluminum sheets to simulate bones and glass sheets to simulate tissues, performing data fitting to obtain bone density values and fitting the bone-to-aluminum conversion coefficient; Step S3, preprocessing the image, including Gaussian smoothing filtering, threshold processing and corrosion operation; Step S4, using the region growing algorithm to segment the image and using the Canny operator to perform edge detection; Step S5, extracting the region of interest (ROI), and determining the boundary of the ROI by searching for coordinates that meet a preset threshold condition within a preset ratio range in the vertical direction of the image; Step S6, calculating the area of ROI, bone density value BMD and bone mineral content; Wherein, in step S5, the following sub-steps are also included: S5-1, within the range of 5%-20% in the vertical direction of the image, find the coordinates in each row that are greater than 5% of the maximum value of the row and store them in order; S5-2, for each row of coordinates stored sequentially, calculate the difference between adjacent coordinates. If the difference is greater than 5, record the current row as the upper boundary of the ROI; S5-3, in the range of 2%-40% in the vertical direction of the image, find the coordinates in each row that are greater than 10% of the maximum value of the row and store them in order; S5-4, for each row of coordinates stored sequentially, calculate the difference between adjacent coordinates, record the length of consecutive differences of 1, save the length that is greater than 5% of the horizontal size of the image, and record the leftmost value of the first length and the rightmost value of the second length; S5-5, for each row, calculate the difference between the rightmost value and the leftmost value, find the row with the narrowest difference among all rows, and record the current row as the lower boundary of the ROI; S5-6, calculate the middle position between the upper boundary and the lower boundary, determine the middle horizontal line, and determine horizontal lines with fixed distances upward and downward from the middle horizontal line as the upper and lower auxiliary boundaries of the ROI; S5-7, when calculating the lower boundary, record the row with the smallest difference between the left and right values among all rows, take the average of the left and right values as the vertical position, and determine the vertical boundary from the lower boundary to the bottom of the image; S5-8, respectively take the positions 5% away from the left and right sides of the image as the left and right boundaries of the ROI.
2. The image processing method of a dual-energy X-ray bone absorptiometry device according to claim 1, characterized in that: Wherein, step S1 further includes the following sub-steps: S1-1, without placing any material on the stage, the tube is exposed, and an empty data is collected as bright field data, which is used to correct the non-uniformity of the detector and the intensity variation of the tube; S1-2: No material is placed on the stage, the tube is closed, and empty data is collected as dark field data. The dark field data is used to correct the electronic noise and environmental noise of the detector; S1-3, perform bright field and dark field correction on the collected original projection data to obtain the corrected projection data. The correction formula is: Among them, I corrected is the corrected projection data, I raw is the original projection data, I dark is the dark field data, I light The data are bright field data.
3. The image processing method of a dual-energy X-ray bone absorptiometry device according to claim 1, characterized in that: Wherein, in step S2, the following sub-steps are also included: S2-1: Using aluminum sheets to simulate bones and glass to simulate tissues, based on the corrected projection data, images of aluminum sheets and glass of different thicknesses were collected to obtain bone density values. The thickness of the aluminum sheets ranged from 0.1 mm to 10 mm in 0.1 mm increments, and the thickness of the glass ranged from 0.1 mm to 5 mm in 0.1 mm increments. S2-2, based on the relationship between aluminum sheet thickness and bone density, the bone-to-aluminum conversion coefficient was fitted using the least squares method; S2-3, selecting a rectangular area of a fixed size in the acquired image, calculating the average value of all pixel values within the rectangular area as the average value of the ROI of the corrected projection data, and recording the average value of the ROI and the thickness of the aluminum sheet; the rectangular area covers the center portion of the aluminum sheet or glass; S2-4, multiply the thickness of the aluminum sheet by the bone-aluminum conversion coefficient to obtain the corresponding bone density value, and perform polynomial fitting on the relationship between the density value and the high and low energy values to obtain the fitting parameters. The polynomial fitting formula is: y=a0+a1x+a2x 2 +...+a n x n Among them, y is the bone density value, x is the high and low energy value, a0, a1, a2, ..., a n is the fitting parameter, and n is the fitting order.
4. The image processing method of a dual-energy X-ray bone absorptiometry device according to claim 1, characterized in that: Wherein, in step S3, the following sub-steps are also included: S3-1, perform Gaussian smoothing filtering on the high-energy image, generate a Gaussian kernel of size 3x3, set the sigma value of the Gaussian kernel to 1.0, traverse each pixel in the image, perform convolution operation with the Gaussian kernel, calculate the weighted average of the pixel and its neighborhood, and smooth the image; S3-2, threshold processing is performed on the image to calculate the maximum value of all pixel values in the image, and the threshold is set to 4% of the maximum value of the image. Each pixel in the image is traversed. If the pixel value of the pixel point is less than the threshold, the pixel value of the pixel point is set to 0; otherwise, the pixel value of the pixel point remains unchanged; S3-3, perform an erosion operation on the image, set a 3x3 all-1 matrix as the structural element, traverse each pixel in the image, and calculate the minimum value in its neighborhood for each pixel. If the pixel is less than the minimum value, set the pixel to 0, otherwise, the pixel remains unchanged.
5. The image processing method of a dual-energy X-ray bone absorptiometry device according to claim 1, characterized in that: Wherein, in step S4, the following sub-steps are also included: S4-1, find the second peak and valley of each row in the 40% to 50% area in the vertical direction of the image, and take the average value as the seed point; S4-2, set the initial threshold to 40, start from the seed point, check the grayscale value difference of adjacent pixels, if the difference is less than or equal to the initial threshold, add the pixel to the region where the seed point is located and mark it as visited; S4-3, taking the newly added pixel as the new seed point, continue to check its adjacent pixels and recursively merge regions until no new pixels meet the conditions; S4-4, performing a dilation operation on the segmented image to fill small holes in the image and eliminate gaps between objects; S4-5, use the Canny operator to perform edge detection on the processed image, set 8% of the maximum value of each row as the threshold, and find the leftmost and rightmost points greater than the threshold as the outermost contour; S4-6, using a gradient operator to calculate the gradient magnitude and direction of the image, and applying non-maximum suppression to retain edge points with local maxima and remove other non-edge points. The gradient operator includes a Sobel operator, a Prewitt operator, and a Roberts operator; S4-7, using dual threshold detection, setting a high threshold and a low threshold, starting from a strong edge point, tracing and connecting the edge along the edge direction to form an internal edge contour, the high threshold is used to determine the strong edge point, and the low threshold is used to connect the edge; S4-8, merge the outermost contour and the inner edge contour to obtain the final contour.
6. The image processing method of a dual-energy X-ray bone absorptiometry device according to claim 1, characterized in that: Wherein, in step S6, the following sub-steps are also included: S6-1, combining the physical length and pixel number of the image, calculating the unit pixel size, and multiplying the number of pixels of the ROI by the unit pixel size to obtain the area of the ROI; S6-2, calculate the average value of the pixel values in the ROI area, and take a small square area around the ROI as the background area, calculate the average value of the background area, and subtract the average value of the background area from the average value of the ROI to obtain the bone mineral density (BMD) value of the corresponding area; S6-3, multiplying the area of the ROI by the bone density value BMD of the corresponding area to obtain the bone mineral content value.
7. An image processing system for a dual-energy X-ray bone densitometer, characterized in that ,include: An image acquisition module, used to acquire dual-energy X-ray images, including bright field data and dark field data; A data correction module is used to perform bright and dark field correction on the original projection data; The data fitting module is used to fit the relationship between bone density and high and low energy values. By collecting images of aluminum sheets and glass of different thicknesses, the bone density value is obtained and the bone-aluminum conversion coefficient is fitted. Image preprocessing module, used to preprocess images, including Gaussian smoothing filtering, threshold processing and corrosion operations; Image segmentation module, which uses region growing algorithm to perform image segmentation and extract target area; The edge detection module uses the Canny operator to perform edge detection and obtain the outline of the target area; ROI extraction module, used to extract the region of interest (ROI) and determine the boundary of the ROI by finding the coordinates that meet the preset threshold conditions within a preset ratio range in the vertical direction of the image; Index calculation module, used to calculate the area of ROI, bone density value BMD, and bone mineral content; The ROI extraction module includes: finding the coordinates in each row that are greater than 5% of the maximum value of the row within the range of 5%-20% in the vertical direction of the image, and storing them in sequence; for each row of coordinates stored in sequence, finding the difference between adjacent coordinates, if the difference is greater than 5, recording the current row as the upper boundary of the ROI; finding the coordinates in each row that are greater than 10% of the maximum value of the row within the range of 2%-40% in the vertical direction of the image, and storing them in sequence; for each row of coordinates stored in sequence, finding the difference between adjacent coordinates, recording the length of consecutive differences of 1, saving the length greater than 5% of the horizontal size of the image, and recording the first length. The leftmost value, the rightmost value of the second length; for each row, calculate the difference between the rightmost value and the leftmost value, find the row with the narrowest difference among all rows, and record the current row as the lower boundary of the ROI; calculate the middle position between the upper and lower boundaries, determine the middle horizontal line, and determine horizontal lines with a fixed distance upward and downward from the middle horizontal line as the upper and lower auxiliary boundaries of the ROI; when calculating the lower boundary, record the row with the smallest left and right value difference among all rows, take the average of the left and right values as the vertical position, and determine the vertical boundary from the lower boundary to the bottom of the image; take the position 5% of the left and right sides of the image as the left and right boundaries of the ROI respectively.
Citation Information
Patent Citations
Dual-energy X-ray bone mineral density instrument projection area calibration method and die body
CN113017657A
Bone mineral density detection method
CN119700169A