Intelligent automatic stretching method and terminal for X-ray images
By automatically generating an adaptive stretch curve to process the X-ray image, the problem of poor contrast enhancement effect in the prior art is solved, and contrast enhancement and image clarity are improved to meet clinical diagnosis needs.
Patent Information
- Application Number
- CN202010137940.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-03
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2040-03-03
AI Technical Summary
The prior art is difficult to meet the clinical diagnosis needs when enhancing the contrast of X-ray images, especially the contrast enhancement effect of human tissue in DR images, and the fixed curve stretching scheme cannot adapt to image differences under different exposure conditions.
By acquiring the grayscale histogram of the X-ray image and the binarized mask diagram of the region of interest, the correction limit histogram is calculated, and the stretch start point, the anchor point and the end point are found, and the adaptive stretch curve is automatically generated to perform the image. Stretching treatment.
It achieves an adaptive contrast enhancement to the region of interest, providing a clearer and more natural image display effect, and meeting clinical needs.
Smart Images

Figure CN111292242B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an intelligent automatic stretching method and a terminal for X-ray images. Background Art
[0002] X-ray images usually need to be processed accordingly to help doctors obtain accurate medical information. Existing solutions can enhance the contrast of images to a certain extent, but these solutions all have some defects and the contrast enhancement effect is average.
[0003] (1) Based on histogram equalization scheme: the image histogram distribution can be processed uniformly, and the grayscale concentrated area can be stretched, which can improve the image contrast to a certain extent, but it cannot focus on improving the contrast of human tissue in DR images, and the effect is difficult to meet clinical diagnosis needs;
[0004] (2) Gamma-based stretching scheme: simple and effective, only stretching low grayscale or high grayscale, which has a certain effect on brightness adjustment, but the main contrast enhancement area may be in the middle grayscale range, and the effect of this scheme is difficult to obtain the best image contrast;
[0005] (3) Fixed curve stretching scheme: Use an empirical stretching curve for a fixed grayscale range. However, due to the difference in images under different exposure conditions, the range of contrast to be enhanced for different images varies greatly. Using a fixed range cannot achieve self-adaptation, and it is difficult to stably obtain the optimal contrast. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide an intelligent automatic stretching method and terminal for X-ray images, which can obtain a clear and natural image display effect according to requirements.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] An intelligent automatic stretching method for X-ray images, comprising:
[0009] Obtaining a grayscale histogram of the X-ray image to be processed;
[0010] Calculating a binary mask image of a region of interest of the X-ray image to be processed;
[0011] Calculating a modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest;
[0012] Searching the grayscale histogram and the modified limit histogram to obtain a stretching start point, a stretching anchor point, and a stretching end point;
[0013] Automatically generate a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point;
[0014] The X-ray image to be processed is stretched according to the stretching curve.
[0015] Another technical solution adopted by the present invention is:
[0016] An intelligent automatic stretching terminal for X-ray images includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0017] Obtaining a grayscale histogram of the X-ray image to be processed;
[0018] Calculating a binary mask image of a region of interest of the X-ray image to be processed;
[0019] Calculating a modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest;
[0020] Searching the grayscale histogram and the modified limit histogram to obtain a stretching start point, a stretching anchor point, and a stretching end point;
[0021] Automatically generate a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point;
[0022] The X-ray image to be processed is stretched according to the stretching curve.
[0023] The beneficial effect of the present invention is that the region of interest can be extracted according to the contrast, thereby obtaining the key range of stretching, and then automatically generating an adaptive stretching curve on this basis to stretch the image. The present invention enhances the contrast of the region of interest and can provide a clearer and more natural image display effect to meet clinical needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a flow chart of the intelligent automatic stretching method for X-ray images according to the first embodiment of the present invention;
[0025] Figure 2 is a schematic diagram of a grayscale histogram according to the first embodiment of the present invention;
[0026] Figure 3 This is a schematic diagram of obtaining a stretching anchor point according to the first embodiment of the present invention;
[0027] Figure 4 is a schematic diagram of a stretching curve of Example 1 of the present invention;
[0028] Figure 5 This is a schematic diagram of an intelligent automatic stretching terminal according to Embodiment 2 of the present invention.
[0029] Description of labels:
[0030] 100. Intelligent automatic stretching terminal; 1. Memory; 2. Processor. DETAILED DESCRIPTION
[0031] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in conjunction with the implementation modes and the accompanying drawings.
[0032] The key concept of the present invention is to automatically generate an adaptive stretching curve to stretch the image, so as to obtain a more natural and clear image display effect.
[0033] Please refer to Figure 1 , an intelligent automatic stretching method for X-ray images, comprising:
[0034] Obtaining a grayscale histogram of the X-ray image to be processed;
[0035] Calculating a binary mask image of a region of interest of the X-ray image to be processed;
[0036] Calculating a modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest;
[0037] Searching the grayscale histogram and the modified limit histogram to obtain a stretching start point, a stretching anchor point, and a stretching end point;
[0038] Automatically generate a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point;
[0039] The X-ray image to be processed is stretched according to the stretching curve.
[0040] From the above description, it can be seen that the beneficial effect of the present invention is that the region of interest can be extracted according to the contrast, thereby obtaining the key range of stretching, and then automatically generating an adaptive stretching curve on this basis to stretch the image. The present invention enhances the contrast of the region of interest and can provide a clearer and more natural image display effect to meet clinical needs.
[0041] Furthermore, the step of calculating a binary mask image of the region of interest of the X-ray image to be processed specifically includes:
[0042] Performing square root compression processing on the original image of the to-be-processed X-ray image that has not been enhanced, to obtain a square root compressed image;
[0043] Performing pyramid decomposition on the square root compressed image to obtain a decomposed image;
[0044] Calculate the standard deviation coefficient of any pixel point in any layer of the decomposed image;
[0045] Calculate the contrast-to-noise ratio of any pixel point according to the standard deviation coefficient;
[0046] The area where the pixel points whose contrast-to-noise ratio is within a preset threshold range are located is intercepted as the area of interest;
[0047] The pixel values of the pixels in the region of interest are set to 1, and the pixel values of the pixels not in the region of interest are set to 0, to obtain a binary mask image of any layer;
[0048] The binary mask image of any layer is enlarged to the size of the X-ray image to be processed to obtain a binary mask image of the region of interest.
[0049] Furthermore, the step of calculating the modified restricted histogram based on the grayscale histogram and the binary mask image of the region of interest specifically includes:
[0050] Calculating a restricted histogram of the region of interest according to the binary mask image of the region of interest;
[0051] The grayscale histogram and the region of interest limit histogram are weighted to obtain a modified limit histogram.
[0052] Further, the grayscale histogram and the modified limit histogram are searched to obtain the stretching starting point, the stretching anchor point and the stretching end point, which specifically includes:
[0053] Find the left and right endpoints of the grayscale histogram as the stretching start point and the stretching end point respectively;
[0054] performing filtering and normalization processing on the modified limit histogram in sequence;
[0055] Obtain the position corresponding to the maximum value of the normalized corrected limit histogram;
[0056] The stretching anchor point is obtained by searching according to the position corresponding to the maximum value and a preset threshold.
[0057] Furthermore, the automatically generating a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point specifically includes:
[0058] According to the formula Automatically generate stretching curve, where k a is a constant, p s Indicates the stretching starting point, y s Indicates the gray value after stretching from the starting point of the stretch, p e Indicates the end point of stretching, y e Indicates the gray value after stretching at the stretching end point, p a Indicates the stretch anchor point, p lrepresents the connection point between the left transition segment and the middle linear segment, p r represents the connection point between the right transition segment and the middle linear segment, w l Indicates the width of the left transition section, h l Indicates the height of the left transition section, w r Indicates the width of the right transition section, h r Indicates the height of the right transition section;
[0059] According to the formula Calculate w l 、h l and p l , where p a Indicates the stretch anchor point, y a Represents the grayscale value of the stretched anchor point after stretching, Tr l represents a constant;
[0060] According to the formula Calculate w r 、h r and p r , where Tr r Represents a constant.
[0061] From the above description, it can be seen that the grayscale after stretching (corresponding to the y of the stretching curve) can be obtained by searching point by point according to the grayscale of the X-ray image (corresponding to the x of the stretching curve). Gamma function transformation can be performed on the transition segment to make the transition between the middle linear segment and the left and right transition segments natural.
[0062] Please refer to Figure 5 , another technical solution involved in the present invention is:
[0063] An intelligent automatic stretching terminal 100 for X-ray images includes a memory 1, a processor 2, and a computer program stored in the memory 1 and executable on the processor 2. When the processor 2 executes the computer program, the following steps are implemented:
[0064] Obtaining a grayscale histogram of the X-ray image to be processed;
[0065] Calculating a binary mask image of a region of interest of the X-ray image to be processed;
[0066] Calculating a modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest;
[0067] Searching the grayscale histogram and the modified limit histogram to obtain a stretching start point, a stretching anchor point, and a stretching end point;
[0068] Automatically generate a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point;
[0069] The X-ray image to be processed is stretched according to the stretching curve.
[0070] Furthermore, the step of calculating a binary mask image of the region of interest of the X-ray image to be processed specifically includes:
[0071] Performing square root compression processing on the original image of the to-be-processed X-ray image that has not been enhanced, to obtain a square root compressed image;
[0072] Performing pyramid decomposition on the square root compressed image to obtain a decomposed image;
[0073] Calculate the standard deviation coefficient of any pixel point in any layer of the decomposed image;
[0074] Calculate the contrast-to-noise ratio of any pixel point according to the standard deviation coefficient;
[0075] The area where the pixel points whose contrast-to-noise ratio is within a preset threshold range are located is intercepted as the area of interest;
[0076] The pixel values of the pixels in the region of interest are set to 1, and the pixel values of the pixels not in the region of interest are set to 0, to obtain a binary mask image of any layer;
[0077] The binary mask image of any layer is enlarged to the size of the X-ray image to be processed to obtain a binary mask image of the region of interest.
[0078] Furthermore, the step of calculating the modified restricted histogram based on the grayscale histogram and the binary mask image of the region of interest specifically includes:
[0079] Calculating a restricted histogram of the region of interest according to the binary mask image of the region of interest;
[0080] The grayscale histogram and the region of interest limit histogram are weighted to obtain a modified limit histogram.
[0081] Further, the grayscale histogram and the modified limit histogram are searched to obtain the stretching starting point, the stretching anchor point and the stretching end point, which specifically includes:
[0082] Find the left and right endpoints of the grayscale histogram as the stretching start point and the stretching end point respectively;
[0083] performing filtering and normalization processing on the modified limit histogram in sequence;
[0084] Obtain the position corresponding to the maximum value of the normalized corrected limit histogram;
[0085] The stretching anchor point is obtained by searching according to the position corresponding to the maximum value and a preset threshold.
[0086] Furthermore, the automatically generating a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point specifically includes:
[0087] According to the formula Automatically generate stretching curve, where k a is a constant, p s Indicates the stretching starting point, y s Indicates the gray value after stretching from the starting point of the stretch, p e Indicates the end point of stretching, y e Indicates the gray value after stretching at the stretching end point, p a Indicates the stretch anchor point, p l represents the connection point between the left transition segment and the middle linear segment, p r represents the connection point between the right transition segment and the middle linear segment, w l Indicates the width of the left transition section, h l Indicates the height of the left transition section, w r Indicates the width of the right transition section, h r Indicates the height of the right transition section;
[0088] According to the formula Calculate w l 、h l and p l , where pa represents the stretching anchor point, y a Represents the grayscale value of the stretched anchor point after stretching, Tr l represents a constant;
[0089] According to the formula Calculate w r 、h r and p r , where Trr represents a constant.
[0090] Embodiment 1
[0091] Please refer to Figures 1 to 4 , Embodiment 1 of the present invention is:
[0092] An intelligent automatic stretching method for X-ray images, such as Figure 1 As shown, the following steps are included:
[0093] S1. Obtaining a grayscale histogram of an X-ray image to be processed. The X-ray image to be processed is an X-ray clinical image, which may be an image to be stretched after being enhanced by pyramid decomposition or other existing technologies.
[0094] S2. Calculate a binary mask image of the region of interest of the X-ray image to be processed.
[0095] In this embodiment, step S2 specifically includes:
[0096] S21, performing square root compression processing on the original image of the to-be-processed X-ray image that has not been enhanced, to obtain a square root compressed image. Specifically, according to the formula Perform square root compression on X-ray images, I dst Represents the gray value of the image after square root compression, I src represents the grayscale value of the original image of the to-be-processed X-ray image without enhancement processing, and α is the dynamic range magnification factor, which can be set to 256 in this embodiment. The Poisson distribution noise of the image is converted into Gaussian distribution noise through square root compression processing.
[0097] S22, performing pyramid decomposition on the square root compressed image to obtain a decomposed image. In this embodiment, the image can be decomposed into several layers as needed, for example, eight layers, to facilitate subsequent feature extraction.
[0098] S23, calculating the standard deviation coefficient of any pixel point of any layer of the decomposed image. Select the kth layer of the Laplacian pyramid as the designated layer (for example, k=3), and calculate the standard deviation coefficient of the layer pixel by pixel. The standard deviation coefficient represents the detail contrast. Specifically, according to the formula Calculate the standard deviation system, CL k Represents any pixel L in any layer k The pixel set in the neighborhood N*N window {L ijk}Calculated standard deviation coefficient.
[0099] S24, calculating the contrast-to-noise ratio of any pixel according to the standard deviation coefficient. Specifically, according to the formula Calculate the contrast-to-noise ratio, CNR k Denotes the contrast-to-noise ratio, NL k represents the noise level of layer k, which is a fixed empirical value. Through this step, the CNR map corresponding to each pixel can be obtained.
[0100] S25, intercepting the area where the pixels whose contrast-to-noise ratio is within the preset threshold range are located as the region of interest. The preset threshold range is [Thr0, Thr1], and Thr0 = 0.01, Thr1 = 0.05 can be set, and the pixels whose CNR values are within the preset threshold range are intercepted as the region of interest.
[0101] S26, setting the pixel values of the pixels in the region of interest to 1, and setting the pixel values of the pixels not in the region of interest to 0, to obtain a binary mask image of any layer. The size of the binary mask image of any layer obtained at this time is the same as the size of the layer.
[0102] S27, enlarging the binary mask image of any layer to the size of the X-ray image to be processed, and obtaining the binary mask image of the region of interest. Specifically, it can be enlarged to the size of the X-ray image to be processed according to the nearest neighbor interpolation method, that is, assigning the grayscale value of the pixel with a closer distance to the pixel to be interpolated, and obtaining the binary mask image of the region of interest with a grayscale value of 0 or 1 of the same size as the X-ray image to be processed.
[0103] S3. Calculate a modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest.
[0104] In this embodiment, step S3 specifically includes:
[0105] S31, calculating and obtaining a restricted histogram of the region of interest according to the binary mask image of the region of interest. The restricted histogram of the region of interest can be obtained by statistics according to the binary mask image of the region of interest.
[0106] S32, weighting the grayscale histogram and the restricted histogram of the region of interest to obtain a modified restricted histogram. Specifically, according to the formula Weighted processing, H w represents the modified restricted histogram, H r represents the restricted histogram of the region of interest, H u Represents the grayscale histogram, w represents the correction weight parameter, which can be set to 0.25.
[0107] S4. Search the grayscale histogram and the modified limit histogram to obtain a stretching start point, a stretching anchor point and a stretching end point.
[0108] In this embodiment, step S4 specifically includes:
[0109] S41, finding the left and right endpoints of the grayscale histogram as the stretching start point and the stretching end point respectively. Figure 2 As shown, the minimum and maximum values of the grayscale histogram abscissa correspond to the stretching starting point p s and the stretching end point p e .
[0110] S42, filtering and normalizing the modified limit histogram in sequence. In this embodiment, the filtering process is a one-dimensional mean filtering process, and the filter kernel width used is 11. A smooth modified limit histogram can be obtained by filtering. The maximum value of the modified limit histogram after filtering is calculated, and normalized by the maximum value to obtain the modified limit histogram after normalization.
[0111] S43, obtaining the position corresponding to the maximum value of the normalized modified limit histogram.
[0112] S44, searching according to the position corresponding to the maximum value and the preset threshold to obtain the stretching anchor point. The preset threshold is Tr a , can be set to 0.27. Figure 3 As shown, search from the position corresponding to the maximum value to the preset threshold Tr on the left a The corresponding horizontal coordinate is marked as the stretching anchor point p a .
[0113] S5. Automatically generate a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point.
[0114] In this embodiment, step S5 specifically includes:
[0115] According to the formula Automatically generate stretching curve, where k a is a constant, which can be set to 5; p s Indicates the stretching starting point, y s Indicates the gray value after stretching from the starting point of the stretch, p e Indicates the end point of stretching, y e Indicates the gray value after stretching at the stretching end point, p a Indicates the stretch anchor point, p l represents the connection point between the left transition segment and the middle linear segment, p r represents the connection point between the right transition segment and the middle linear segment, w l Indicates the width of the left transition section, h l Indicates the height of the left transition section, w r Indicates the width of the right transition section, h r Indicates the height of the right transition section;
[0116] According to the formula Calculate w l 、h l and p l , where p a Indicates the stretch anchor point, y a Represents the grayscale value of the stretched anchor point after stretching, Tr l Represents a constant, which can be set to 0.95 and is used to control p l location;
[0117] According to the formula Calculate w r 、h r and p r , where Trr is a constant, which can be set to 0.95 and is used to control p r location.
[0118] In this embodiment, the Gamma function is used for the transition sections at both the left and right ends, in the form of Y=A·X γ +B. For the left transition section, A = h l ,B=y s , X=(xp s ) / w l ,Y=y,γ=k a ·w l / h l ; For the right transition section, A = -h r ,B=y e , X=(p e -x) / w r ,Y=y,γ=k a ·w r / h r Through the Gamma function transformation, the transition between the middle linear enhancement part and the left and right ends, i.e. the tissue and the background, is natural.
[0119] S6, stretching the X-ray image to be processed according to the stretching curve. Figure 4 As shown in FIG. 1 , the obtained stretching curve is obtained. For the X-ray image, the gray value x is searched point by point to obtain the gray value y after stretching. After completing the search of all pixel points, the image stretching processing can be realized.
[0120] Embodiment 2
[0121] Please refer to Figure 5 , Embodiment 2 of the present invention is:
[0122] An intelligent automatic stretching terminal 100 for X-ray images, corresponding to the method of the first embodiment, comprises a memory 1, a processor 2, and a computer program stored in the memory 1 and executable on the processor 2. When the processor 2 executes the computer program, the following steps are implemented:
[0123] Obtaining a grayscale histogram of the X-ray image to be processed;
[0124] Calculating a binary mask image of a region of interest of the X-ray image to be processed;
[0125] Calculating a modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest;
[0126] Searching the grayscale histogram and the modified limit histogram to obtain a stretching start point, a stretching anchor point, and a stretching end point;
[0127] Automatically generate a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point;
[0128] The X-ray image to be processed is stretched according to the stretching curve.
[0129] Furthermore, the step of calculating a binary mask image of the region of interest of the X-ray image to be processed specifically includes:
[0130] Performing square root compression processing on the original image of the to-be-processed X-ray image that has not been enhanced, to obtain a square root compressed image;
[0131] Performing pyramid decomposition on the square root compressed image to obtain a decomposed image;
[0132] Calculate the standard deviation coefficient of any pixel point in any layer of the decomposed image;
[0133] Calculate the contrast-to-noise ratio of any pixel point according to the standard deviation coefficient;
[0134] The area where the pixel points whose contrast-to-noise ratio is within a preset threshold range are located is intercepted as the area of interest;
[0135] The pixel values of the pixels in the region of interest are set to 1, and the pixel values of the pixels not in the region of interest are set to 0, to obtain a binary mask image of any layer;
[0136] The binary mask image of any layer is enlarged to the size of the X-ray image to be processed to obtain a binary mask image of the region of interest.
[0137] Furthermore, the step of calculating the modified restricted histogram based on the grayscale histogram and the binary mask image of the region of interest specifically includes:
[0138] Calculating a restricted histogram of the region of interest according to the binary mask image of the region of interest;
[0139] The grayscale histogram and the region of interest limit histogram are weighted to obtain a modified limit histogram.
[0140] Further, the grayscale histogram and the modified limit histogram are searched to obtain the stretching starting point, the stretching anchor point and the stretching end point, which specifically includes:
[0141] Find the left and right endpoints of the grayscale histogram as the stretching start point and the stretching end point respectively;
[0142] performing filtering and normalization processing on the modified limit histogram in sequence;
[0143] Obtain the position corresponding to the maximum value of the normalized corrected limit histogram;
[0144] The stretching anchor point is obtained by searching according to the position corresponding to the maximum value and a preset threshold.
[0145] Furthermore, the automatically generating a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point specifically includes:
[0146] According to the formula Automatically generate stretching curve, where k a is a constant, p s Indicates the stretching starting point, y s Indicates the gray value after stretching from the starting point of the stretch, p e Indicates the end point of stretching, y e Indicates the gray value after stretching at the stretching end point, p a Indicates the stretch anchor point, p l represents the connection point between the left transition segment and the middle linear segment, p r represents the connection point between the right transition segment and the middle linear segment, w l Indicates the width of the left transition section, h l Indicates the height of the left transition section, w r Indicates the width of the right transition section, h r Indicates the height of the right transition section;
[0147] According to the formula Calculate w l 、h l and p l , where p a Indicates the stretch anchor point, y a Represents the grayscale value of the stretched anchor point after stretching, Tr l represents a constant;
[0148] According to the formula Calculate w r 、h r and p r , where Tr r Represents a constant.
[0149] In summary, the intelligent automatic stretching method and terminal of X-ray images provided by the present invention can automatically generate an adaptive stretching curve to stretch the image, enhance the contrast of the area of interest, and provide a clearer and more natural image display effect.
[0150] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. An intelligent automatic stretching method for X-ray images, It is characterized in that include: Obtaining a grayscale histogram of the X-ray image to be processed; Calculating a binary mask image of a region of interest of the X-ray image to be processed; Calculating a modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest; Searching the grayscale histogram and the modified limit histogram to obtain a stretching start point, a stretching anchor point, and a stretching end point; Automatically generate a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point; Performing stretching processing on the X-ray image to be processed according to the stretching curve; The step of calculating the binary mask image of the region of interest of the to-be-processed X-ray image specifically includes: Performing square root compression processing on the original image of the to-be-processed X-ray image that has not been enhanced, to obtain a square root compressed image; Performing pyramid decomposition on the square root compressed image to obtain a decomposed image; Calculate the standard deviation coefficient of any pixel point in any layer of the decomposed image; Calculate the contrast-to-noise ratio of any pixel point according to the standard deviation coefficient; The area where the pixel points whose contrast-to-noise ratio is within a preset threshold range are located is intercepted as the area of interest; The step of calculating the modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest specifically includes: Calculating a restricted histogram of the region of interest according to the binary mask image of the region of interest; Performing weighted processing on the grayscale histogram and the region of interest limit histogram to obtain a modified limit histogram; The step of searching the grayscale histogram and the modified limit histogram to obtain the stretching starting point, the stretching anchor point and the stretching end point specifically includes: Find the left and right endpoints of the grayscale histogram as the stretching start point and the stretching end point respectively; performing filtering and normalization processing on the modified limit histogram in sequence; Obtain the position corresponding to the maximum value of the normalized corrected limit histogram; The stretching anchor point is obtained by searching according to the position corresponding to the maximum value and a preset threshold.
2. The intelligent automatic stretching method for X-ray images according to claim 1, It is characterized in that The step of calculating the binary mask image of the region of interest of the X-ray image to be processed specifically includes: The pixel values of the pixels in the region of interest are set to 1, and the pixel values of the pixels not in the region of interest are set to 0, to obtain a binary mask image of any layer; The binary mask image of any layer is enlarged to the size of the X-ray image to be processed to obtain a binary mask image of the region of interest.
3. The intelligent automatic stretching method for X-ray images according to claim 1, It is characterized in that The automatically generating a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point specifically includes: According to the formula Automatically generate stretching curve, where k a is a constant, p s Indicates the stretching starting point, y s Indicates the gray value after stretching from the starting point of the stretch, p e Indicates the end point of stretching, y e Indicates the gray value after stretching at the stretching end point, p a Indicates the stretch anchor point, p l represents the connection point between the left transition segment and the middle linear segment, p r represents the connection point between the right transition segment and the middle linear segment, w l Indicates the width of the left transition section, h l Indicates the height of the left transition section, w r Indicates the width of the right transition section, h r Indicates the height of the right transition section; According to the formula Calculate w l 、h l and p l , where p a Indicates the stretch anchor point, y a Represents the grayscale value of the stretched anchor point after stretching, Tr l represents a constant; According to the formula Calculate w r 、h r and p r , where Tr r Represents a constant.
4. An intelligent automatic stretching terminal for X-ray images, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the following steps are implemented: Obtaining a grayscale histogram of the X-ray image to be processed; Calculating a binary mask image of a region of interest of the X-ray image to be processed; Calculating a modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest; Searching the grayscale histogram and the modified limit histogram to obtain a stretching start point, a stretching anchor point, and a stretching end point; Automatically generate a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point; Performing stretching processing on the X-ray image to be processed according to the stretching curve; The step of calculating the binary mask image of the region of interest of the to-be-processed X-ray image specifically includes: Performing square root compression processing on the original image of the to-be-processed X-ray image that has not been enhanced, to obtain a square root compressed image; Performing pyramid decomposition on the square root compressed image to obtain a decomposed image; Calculate the standard deviation coefficient of any pixel point in any layer of the decomposed image; Calculate the contrast-to-noise ratio of any pixel point according to the standard deviation coefficient; The area where the pixel points whose contrast-to-noise ratio is within a preset threshold range are located is intercepted as the area of interest; The step of calculating the modified restricted histogram according to the grayscale histogram and the binary mask image of the region of interest specifically includes: Calculating a restricted histogram of the region of interest according to the binary mask image of the region of interest; Performing weighted processing on the grayscale histogram and the region of interest limit histogram to obtain a modified limit histogram; The step of searching the grayscale histogram and the modified limit histogram to obtain the stretching starting point, the stretching anchor point and the stretching end point specifically includes: Find the left and right endpoints of the grayscale histogram as the stretching start point and the stretching end point respectively; performing filtering and normalization processing on the modified limit histogram in sequence; Obtain the position corresponding to the maximum value of the normalized corrected limit histogram; The stretching anchor point is obtained by searching according to the position corresponding to the maximum value and a preset threshold.
5. The intelligent automatic stretching terminal for X-ray images according to claim 4, It is characterized in that The step of calculating the binary mask image of the region of interest of the to-be-processed X-ray image specifically includes: The pixel values of the pixels in the region of interest are set to 1, and the pixel values of the pixels not in the region of interest are set to 0, to obtain a binary mask image of any layer; The binary mask image of any layer is enlarged to the size of the X-ray image to be processed to obtain a binary mask image of the region of interest.
6. The intelligent automatic stretching terminal for X-ray images according to claim 4, It is characterized in that The automatically generating a stretching curve according to the stretching starting point, the stretching anchor point and the stretching end point specifically includes: According to the formula Automatically generate stretching curve, where k a is a constant, p s Indicates the stretching starting point, y s Indicates the gray value after stretching from the starting point of the stretch, p e Indicates the end point of stretching, y e Indicates the gray value after stretching at the stretching end point, p a Indicates the stretch anchor point, p l represents the connection point between the left transition segment and the middle linear segment, p r represents the connection point between the right transition segment and the middle linear segment, w l Indicates the width of the left transition section, h l Indicates the height of the left transition section, w r Indicates the width of the right transition section, h r Indicates the height of the right transition section; According to the formula Calculate w l 、h l and p l , where p a Indicates the stretch anchor point, y a Represents the grayscale value of the stretched anchor point after stretching, Tr l represents a constant; According to the formula Calculate w r 、h r and p r , where Tr r Represents a constant.
Citation Information
Patent Citations
Image enhancement method and apparatus
CN106780413A
X-ray image stretching method and computer readable storage medium
CN107578374A
Histogram equalization method and device, and terminal device
CN108447040A
Image diagnostic device and gradation information setting method
WO2015174206A1
