A magnetic resonance phantom rapid detection optimization method for edge computing

CN122887918APending Publication Date: 2026-10-09SILKWORM COCOON RES GROUP CHINESE INST OF TEST TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611382738.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-08
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0004]然而,在现场即时检测需求下,上述专利的模体边缘检测算法直接移植至边缘设备时算力开销较大,而现有边缘加速技术主要适配于图像重建、病灶检测等环节,尚无面向模体边缘检测的专用轻量化方案,难以在边缘设备资源受限条件下兼顾检测精度与处理速度

Benefits of technology

[0043]本发明通过将模体内部高信号区域的质心作为参考极点,并在极坐标系下沿自适应等分角度生成径向射线,结合一阶前向差分定位候选边缘点,再以邻域灰度对比度阈值剔除伪边缘,有效降低了背景噪声和内部信号不均匀对粗定位的干扰,且采用局部窗口内灰度梯度加权矩解算亚像素级坐标,并引入基于径向剖面梯度方向角的一致性校验,在保留真实边缘过渡带信息的同时抑制了孤立噪声引起的偏移,使得最终边缘坐标的重复定位精度得到提升;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122887918A_ABST
    Figure CN122887918A_ABST
Patent Text Reader

Abstract

The application discloses a kind of edge computing-oriented magnetic resonance phantom fast detection optimization method, it is related to magnetic resonance equipment metrology calibration and quality control field, including: obtaining the image of the magnetic resonance phantom to be measured, according to the preset gray scale proportion threshold value extraction pixel set and calculate the centroid of the pixel set, the centroid obtained is recorded as phantom internal reference point;With phantom internal reference point as pole point, establish polar coordinate system, generate a group of radial rays from pole point to image boundary along equal angle division;The present application is positioned by polar coordinate ray difference, contrast eliminates false edge, weighted matrix subpixel fine-tuning and consistency check, suppress the interference of noise and signal uneven, effectively improve edge positioning accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of metrology, calibration and quality control technology for magnetic resonance equipment, specifically to a rapid detection and optimization method for magnetic resonance phantoms oriented towards edge computing. Background Technology

[0002] Magnetic resonance phantoms are standard testing tools used for quality control and performance evaluation of magnetic resonance imaging (MRI) equipment. Images acquired by scanning phantoms can be used to quantitatively analyze key indicators such as signal-to-noise ratio, image uniformity, spatial resolution, density resolution, and geometric distortion. Edge detection of phantom images is a fundamental step in extracting these parameters, and its accuracy directly affects the reliability of subsequent quantitative analysis. Existing phantom detection methods mostly employ improved edge detection operators. These algorithms typically run on high-performance computing platforms, performing image processing and parameter calculation offline.

[0003] A Chinese invention patent application with application number 201811557991.8, published on March 12, 2019, discloses an edge detection method for a magnetic resonance standard water model. The application aims to enhance the spatial domain using the Sigmoid function, extract edges using the adaptive Canny algorithm, and combine area sorting with a convolutional neural network for edge classification and optimization.

[0004] However, when the phantom edge detection algorithm of the above patent is directly ported to edge devices under the requirement of on-site real-time detection, the computational cost is large. Existing edge acceleration technology is mainly adapted to image reconstruction, lesion detection and other processes. There is no dedicated lightweight solution for phantom edge detection, and it is difficult to balance detection accuracy and processing speed under the condition of limited edge device resources.

[0005] To address this, we propose a fast detection optimization method for magnetic resonance phantoms oriented towards edge computing. Summary of the Invention

[0006] In view of the above-mentioned shortcomings of the existing technology, the present invention provides a fast detection and optimization method for magnetic resonance phantoms oriented towards edge computing, which can effectively solve the problems of the existing technology.

[0007] To achieve the above objectives, the present invention is implemented through the following technical solutions;

[0008] This invention discloses a fast detection and optimization method for magnetic resonance phantoms oriented towards edge computing, comprising:

[0009] Acquire an image of the magnetic resonance phantom to be tested. Extract a pixel set according to a preset grayscale ratio threshold and calculate the centroid of the pixel set. Record the obtained centroid as the internal reference point of the phantom. Establish a polar coordinate system with the internal reference point of the phantom as the pole. Generate a set of radial rays extending from the pole to the image boundary along equally divided angles. For each radial ray, extract a grayscale sequence along the ray direction with a fixed step size. Calculate the first-order forward difference of the sequence and record the integer index corresponding to the maximum absolute value of the difference. Use this index position as the candidate edge point of the ray. Transfer the candidate edge points of all rays from the polar coordinate system... Convert to Cartesian coordinates and calculate the mean gray value of the inner and outer neighborhoods of each point along the ray direction. If the absolute value of the difference between the two is lower than the preset contrast threshold, the candidate edge point is removed. For each edge point retained after removal, extract a local window of the original image centered on its integer coordinates. Calculate the sub-pixel level edge coordinates based on the weighted moment of the pixel gray value and spatial coordinates within the window. Connect all sub-pixel level edge coordinates in polar angle order to form an initial closed polygon. Perform smooth fitting processing on this polygon to output the edge contour of the magnetic resonance phantom.

[0010] Furthermore, in the step of extracting the pixel set according to a preset grayscale ratio threshold, the maximum grayscale value of the magnetic resonance phantom image to be tested is obtained. , grayscale values ​​greater than All pixels are assigned to the pixel set, where The preset grayscale ratio threshold, The value range is [0.3, 0.5];

[0011] When calculating the centroid of the pixel set, the gray value of each pixel in the pixel set is used as the weight, and the weighted average of the row coordinates and the weighted average of the column coordinates of each pixel are calculated. These are used as the row coordinates and column coordinates of the centroid, respectively, and the resulting centroid is recorded as the internal reference point of the model.

[0012] Furthermore, when generating a set of radial rays extending from the pole to the image boundary along equally divided angles, the angle step size is first determined. ,in, The maximum Euclidean distance from each pixel in the pixel set to the reference point inside the module;

[0013] Within the interval [0, 2π) The radial rays are generated in equal parts.

[0014] Furthermore, when extracting the grayscale sequence along the ray direction with a fixed step size and calculating the first-order forward difference of the sequence, starting from the pole, the sampling point coordinates are determined point by point along the ray direction with a unit pixel length as the sampling step size. For each sampling point, bilinear interpolation is performed on the image of the magnetic resonance phantom to be tested according to its coordinates to obtain the grayscale value of the sampling point.

[0015] Sampling stops when the sampling point exceeds the image boundary, and the gray values ​​of each acquired sampling point are used to form the gray value sequence in the sampling order.

[0016] The difference between the i-th gray value and the (i+1)-th gray value in the gray-scale sequence is calculated, and this difference is used as the first-order forward difference at the i-th position. The difference sequence is formed by all the first-order forward differences.

[0017] Furthermore, in the stage of calculating the average gray value of the inner and outer neighborhoods of each point along the ray direction, starting from the candidate edge point, M sampling points are taken along the ray direction towards the pole side and away from the pole side, and the average gray value of each sampling point on each side is calculated. The average gray level of each sampling point on the other side ;

[0018] The preset contrast threshold is set to , The grayscale gradient amplitude standard deviation represents the entire image of the magnetic resonance phantom to be tested, and k represents the preset scaling factor;

[0019] in, , This represents the average magnitude of the grayscale gradient.

[0020] Furthermore, the operation of calculating sub-pixel level edge coordinates based on the weighted moment of pixel grayscale values ​​and spatial coordinates within the window follows the following rules:

[0021] Using the integer coordinates of the candidate edge points as... Centered on a square local window with side length L, , where R is the Euclidean distance from the candidate edge point to the reference point inside the phantom, and ⌈⋅⌉ indicates rounding up;

[0022] Calculate the grayscale gradient vector of each pixel within the window. ;

[0023] Calculate the unit radial vector d from the reference point inside the phantom to the candidate edge point, and rotate d counterclockwise. The resulting unit tangential vector t;

[0024] Calculate the sub-pixel offset along the radial direction. Ω is the set of all pixels within the local window. Let be the radial coordinate value of pixel i in the local coordinate system with the d direction as the positive direction, and let the weight be... , The regularization parameter is set to 1 / 10 of the squared mean of the gradient magnitudes of each pixel within the local window.

[0025] Finally, the sub-pixel level edge coordinates were determined as follows: .

[0026] Furthermore, after calculating the sub-pixel-level edge coordinates based on the weighted moments of the pixel grayscale values ​​and spatial coordinates within the window, the process also includes performing parameter consistency checks on these sub-pixel-level edge coordinates.

[0027] Using the reference point inside the mold as the center, calculate the radial grayscale profile gradient direction angle at the sub-pixel level edge coordinate. If the deviation between the gradient direction angle and the radial direction angle determined by the line connecting the sub-pixel level edge coordinate and the reference point inside the mold exceeds a preset angle tolerance threshold, then re-perform the weighted moment calculation on the radial grayscale profile with the sub-pixel level edge coordinate as the center, and reduce the side length of the local window to 2 / 3 of the original side length and round it up to an odd number.

[0028] Furthermore, before connecting all sub-pixel-level edge coordinates in polar angle order to form the initial closed polygon, for each sorted sub-pixel-level edge coordinate... Choose the previous sub-pixel level edge coordinate as The next sub-pixel level edge coordinates are ;

[0029] Calculation by point to The first vector and by point to The second vector ;

[0030] but and The absolute value of the supplementary angle of the included angle ;like If the angle exceeds the preset tolerance, then... Replace the coordinates with and The coordinates of the midpoint of the line.

[0031] Furthermore, before performing smoothing fitting, a confidence assessment is performed on the initial closed polygon:

[0032] N evaluation points are uniformly sampled at equal arc length intervals on the initial closed polygon, where N is an odd number and N≥15;

[0033] For each evaluation point, offset by twice the fixed step size outward and inward along the outer normal direction of the contour where the point is located to obtain the outer sampling point and the inner sampling point. Calculate the absolute value of the gray level difference between the two points as the local gray level contrast.

[0034] Calculate the mean and standard deviation of the local grayscale contrast of all evaluation points, and use the ratio of the two as the detection confidence index.

[0035] If the detection confidence index is less than the preset confidence threshold, the preset grayscale ratio threshold τ is reduced by 0.05, and the steps from extracting the pixel set to forming the initial closed polygon are re-executed with the reduced τ.

[0036] If the detection confidence index is greater than or equal to the preset confidence threshold, then the smoothing fitting process continues.

[0037] Furthermore, the smoothing fitting process includes:

[0038] Using the reference point inside the mold as the center of the ellipse, a constrained least-squares ellipse fitting is performed on the vertex set of the initial closed polygon. The constraint condition is that the center of the fitted ellipse is fixed at the reference point inside the mold, obtaining the semi-major axis a, semi-minor axis b, and rotation angle. ;

[0039] Constructing elliptic basis functions Then calculate the deviation between the radial distance of each vertex and the elliptic basis function. The deviation sequence is then denoted as For the bias sequence The bias function is obtained by performing a finite-order Fourier series fitting using the least squares method. ;

[0040] In the formula: θ is the polar angle, consistent with the polar angle in the polar coordinate system; M is the order, taking the value of N is the total number of vertices of the initial closed polygon, and ⌊⋅⌋ represents rounding down;

[0041] Depend on The smoothed polar coordinate profile is determined and sampled and converted into Cartesian coordinates to form the edge profile of the magnetic resonance phantom.

[0042] Compared with the known prior art, the technical solution provided by this invention has the following beneficial effects:

[0043] This invention uses the centroid of the high-signal region inside the phantom as the reference pole and generates radial rays along adaptively divided angles in polar coordinates. It combines first-order forward differential positioning of candidate edge points and then uses a neighborhood grayscale contrast threshold to remove false edges. This effectively reduces the interference of background noise and internal signal inhomogeneity on coarse positioning. Furthermore, it uses the grayscale gradient weighted moment within a local window to solve sub-pixel level coordinates and introduces consistency verification based on the radial profile gradient direction angle. While preserving the information of the real edge transition zone, it suppresses the offset caused by isolated noise, thereby improving the repeatability accuracy of the final edge coordinates.

[0044] To address the anomaly of excessively large abrupt changes in the direction of adjacent candidate points, the midpoint of the line connecting the preceding and following points is used for replacement, thus avoiding the pulling effect of contour spikes on subsequent fitting. The confidence evaluation mechanism uses statistical tests to determine whether the current contour is significantly better than random noise. If it does not meet the requirements, the threshold is adaptively called back for re-detection, thereby enhancing the robustness of the algorithm on images with different signal-to-noise ratios.

[0045] Finally, the smooth contour is fitted by superimposing finite-order Fourier series on elliptical basis functions. This method maintains the constraints of the overall geometric shape of the model while allowing reasonable local deformation at the edges. Furthermore, the fitting order is dynamically truncated based on the number of vertices and computing resources, enabling the method to balance detection accuracy and processing time on edge computing devices. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0047] Figure 1 This is a flowchart illustrating a fast detection and optimization method for magnetic resonance phantoms oriented towards edge computing.

[0048] Figure 2 This is a schematic diagram illustrating an example of polar coordinate radial ray scanning and coarse positioning of candidate edge points in this invention;

[0049] Figure 3 This is a schematic diagram illustrating an example of single radial ray grayscale sequence and first-order difference candidate edge localization in this invention. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0051] The present invention will be further described below with reference to embodiments.

[0052] Example 1:

[0053] This embodiment presents an optimization method for rapid detection of magnetic resonance phantoms based on edge computing, such as... Figure 1 As shown, it includes:

[0054] Acquire an image of the magnetic resonance phantom to be tested, extract a pixel set according to a preset grayscale ratio threshold and calculate the centroid of the pixel set, and record the obtained centroid as the internal reference point of the phantom;

[0055] In the pixel set extraction stage based on a preset grayscale ratio threshold, the maximum grayscale value of the magnetic resonance phantom image to be tested is obtained. , grayscale values ​​greater than All pixels are assigned to the pixel set, where To preset the grayscale ratio threshold, The value range is [0.3, 0.5];

[0056] When calculating the centroid of a pixel set, the gray value of each pixel in the pixel set is used as the weight. The weighted average of the row coordinates and the weighted average of the column coordinates of each pixel are calculated and used as the row coordinates and column coordinates of the centroid, respectively. The resulting centroid is recorded as the reference point inside the model.

[0057] Among them, the coordinates of the centroid are marked , , For pixels The grayscale value, S is in pixels;

[0058] The above set of equations distinguishes the signal strength of regions based on the difference in gray level of pixels in the high gray level area of ​​the phantom. Gray level is used as a weight to be superimposed on the pixel coordinates to obtain the mean value, thereby locking the phantom center reference point that is not affected by background noise. Unlike the ordinary equal weight centroid algorithm, it can accurately locate and stabilize the internal reference pole when the image signal-to-noise ratio is low and the internal signal distribution is uneven, providing a reliable coordinate origin for subsequent radial ray construction.

[0059] The image of the magnetic resonance phantom under test is a digital grayscale image of the magnetic resonance phantom under test that has been reconstructed by the magnetic resonance imaging system and transmitted to the edge computing device.

[0060] When the signal-to-noise ratio of the magnetic resonance phantom image under test is low or the signal inside the phantom is non-uniform. Take the larger value within the range; when the signal-to-noise ratio is high and the signal inside the phantom is uniform, Take the smaller value within the range;

[0061] Before extracting the pixel set according to the preset grayscale ratio threshold, a 10×10 pixel square window is taken from each of the four corner regions of the image of the magnetic resonance phantom to be tested. The average and standard deviation of the pixel grayscale values ​​in the four windows are calculated. The ratio of twice the average value to the standard deviation is used as the estimated value of the image signal-to-noise ratio. ;

[0062] when When ≥30s, Take 0.3; when 20S≤ <30 seconds, Take 0.4; when <20:00, Take 0.5;

[0063] If the phantom region occupies most of the image and the phantom signal still exists in the four corner windows, then the average gray value of the 5% of pixels with the lowest gray value in the gray-level histogram of the entire image is used as the background noise estimate, and the maximum gray value of the entire image minus the background noise estimate is used as the signal estimate. The ratio of the two is used as the signal-to-noise ratio estimate.

[0064] It should be noted that in magnetic resonance phantom images, the liquid or gel regions inside the phantom exhibit high signals, and their gray values ​​are usually located in the upper middle part of the image dynamic range. Selecting 30% to 50% of the maximum gray value as a threshold can stably separate the phantom region from the low-signal background or noise region, avoiding omissions or misselections.

[0065] A polar coordinate system is established with the reference point inside the phantom as the pole, and a set of radial rays extending from the pole to the image boundary are generated along equally divided angles.

[0066] When generating a set of radial rays extending from the pole to the image boundary along equally divided angles, first determine the angle step size. ,in, This represents the maximum Euclidean distance from each pixel in the pixel set to the reference point inside the model.

[0067] The above formula constrains the ray sampling interval based on the distance from the farthest pixel of the phantom to the central reference point. It sets the equally divided angle by using the geometric chord length relationship to ensure that the spatial distance between all radial ray sampling points is uniform, and there will be no problem of local sampling being too dense or too sparse. It eliminates the need for repeated manual adjustment of angle parameters, and adaptively adapts to magnetic resonance phantoms of different sizes, effectively reducing the parameter iteration overhead of edge computing devices.

[0068] Within the interval [0, 2π) Equal division to generate radial rays;

[0069] For each radial ray, extract the grayscale sequence along the ray direction with a fixed step size, calculate the first-order forward difference of the sequence, record the integer index corresponding to the maximum absolute value of the difference, and use the index position as the candidate edge point of the ray;

[0070] The grayscale sequence is extracted along the ray direction with a fixed step size. When calculating the first-order forward difference of the sequence, starting from the pole, the sampling step size is the unit pixel length. The coordinates of the sampling points are determined point by point along the ray direction. For each sampling point, bilinear interpolation is performed on the image of the magnetic resonance phantom to be tested according to its coordinates to obtain the grayscale value of the sampling point.

[0071] Sampling stops when the sampling point exceeds the image boundary, and the gray values ​​of each acquired sampling point are arranged in the sampling order to form a gray value sequence.

[0072] Calculate the difference between the i-th gray value and the (i+1)-th gray value in the gray-scale sequence, and use this difference as the first-order forward difference at the i-th position. The difference sequence is formed by all the first-order forward differences.

[0073] The bilinear interpolation operation involves interpolating the gray values ​​of the four pixels surrounding the sampling point first in the horizontal direction and then in the vertical direction to finally obtain the gray value of the sampling point.

[0074] Convert all candidate edge points of the rays from polar coordinates to Cartesian coordinates, and calculate the mean gray value of the inner neighborhood and the mean gray value of the outer neighborhood of each point along the ray direction. If the absolute value of the difference between the two is lower than the preset contrast threshold, the candidate edge point is removed.

[0075] To calculate the mean gray level of the inner and outer neighborhoods of each point along the ray direction, starting from the candidate edge point, take M sampling points along the ray direction towards the pole and away from the pole, and calculate the mean gray level of each sampling point on each side. The average gray level of each sampling point on the other side ;

[0076] Preset contrast threshold set to , The grayscale gradient amplitude standard deviation represents the entire image of the magnetic resonance phantom to be tested, and k represents the preset scaling factor;

[0077] in, , This represents the average magnitude of the grayscale gradient. This is denoted as the gray-level gradient magnitude variation coefficient, serving as an indirect measure of image signal-to-noise ratio (SNR). A smaller coefficient indicates a more consistent gradient field and a higher SNR. Therefore, based on... The signal-to-noise ratio (SNR) interval is segmented into k segments, and the segmented functions from top to bottom correspond to high, medium, and low SNR scenarios, respectively.

[0078] The gray-level gradient magnitude is calculated using the Sobel operator, which calculates the gradient components of each pixel in the image in the horizontal and vertical directions. and The gray-scale gradient magnitude is defined as ;

[0079] The Sobel operator uses a standard 3×3 kernel, with the horizontal kernel being:

[0080] ;

[0081] The vertical convolution kernel is:

[0082] ;

[0083] After calculating the grayscale gradient magnitude pixel by pixel for the entire image, the arithmetic mean of the gradient magnitudes of all pixels is taken as the result. Calculate the sample standard deviation of the gradient magnitude of all pixels as... ;

[0084] If the gradient cannot be calculated at the image boundary due to the convolution operation, the gradient magnitude of the pixels extending one ring outward from the boundary is set to zero and not included in the statistics.

[0085] The above piecewise function distinguishes high, medium and low signal-to-noise ratio imaging scenarios based on the image gray-level gradient variation coefficient. It matches the gradient threshold amplification coefficient piecewise. When the gradient distribution is more chaotic and the noise is more significant, a larger coefficient is selected to raise the rejection standard. It can automatically adapt to images of different imaging quality to screen effective candidate edge points. Unlike the existing fixed single threshold mode, it ensures the edge preservation of clean images and the filtering of false edges in noisy images.

[0086] M is an integer in the range [3, 7], determined based on the signal-to-noise ratio (SNR) of the magnetic resonance phantom image to be tested. The lower the SNR, the larger the value of M. (In specific implementation, the value of M can be: the SNR estimate calculated before extracting the pixel set based on a preset grayscale ratio threshold.) Confirmed, when When M is ≥40, M is 3; when 30≤ When 20 < 40, MM takes the value of 4; when 20 ≤ When M < 30, take 5; when 10 ≤ When <20, M is 6; when When M is less than 10, M is 7; if the aforementioned signal-to-noise ratio estimation method cannot be applied due to the special characteristics of the phantom image, then M is 5 by default to enhance the robustness of the neighborhood mean estimation. The lower limit of 3 is used to ensure that the single-sided sampling points form a statistically effective estimate to suppress the influence of isolated noise, and the upper limit of 7 is used to avoid the sampling window from being overextended to a uniform area far from the edge and introducing grayscale information that is unrelated to the edge.

[0087] When converting all candidate edge points of all rays from polar coordinates to Cartesian coordinates, the polar radius of each candidate edge point is calculated based on the polar angle θ of each ray and the integer index i corresponding to the candidate edge point. ,in For the actual physical length corresponding to the fixed step size, based on the transformation method Find the coordinates (x, y) of the candidate edge point in the Cartesian coordinate system. The coordinates of the reference point inside the model in the Cartesian coordinate system;

[0088] For each edge point retained after removal, a local window of the original image is extracted with its integer coordinates as the center. The sub-pixel level edge coordinates are calculated based on the weighted moment of the pixel gray value and spatial coordinates within the window.

[0089] Based on the weighted moment calculation of pixel grayscale values ​​and spatial coordinates within the window, the operation for obtaining sub-pixel level edge coordinates follows the following rules:

[0090] Using the integer coordinates of the candidate edge points as... Centered on a square local window with side length L, , where R is the Euclidean distance from the candidate edge point to the reference point inside the model, and ⌈⋅⌉ indicates rounding up;

[0091] Calculate the grayscale gradient vector of each pixel within the window. ;

[0092] Calculate the unit radial vector d from the reference point inside the phantom to the candidate edge point (denoted as d, where the coordinates of the reference point inside the phantom are d, d is the coordinates of the reference point inside the phantom). Calculate the direction vector from the reference point to the candidate edge point. Take the unit vector of this direction vector as the unit radial vector d), and rotate d counterclockwise. The resulting unit tangential vector t (with the components of d denoted as...) ,but );

[0093] Calculate the sub-pixel offset along the radial direction. Ω represents the set of all pixels within the local window. Let be the radial coordinate value of pixel i in the local coordinate system with the d direction as the positive direction, and let the weight be... , The regularization parameter is set to 1 / 10 of the mean squared gradient magnitude of each pixel within the local window. This is used to prevent the denominator from being zero and to adaptively match the local image structure. At the same time, the regularization intensity is kept lower than the average gradient energy within the window to maintain the sensitivity of the weights to the edge normal.

[0094] The calculation method for the gradient magnitude of each pixel within the local window is the same as the calculation method for the gray-level gradient magnitude, both using the 3×3 Sobel operator;

[0095] Specifically, for each pixel within the local window Ω, the gradient magnitude of that pixel is calculated using the same Sobel convolution kernel as that used in calculating the grayscale gradient magnitude of the entire image. Then calculate the arithmetic mean of the squares of the gradient magnitudes of all pixels within the window. ;

[0096] The total number of pixels within the local window Ω, Take 1 / 10 of the arithmetic mean;

[0097] The above formula integrates the radial and tangential projection components of the pixel gradient to construct pixel weights. It also uses adaptive regularization parameters to avoid the failure of denominator calculation, amplifies the contribution ratio of gradient pixels in the vertical contour direction, weakens the interference of pixels along the contour tangent direction, and completes sub-pixel localization only by relying on local window pixel information. It does not require global image calculation, which meets the lightweight computing power requirements of edge computing.

[0098] In the sub-pixel offset calculation formula, the total edge offset reflected by the pixels in the window is uniformly quantified by integrating all weighted radial coordinate components within the window and performing normalized summation. High-precision offset solution is achieved based on a single local window with finite pixels, without relying on multi-scale image pyramid layer-by-layer calculation, thus minimizing the amount of memory reading and floating-point calculations required for edge devices.

[0099] Finally, the sub-pixel level edge coordinates were determined as follows: ;

[0100] After calculating the sub-pixel-level edge coordinates based on the weighted moments of the pixel grayscale values ​​and spatial coordinates within the window, the process also includes performing parameter consistency checks on these sub-pixel-level edge coordinates.

[0101] Using the reference point inside the mold as the center, calculate the radial grayscale profile gradient direction angle at the sub-pixel level edge coordinates. If the deviation between the gradient direction angle and the radial direction angle determined by the line connecting the sub-pixel level edge coordinates and the reference point inside the mold exceeds the preset angle tolerance threshold, then the weighted moment calculation is re-executed on the radial grayscale profile with the sub-pixel level edge coordinates as the center, and the side length of the local window is reduced to 2 / 3 of the original side length and rounded up to an odd number.

[0102] The radial grayscale profile gradient direction angle is the angle between the grayscale gradient vector at the sub-pixel level edge coordinate and the radial direction from the reference point inside the module to the sub-pixel level edge coordinate.

[0103] The preset angle tolerance threshold is set to 3 times the standard deviation of the gray-scale gradient direction angle of each pixel within the local window (based on the 3σ criterion).

[0104] Optionally, the specific value of the preset angle tolerance threshold is determined as follows: First, calculate the standard deviation of the grayscale gradient direction angle of each pixel within the local window. Then set the preset angle tolerance threshold to That is, take 3 times the standard deviation and The larger value in;

[0105] in The lower limit is used to prevent gradient directions from being highly uniform within the window. When the tolerance threshold is close to 0, the actual edge is misjudged as a false edge due to a small numerical calculation error.

[0106] If the deviation still exceeds the tolerance threshold after recalculating the weighted moments, the candidate edge point is discarded and not included in the subsequent initial closed polygon.

[0107] It should be noted that:

[0108] When the deviation exceeds the tolerance, it indicates that the current sub-pixel level edge coordinates may be located at a pseudo-edge caused by noise or local texture. Reducing the window size to 2 / 3 of the original side length can effectively eliminate interfering pixels far from the edge center, while retaining enough transition area information to ensure the stability of the weighted moment calculation.

[0109] Connect all sub-pixel level edge coordinates in polar angle order to form an initial closed polygon. Perform smooth fitting processing on the polygon to output the edge contour of the magnetic resonance phantom.

[0110] Before connecting all sub-pixel-level edge coordinates in polar angle order to form the initial closed polygon, each sorted sub-pixel-level edge coordinate... Choose the previous sub-pixel level edge coordinate as The next sub-pixel level edge coordinates are ;

[0111] Calculation by point to The first vector (Right now ), and by point to The second vector (Right now );

[0112] but and The absolute value of the supplementary angle of the included angle ;like If the angle exceeds the preset tolerance, then... Replace the coordinates with and The coordinates of the midpoint of the line connecting them;

[0113] The preset angle tolerance is set to the equal angle step size used when generating radial rays, so that only when the local direction change between adjacent edge points exceeds one ray sampling angle interval, the point is judged as abnormal and removed, thus avoiding misjudging the smooth deformation of the mold edge as interference.

[0114] Before performing smoothing fitting, a confidence assessment is performed on the initial closed polygon:

[0115] On the initial closed polygon, N evaluation points are uniformly sampled at equal arc length intervals, where N is an odd number and N≥15;

[0116] For each evaluation point, offset by twice the fixed step size outward and inward along the outer normal direction of the contour where the point is located to obtain the outer sampling point and the inner sampling point. Calculate the absolute value of the gray level difference between the two points as the local gray level contrast.

[0117] The edge transition band width of the magnetic resonance phantom image is usually 2 to 4 pixels. Offset by 2 pixels can make the outer sampling point located in the background area and the inner sampling point located in the phantom area, thus effectively reflecting the real gray level difference on both sides of the edge. The fixed step size is 1 pixel length, that is, offset 2 pixels outward along the outer normal direction to obtain the outer sampling point, and offset 2 pixels inward along the inner normal direction to obtain the inner sampling point. If the coordinates of the outer sampling point or the inner sampling point exceed the image boundary, the gray level value of the sampling point is set to the gray level value of the image boundary pixel closest to the point.

[0118] Calculate the mean and standard deviation of the local grayscale contrast of all evaluation points, and use the ratio of the two as the detection confidence index.

[0119] If the detection confidence index is less than the preset confidence threshold, the preset grayscale ratio threshold τ is reduced by 0.05, and the steps from extracting the pixel set to forming the initial closed polygon are re-executed with the reduced τ.

[0120] If the detection confidence index is greater than or equal to the preset confidence threshold, then continue to perform smooth fitting processing;

[0121] The reason why the number of evaluation points N is limited to an odd number and not less than 15 is that odd sampling can avoid redundant evaluation point pairs with overlapping diameters on the contour of the phantom which is approximately centrally symmetrical, thus ensuring the completeness of the directional coverage of the evaluation points. N≥15 can ensure that the degrees of freedom N−1≥14 in the subsequent t test, so that the pre-set reliability threshold has a stable critical value in a statistical sense.

[0122] The preset confidence threshold is set based on the one-sided t-test principle as the critical value at a significance level of 0.05 with N-1 degrees of freedom. Its physical meaning is: when the actual detection confidence index γ is lower than this threshold, there is a 95% statistical confidence to determine that the local gray-scale contrast of the current edge contour is not significantly higher than the random noise level, and the detection result is unreliable. In this way, the selection of the confidence threshold is directly related to the sampling scale and statistical inference, thereby eliminating the human experience setting.

[0123] Smoothing fitting processes include:

[0124] Using a reference point inside the phantom as the center of the ellipse, a constrained least-squares ellipse fitting is performed on the vertex set of the initial closed polygon. The constraint condition is that the center of the fitted ellipse is fixed at the reference point inside the phantom, obtaining the semi-major axis a, semi-minor axis b, and rotation angle. ;

[0125] Constructing elliptic basis functions Then calculate the deviation between the radial distance of each vertex and the elliptic basis functions. The deviation sequence is then denoted as For the bias sequence The bias function is obtained by performing a finite-order Fourier series fitting using the least squares method. ;

[0126] For the elliptical basis function, the constrained least squares solution is performed by fixing the centroid of the model as the ellipse fitting center. The polar radius curve of the standard reference profile is generated according to the ellipse geometric equation. This is used to quantify the radial difference between the actual profile vertex and the ideal ellipse boundary. The overall elliptical deformation component of the model is first stripped off, and then the local minor deviations are processed separately. The profile fitting task is decomposed to reduce the single-step computational complexity.

[0127] For the deviation function, the highest order of Fourier fitting is limited by the total number of contour vertices, and the upper limit of the eighth-order computing power is set to constrain the computation of trigonometric functions. By fitting the local deformation of the contour with low-frequency series and cutting off high-frequency noise fluctuations, it can not only fully restore the subtle concave and convex features of the non-standard ellipse of the model, but also avoid contour distortion caused by random noise in the image, effectively adapting to the computing power limitations of real-time detection of edge devices.

[0128] In the formula: θ is the polar angle, consistent with the polar angle in the polar coordinate system; M is the order, taking the value of N is the total number of vertices of the initial closed polygon, and ⌊⋅⌋ denotes rounding down;

[0129] Depend on Determine the smoothed polar coordinate profile and sample it to convert it into Cartesian coordinates to form the edge profile of the magnetic resonance phantom.

[0130] Wherein, the lower limit of the order M is determined by... With N data points, an excessively high fitting order can lead to overfitting, introducing measurement noise into the contour. Based on engineering practice of the Nyquist sampling theorem, the fitting order should not exceed 1 / 5 of the number of data points. This ensures an effective description of the deviation shape while avoiding excessive pursuit of high-frequency noise. Due to the limited computing resources of the edge computing device, high-order Fourier fitting involves a large number of trigonometric function operations. An excessively high order can cause the computation time of the smoothing fitting step to exceed the allowable range of real-time detection. By constraining the upper limit of the order to 8, a balance can be achieved between describing the local deformation of the phantom contour and maintaining computational lightweightness, while also satisfying the spatial frequency distribution characteristics of edge deviations of most clinical magnetic resonance phantoms.

[0131] In this embodiment, when the method is executed, it first locates the phantom region of the input digital grayscale image, extracts a set of high-signal pixels according to a predetermined ratio of the maximum grayscale value of the image (adaptively adjusted according to the signal-to-noise ratio between 0.3 and 0.5), and calculates a weighted centroid as the reference point inside the phantom with the grayscale value of each pixel as a weight. This effectively suppresses the center shift caused by background noise and signal inhomogeneity. After establishing a polar coordinate system with this point as the pole, the angle step size is calculated according to the maximum distance of the pixel from the reference point, and a radial ray covering the entire image is generated. Each ray is sampled and interpolated from the pole with a unit pixel step size to obtain a grayscale sequence. The first-order forward difference is calculated, and the position with the largest absolute value of the difference is recorded as the candidate edge point, quickly capturing all possible edge positions.

[0132] For the candidate points selected by coarse screening, the method takes the average gray value of the inner and outer neighborhoods along the ray direction, and only retains the points whose difference exceeds the dynamic contrast threshold. This threshold is determined by the gradient amplitude variation coefficient of the whole image in segments. The number of neighborhood sampling points is also adjusted between 3 and 7 with the signal-to-noise ratio, so that the screening criteria adaptively match the image quality, effectively eliminating false edges caused by noise. The retained integer-level edge points are used as the center to extract an adaptive window with side length. The radial component of the gradient vector in the window is used to construct weights. The sub-pixel offset is calculated by weighted moments, and then a consistency check is performed. If the deviation between the gradient direction and the radial direction exceeds 3 times the standard deviation of the gradient direction angle in the window, the window is shrunk and recalculated to ensure reliable positioning.

[0133] All sub-pixel points are connected in polar angle order to form an initial closed polygon. Abnormal points with local directional changes exceeding the angle step size are replaced and corrected. Then, evaluation points are sampled on the contour with equal arc length. The ratio of the mean to the standard deviation of the internal and external grayscale contrast is calculated as a confidence index. If it is lower than the statistical threshold set based on the t-test principle, the grayscale ratio threshold is automatically reduced and the above steps are repeated until the result meets the statistical significance requirements.

[0134] Finally, constrained least-squares ellipse fitting is performed on the vertex set with the reference point as the ellipse center to obtain the ideal ellipse basis function. Then, a low-order Fourier series fitting is performed on the deviation sequence of the actual radial distance relative to the ellipse. The order is automatically truncated according to the number of vertices and the edge computing power. The ellipse basis function and the Fourier deviation function are superimposed to generate a smooth polar coordinate contour. After being transformed to Cartesian coordinates, the complete phantom edge contour is output. The parameters of each step in the entire process are dynamically and adaptively adjusted according to the image quality, ensuring robustness of detection under low signal-to-noise ratio conditions while taking into account the lightweight and real-time requirements of edge computing scenarios.

[0135] See Figure 2 As shown in the figure, the rectangular border represents the image domain of the magnetic resonance phantom image to be tested; the centrally located near-elliptical closed curve is the cross-sectional contour of the magnetic resonance phantom; the black solid circle at the geometric center inside the contour is the internal reference point of the phantom obtained by extracting the pixel set according to the preset gray scale threshold and performing gray scale weighting calculation, i.e., the polar coordinate pole; several straight lines radiating uniformly outward from the pole are radial rays generated according to the equally divided angular step size, each ray traversing the phantom contour in a straight radial direction from the pole and extending to the image boundary; the black circle marked where each ray passes through the phantom contour is the candidate edge point obtained by performing the first-order forward difference of the gray scale sequence extracted along the direction with a fixed step size and taking the position with the maximum absolute value of the difference.

[0136] See Figure 3 As shown, the figure uses the pixel sampling index along the radial ray as the horizontal axis, the left vertical axis to represent the gray value of the sampling point, and the right vertical axis to correspond to the first-order forward difference of the gray value sequence. The continuous curve shows the complete gray value change of the ray. The gray value is maintained at a high level inside the phantom. After crossing the edge, the gray value drops rapidly and is superimposed with the random noise of magnetic resonance imaging. The bar sequence is the first-order difference result at the corresponding position. The index position with the largest absolute difference value is marked as the candidate edge point. The gray intervals in the figure mark the inner sampling area of ​​the candidate edge point facing the pole and the outer sampling area away from the pole, respectively. This is used to calculate the difference between the mean gray values ​​on both sides to filter out false edges in combination with the adaptive contrast threshold. Overall, it intuitively shows the core principle of the one-dimensional gray-level profile of a single radial ray in this embodiment and the coarse localization of edge candidate points by means of the first-order difference extremum. It reflects the advantages of this one-dimensional sampling detection method that does not require global two-dimensional traversal and is adapted to the lightweight computing power of edge devices. It clearly distinguishes the correspondence between image noise, gray-level change areas and candidate edge points.

[0137] In summary, the method in the above embodiments effectively reduces the interference of background noise and internal signal inhomogeneity on coarse localization by using the centroid of the high-signal region inside the phantom as the reference pole and generating radial rays along adaptively divided angles in polar coordinates. This is combined with first-order forward differential localization of candidate edge points, followed by the elimination of false edges using a neighborhood grayscale contrast threshold. Furthermore, the method employs a weighted moment calculation of grayscale gradients within a local window to solve sub-pixel-level coordinates and introduces a consistency check based on the radial profile gradient direction angle. This preserves the information of the true edge transition zone while suppressing the offset caused by isolated noise, thus improving the repetitive localization accuracy of the final edge coordinates. This also addresses the direction of adjacent candidate points. In cases of excessively large mutations, the midpoint of the line connecting the preceding and following points is used for replacement, avoiding the pulling effect of contour spikes on subsequent fitting. The confidence evaluation mechanism uses statistical tests to determine whether the current contour is significantly better than random noise. If not, the threshold is adaptively called back for re-detection, thereby enhancing the robustness of the algorithm on images with different signal-to-noise ratios. Finally, a smooth contour is fitted by superimposing elliptical basis functions with finite-order Fourier series, which maintains the constraints of the overall geometric shape of the model while allowing reasonable local deformation at the edges. Furthermore, the fitting order is dynamically truncated according to the number of vertices and computing resources, enabling the method to balance detection accuracy and processing time on edge computing devices.

[0138] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing, characterized in that, include: Acquire an image of the magnetic resonance phantom to be tested, extract a pixel set according to a preset grayscale ratio threshold and calculate the centroid of the pixel set, and record the obtained centroid as the internal reference point of the phantom; A polar coordinate system is established with the reference point inside the phantom as the pole, and a set of radial rays extending from the pole to the image boundary are generated along equally divided angles. For each radial ray, extract the grayscale sequence along the ray direction with a fixed step size, calculate the first-order forward difference of the sequence, record the integer index corresponding to the maximum absolute value of the difference, and use the index position as the candidate edge point of the ray; Convert all candidate edge points of the rays from polar coordinates to Cartesian coordinates, and calculate the mean gray value of the inner neighborhood and the mean gray value of the outer neighborhood of each point along the ray direction. If the absolute value of the difference between the two is lower than the preset contrast threshold, the candidate edge point is removed. For each edge point retained after removal, a local window of the original image is extracted with its integer coordinates as the center. The sub-pixel level edge coordinates are calculated based on the weighted moment of the pixel gray value and spatial coordinates within the window. Connect all sub-pixel level edge coordinates in polar angle order to form an initial closed polygon. Perform smooth fitting processing on the polygon to output the edge contour of the magnetic resonance phantom.

2. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 1, characterized in that, In the step of extracting the pixel set according to a preset grayscale ratio threshold, the maximum grayscale value of the magnetic resonance phantom image to be tested is obtained. , grayscale values ​​greater than All pixels are assigned to the pixel set, where The preset grayscale ratio threshold, The value range is [0.3, 0.5]; When calculating the centroid of the pixel set, the gray value of each pixel in the pixel set is used as the weight, and the weighted average of the row coordinates and the weighted average of the column coordinates of each pixel are calculated. These are used as the row coordinates and column coordinates of the centroid, respectively, and the resulting centroid is recorded as the internal reference point of the model.

3. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 1, characterized in that, When generating a set of radial rays extending from the pole to the image boundary along equally spaced angles, the angle step size is first determined. ,in, The maximum Euclidean distance from each pixel in the pixel set to the reference point inside the module; Within the interval [0, 2π) The radial rays are generated in equal parts.

4. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 1, characterized in that, When extracting the grayscale sequence along the ray direction with a fixed step size and calculating the first-order forward difference of the sequence, starting from the pole, the sampling step size is taken as the unit pixel length, and the coordinates of the sampling point are determined point by point along the ray direction. For each sampling point, bilinear interpolation is performed on the image of the magnetic resonance phantom to be tested according to its coordinates to obtain the grayscale value of the sampling point. Sampling stops when the sampling point exceeds the image boundary, and the gray values ​​of each acquired sampling point are used to form the gray value sequence in the sampling order. The difference between the i-th gray value and the (i+1)-th gray value in the gray-scale sequence is calculated, and this difference is used as the first-order forward difference at the i-th position. The difference sequence is formed by all the first-order forward differences.

5. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 1, characterized in that, In the stage of calculating the mean gray value of the inner and outer neighborhoods of each point along the ray direction, starting from the candidate edge point, M sampling points are taken along the ray direction towards the pole side and away from the pole side, and the mean gray value of each sampling point on each side is calculated. The average gray level of each sampling point on the other side ; The preset contrast threshold is set to , The grayscale gradient amplitude standard deviation represents the entire image of the magnetic resonance phantom to be tested, and k represents the preset scaling factor; in, , This represents the average magnitude of the grayscale gradient.

6. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 1, characterized in that, The weighted moment calculation based on pixel grayscale values ​​and spatial coordinates within the window, which yields sub-pixel level edge coordinates, follows the following operation: Using the integer coordinates of the candidate edge points as... Centered on a square local window with side length L, , where R is the Euclidean distance from the candidate edge point to the reference point inside the phantom, and ⌈⋅⌉ indicates rounding up; Calculate the grayscale gradient vector of each pixel within the window. ; Calculate the unit radial vector d from the reference point inside the phantom to the candidate edge point, and rotate d counterclockwise. The resulting unit tangential vector t; Calculate the sub-pixel offset along the radial direction. Ω is the set of all pixels within the local window. Let be the radial coordinate value of pixel i in the local coordinate system with the d direction as the positive direction, and let the weight be... , The regularization parameter is set to 1 / 10 of the squared mean of the gradient magnitudes of each pixel within the local window. Finally, the sub-pixel level edge coordinates were determined as follows: .

7. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 6, characterized in that, After calculating the sub-pixel-level edge coordinates based on the weighted moments of the pixel grayscale values ​​and spatial coordinates within the window, the process also includes performing parameter consistency checks on these sub-pixel-level edge coordinates. Using the reference point inside the mold as the center, calculate the radial grayscale profile gradient direction angle at the sub-pixel level edge coordinate. If the deviation between the gradient direction angle and the radial direction angle determined by the line connecting the sub-pixel level edge coordinate and the reference point inside the mold exceeds a preset angle tolerance threshold, then re-perform the weighted moment calculation on the radial grayscale profile with the sub-pixel level edge coordinate as the center, and reduce the side length of the local window to 2 / 3 of the original side length and round up to an odd number.

8. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 1, characterized in that, Before connecting all sub-pixel-level edge coordinates in polar angle order to form the initial closed polygon, each sorted sub-pixel-level edge coordinate... Choose the previous sub-pixel level edge coordinate as The next sub-pixel level edge coordinates are ; Calculation by point to The first vector and by point to The second vector ; but and The absolute value of the supplementary angle of the included angle ;like If the angle exceeds the preset tolerance, then... Replace the coordinates with and The coordinates of the midpoint of the line connecting them.

9. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 8, characterized in that, Before performing smoothing fitting, a confidence assessment is performed on the initial closed polygon: N evaluation points are uniformly sampled at equal arc length intervals on the initial closed polygon, where N is an odd number and N≥15; For each evaluation point, offset by twice the fixed step size outward and inward along the outer normal direction of the contour where the point is located to obtain the outer sampling point and the inner sampling point. Calculate the absolute value of the gray level difference between the two points as the local gray level contrast. Calculate the mean and standard deviation of the local grayscale contrast of all evaluation points, and use the ratio of the two as the detection confidence index. If the detection confidence index is less than the preset confidence threshold, the preset grayscale ratio threshold τ is reduced by 0.05, and the steps from extracting the pixel set to forming the initial closed polygon are re-executed with the reduced τ. If the detection confidence index is greater than or equal to the preset confidence threshold, then the smoothing fitting process continues.

10. The method for rapid detection and optimization of magnetic resonance phantoms oriented towards edge computing according to claim 1, characterized in that, The smoothing fitting process includes: Using the reference point inside the mold as the center of the ellipse, a constrained least-squares ellipse fitting is performed on the vertex set of the initial closed polygon. The constraint condition is that the center of the fitted ellipse is fixed at the reference point inside the mold, obtaining the semi-major axis a, semi-minor axis b, and rotation angle. ; Constructing elliptic basis functions Then calculate the deviation between the radial distance of each vertex and the elliptic basis function. The deviation sequence is then denoted as For the bias sequence The bias function is obtained by performing a finite-order Fourier series fitting using the least squares method. ; In the formula: θ is the polar angle, consistent with the polar angle in the polar coordinate system; M is the order, taking the value of N is the total number of vertices of the initial closed polygon, and ⌊⋅⌋ represents rounding down; Depend on The smoothed polar coordinate profile is determined and sampled and converted into Cartesian coordinates to form the edge profile of the magnetic resonance phantom.

Citation Information

Patent Citations

  • An edge detection method for magnetic resonance standard water phantoms

    CN109461163B