Background technology
In ultrasonoscopy forming process, when ultrasonic wavelength is suitable with irradiating object surfaceness, will produce speckle noise, this phenomenon can be explained with random scatter model.The existence of these noises, makes the sharpness of ultrasonoscopy not high, and this is also one of major defect of ultrasonic imaging.The distinctive speckle noise of ultrasonoscopy not only makes the second-rate of ultrasonoscopy, especially covers and reduce some detailed information of image, also makes to become more difficult to the identification of image detail and analysis.For later condition-inference and quantitative test, image characteristics extraction and identification cause adverse influence.Therefore, suppress these speckle noises, improve the important preprocessing link that picture quality is Ultrasonographic Analysis and identification.
The speckle noise reduction problem of ultrasonoscopy is one of important topic of domestic and international ultrasonic imaging technique always.Ultrasonic Image Denoising General Requirements effectively suppresses speckle noise, will retain post analysis simultaneously and diagnose useful image detail information.The Major Difficulties of Ultrasonic Image Denoising is: 1) speckle noise can roughly see a kind of multiplicative noise as; 2) the random nature more complicated of noise; 3) noise easily mixes mutually with image detail, and image detail is complicated and various.
At present, for suppression ultrasonoscopy speckle noise, improve picture quality, have already been proposed many methods.1) image averaging method utilizes a series of images obtaining same target in different time, different frequency or different scanning direction, they is on average formed a width combination picture to improve the signal to noise ratio (S/N ratio) (SNR) of image.Although this method is simple, quick, but it is subject to some restrictions: need the strict formation controlling image series, and need the registration of image; Due to image blurring impact, some little details (such as little blood vessel, texture etc.) can be lost, because this reducing spatial resolving power.2) adaptive weighted averaging filter method is to the value of each pixel in image, replaces with the weighted median of its local neighborhood window.Set window center point as (i
n, i
n), window size is (2w+1) × (2w+1), then in window, each point weighting coefficient is calculated as: weight (i, j)=[w (i
o, i
o)-a*d* σ
2/ m]
Wherein, [] is rounding operation, and a is coefficient, and d is that point (i, j) is to central point (i
n, i
n) distance, σ 2 and m is respectively variance in local neighborhood window and average.The weighted median got in neighborhood window replaces the pixel value of central point.Wherein, in neighborhood window, the weights of each point can be chosen automatically according to the partial statistics characteristic of image, and the size of neighborhood window also can regulate according to its local SNR automatically.Relative to simple medium filtering, this adaptive weighted process achieves certain effect in reservation details.But very sensitive to the selection of window, limit treatment effect, while removal noise, also can cause the loss of some small details.3) wavelet threshold shrinks is the method for the important removal speckle noise of a class, the wavelet soft-threshold (soft-thresholding) that this method mainly proposes based on Donoho shrinks denoising: first decomposed by image wavelet, set a threshold value, for the wavelet coefficient being less than threshold value zero replacement, and with it, threshold value replacement is deducted for the wavelet coefficient being greater than threshold value, wavelet coefficient after processed makes inverse wavelet transform, just can obtain rebuilding image.Meanwhile, many innovatory algorithm for wavelet threshold are also had.But said method is mainly for the noise of Gaussian distribution, and when solving the noise of other distribution, effect is not satisfactory; Meanwhile, choosing of wavelet threshold is also a problem needing to solve emphatically, can not select too large and lose some edges and local detail, can not select too little and insufficient to the suppression of noise.The yardstick of wavelet transformation and threshold value is how selected to there is no defining method.4) based on the denoising method of Anisotropic Diffusion Model.Anisotropy parameter is actually a nonlinear partial differential equation, decides rate of propagation by the gradient of image, can take into account simultaneously noise eliminate and feature keep two aspects.At present, the anisotropic diffusion equation (Anisotropic Diffusion, AD) being representative with Perona-Malik (PM) model is widely used.Anisotropic diffusion equation is applied in speckle suppression by Yu etc., proposes the Anisotropic Diffusion Model (Speckle Reducing Anisotropic Diffusion, SRAD) removing speckle noise.Yu etc. have modified coefficient of diffusion, enable diffusion equation adjust coefficient of diffusion according to the situation of picture noise, and can be more responsive to the detailed information of image.But also there is obvious defect in SRAD model: model mesoscale function is calculated by homogeneous area large as far as possible in initial pictures, the key of model be how to choose in image one large as far as possible, suitable homogeneous area, choosing of this region often affects diffusion result to a great extent, brings larger contingency to experimental result.In addition, the local statistic information that SRAD model uses is actually isotropic, and this has also deviated from the essence of anisotropy parameter algorithm.And anisotropy parameter needs successive ignition process just can obtain reasonable effect, iteration is again very consuming time, so this algorithm is difficult to the demand meeting ultrasonic real-time process.
Sum up, the method of existing removal ultrasonoscopy speckle noise has two more crucial deficiencies to need to improve: one is removing noise to image smoothing while, serious to the Fuzzy comparisons at details and edge, result in the loss of some edge details, have impact on diagnosis and the analysis in later stage; Two be process time complexity higher, be difficult to the demand meeting the real-time processes and displays image of ultrasonic image-forming system.
Summary of the invention
The object of this invention is to provide the ultrasonoscopy disposal route based on weighted direction medium filtering; this disposal route effectively protects the edge detail information of ultrasonoscopy while denoising; and the basic algorithm that treatment method adopts is medium filtering, algorithm is simple, and time complexity is low.
For achieving the above object, present invention employs following technical scheme: based on the ultrasonoscopy disposal route of weighted direction medium filtering, comprise the following steps:
(1) edge amplitude and the edge direction of each pixel in described ultrasonoscopy is calculated;
(2) pixel in described image is got as current point;
(3) judge whether this current point is marginal point according to the edge amplitude of described current point or edge direction, if not marginal point, then adaptive weighted averaging filter process is carried out to this current point; If marginal point, then this current point is carried out to the process of step (4) (5) (6) below;
(4) get the M*N neighborhood of this current point, select point relevant to the edge direction of this current point in this M*N neighborhood as process points;
(5) get pixel value and the edge magnitude value of described process points, to the corresponding edge magnitude value weighting of pixel value of described process points, the value after weighting is sorted, finds out intermediate value;
(6) pixel value of this current point is replaced with the pixel value that described intermediate value is corresponding;
(7) next pixel carries out step (3) process as current point is got, until process all pixels in described image, the image after last output processing.
A kind of embodiment of step (1), the edge amplitude of described pixel and the computing method of edge direction comprise:
(1a) horizontal direction of this pixel and the gradient of vertical direction is calculated, set the position of this pixel as (i, j), the pixel value of this pixel is I (i, j), then the account form of the gradient G x (i, j) of the horizontal direction of this pixel, the gradient G y (i, j) of vertical direction is as follows:
Gx(i,j)=I(i,j+1)-I(i,j-1) Gy(i,j)=I(i+1,j)-I(i-1,j);
(1b) calculate gradient amplitude GradientAm and the gradient direction GradientAn of this pixel, account form is as follows:
GradientAn=atan(Gy/Gx)
(1c) judge whether the gradient amplitude GradientAm of this pixel is greater than the threshold value preset, if this gradient amplitude GradientAm is more than or equal to described threshold value, then get this gradient amplitude GradientAm, edge amplitude and edge direction that this gradient direction GradientAn is this pixel, represent that this pixel is marginal point; If this gradient amplitude GradientAm is less than described threshold value, then the edge amplitude and the edge direction that set this pixel are negative value, represent that this pixel is not marginal point.
The another kind of embodiment of step (1), the edge amplitude of described pixel and the computing method of edge direction comprise:
(1a) edge detection operator of different directions is chosen;
(1b) sue for peace after the numerical value in the edge detection operator in each direction being multiplied with the respective pixel value in this pixel neighborhood of a point, take absolute value as output valve after summation;
(1c) in the output valve of different directions, maximal value is deducted minimum value and obtains difference, if this difference is more than or equal to the threshold value preset, the maximal value of then getting in the output valve of described different directions is the edge magnitude value of this pixel, the direction of getting edge detection operator corresponding to this maximal value is the edge direction of this pixel, represents that this pixel is marginal point; If this difference is less than described threshold value, then the edge amplitude and the edge direction that set this pixel are negative value, represent that this pixel is not marginal point.
The first embodiment of step (4), from described M*N neighborhood, select the point relevant to the edge direction of described current point to comprise as the method for process points:
(4a) that chooses different directions gets point template;
(4b) get point template from described different directions, get and corresponding with the immediate direction of the edge direction of described current point get point template;
(4c) in described M*N neighborhood, get by described immediate direction corresponding get point that point template hits as process points.
The second embodiment of step (4), from described M*N neighborhood, selects the difference of the edge direction of edge direction and described current point to be less than the point of the threshold value preset as process points.
When step (5) is specifically implemented, the pixel value of described process points is weighted process with corresponding edge magnitude value and refers to be that this pixel value carries out being multiplied with corresponding edge magnitude value and processes.
Due to the utilization of technique scheme, the present invention compared with prior art has following advantages: the ultrasonoscopy disposal route based on weighted direction medium filtering of the present invention, on the basis of medium filtering, consider edge direction and the edge amplitude information of image, for the current pixel point that certain is concrete, only choose point close with current point edge direction in neighborhood window and do medium filtering, and the sequence of intermediate value to choose be carrying out with on the pixel value after edge amplitude weighting, method of the present invention can be good at noise and the marginal information of distinguishing ultrasonoscopy, make the edge detail information effectively protecting ultrasonoscopy while denoising, advantageously in diagnosis and the analysis in later stage.And the basic algorithm that the present invention adopts is medium filtering, algorithm is simple, and time complexity is low, processes consuming time few, more meets the requirement of the real-time processes and displays image of ultrasonic image-forming system.
Embodiment
The present invention is set forth further below in conjunction with accompanying drawing.
The present invention proposes a kind of weighted direction median filtering algorithm, the basic ideas of this algorithm as shown in Figure 1, take ultrasonoscopy as background, on the basis of medium filtering, consider edge direction and the edge amplitude information of image, for the current point that certain is concrete, only choose point close with current point edge direction in filter window and do medium filtering, and the sequence of intermediate value to choose be carrying out with on the pixel value after edge amplitude weighting.Weighted direction median filtering algorithm considers that edge is different from background, and its intensity profile exists obvious difference, and this species diversity has directivity, therefore adopts the method that edge amplitude and edge direction combine.
Based on weighted direction median filtering algorithm, for denoising and the enhancing of ultrasonoscopy.The process flow diagram of this algorithm see Fig. 1, the first edge amplitude of each pixel and edge direction in computed image I; Then on this basis, pointwise process, for each pixel, selects the point of directional correlation in its M*N neighborhood as process points according to edge direction; Finally, for the process points selected in neighborhood, be weighted medium filtering process with edge amplitude.After importing ultrasound image data, mainly comprise the following steps:
(1) edge amplitude EdgeAm and the edge direction EdgeAn of each pixel in ultrasonoscopy is calculated;
(2) pixel in image is got as current point;
(3) judge whether this current point is marginal point according to the edge amplitude of current point or edge direction, if not marginal point, then adaptive weighted averaging filter process is carried out to this current point, what the method for this adaptive weighted averaging filter process adopted is prior art, specifically see " background technology "; If marginal point, then this current point is carried out to the process of step (4) (5) (6) below;
(4) get the M*N neighborhood of this current point, select point relevant to the edge direction of this current point in this M*N neighborhood as process points;
(5) get pixel value and the edge magnitude value of above-mentioned process points, to the corresponding edge magnitude value weighting of pixel value of process points, the value after weighting is sorted, finds out intermediate value;
(6) pixel value of current point is replaced with the pixel value that above-mentioned intermediate value is corresponding;
(7) next pixel carries out step (3) process as current point is got, until process all pixels in image, the image after last output processing.
In this algorithm, control to decrease the impact of noise on medium filtering by edge amplitude, adding and making this algorithm edge direction responsive especially of edge directional information, retains details ability strong, decreases ill-defined degree.Therefore, the median filtering algorithm of this improvement, in removal speckle noise ability, keeps the index such as edge ability and processing speed all achieves reasonable effect.
In above-mentioned algorithm, in step (1) computed image I, the edge amplitude of often and direction, have a variety of method to realize.Here two kinds of concrete implementation methods are provided: 1. the edge amplitude and the direction that are obtained image by the gradient amplitude of image and direction; 2. edge amplitude and the direction of image is obtained with the edge detection operator of different directions.But be not limited only to this two kinds of methods.
Method 1: obtain the edge amplitude of image and the method in direction by the gradient amplitude of image and direction, its process flow diagram is see Fig. 2.First, according to gradient amplitude GradientAm and the gradient direction GraditenAn of the gradient G x (i, j) of horizontal direction and gradient G y (i, the j) computed image of vertical direction, account form is as follows:
Set the position of image slices vegetarian refreshments as (i, j), the pixel value of this pixel is I (i, j), then Gx (i, j), the Gy (i, j) of this pixel:
Gx(i,j)=I(i,j+1)-I(i,j-1) Gy(i,j)=I(i+1,j)-I(i-1,j)
The then gradient amplitude GradientAm of this pixel and gradient direction GraditenAn:
GradientAn=atan(Gy/Gx)
Secondly, judge whether the gradient magnitude of this pixel is greater than the threshold value GradientAmThresh preset.If be more than or equal to threshold value, then represent that this pixel is marginal point, gradient amplitude is regarded as edge amplitude, and gradient direction regards edge direction as; If be less than threshold value, then think and non-flanged (representing that this pixel is not marginal point) edge amplitude and direction are all set as negative value (such as-1), so that whether distinguish pixel below in process is marginal point.That is:
Above-mentioned process is carried out to all pixel pointwises of image I, then obtains edge amplitude EdgeAm and the edge direction EdgeAn of each pixel.
Method 2: the method being obtained image border amplitude and direction by the edge detection operator of different directions, see Fig. 3, first chooses the edge detection operator that a group has different directions; Secondly this group operator is acted on the pixel neighborhood of a point on image respectively, obtain the output of operator on each direction; Output relatively in all directions, if difference is larger, choose the edge amplitude of maximum output as current pixel point, the direction of the operator of maximum output correspondence is edge direction; If difference is little, then think that current pixel point is not marginal point.
Illustrate, choose four direction (90 degree as shown in Figure 5,0 degree, 45 degree, 135 degree) on edge detection operator, use edge amplitude and the direction of in this group edge detection operator computed image often, see Fig. 3, first, for the pixel (i in image, j), the point on 2*2 neighborhood is as shown in Figure 4 got; Then, the edge detection operator of the four direction shown in Fig. 5 is acted on respectively the 2*2 neighborhood of Fig. 4, get the absolute value of suing for peace after each operator template is multiplied with the corresponding numerical value in neighborhood template, as output valve 0peratorAm=[am90, am0, am45, am135], corresponding direction 0peratorAn=[90,0,45,135]; Then, output valve relatively on four direction, if difference is larger, the difference that in the output valve of namely four direction, maximal value deducts minimum value is more than or equal to the threshold value 0peratorAmThresh preset, then represent that this pixel is marginal point, current pixel point (i, j) edge amplitude is the maximal value exported, and edge direction is the direction of edge detection operator corresponding to maximal value, suppose that the maximal value of output is am45, then edge amplitude is am45, and edge direction is 45.If it is very little to export difference, the difference that namely maximal value deducts minimum value is less than threshold value, then think non-flanged (representing that current pixel point is not marginal point), and the edge amplitude of current pixel point and direction are all set as negative value (such as-1).Be formulated as follows:
Wherein, index is the sequence number that max (OperatorAm) is corresponding.
To all pixels of image all according to above-mentioned steps process, edge amplitude EdgeAm and the direction EdgeAn of each pixel just can be obtained.
In the above-mentioned step based on weighted direction median filtering algorithm (4), how to select in M*N neighborhood with current point (i, j) point that edge direction is correlated with is as process points, here give also two kinds of concrete methods of realizings: be 1. as the criterion with the edge direction of current point, select the point in neighborhood on this direction to be process points; 2. select the point being less than predetermined threshold value with the edge direction difference of current point to be process points.But be not limited only to this two kinds of methods.
Method 1: be as the criterion with the edge direction of current point, select the point in neighborhood on this direction to be process points, the process flow diagram of method 1 as shown in Figure 6.That first chooses different directions gets point template, as Fig. 7, Fig. 7 show four direction (90 degree, 0 degree, 45 degree, 135 degree) get point template, judge current point (i, edge direction EdgeAn (i, j) j) and which direction (90 degree, 0 degree, 45 degree, 135 degree) closest, that is EdgeAn (i, j) drops on inside which angular interval following: [67.5,112.5], [0,22.5] U [157.5,180], [22.5,67.5], [112.5,157.5]; Then, according in following rule interestingness neighborhood along the point on this direction:
If closest with 90 degree, namely drop in angular interval [67.5,112.5], select template 2a in Fig. 7) or 2b) point that hits as process points;
If closest with 0 degree, namely drop in interval [0,22.5] U [157.5,180], select template 3a in Fig. 7) or 3b) point that hits as process points;
If closest with 45 degree, namely drop in interval [22.5,67.5], select template 4a in Fig. 7) or 4b) point that hits as process points;
If closest with 135 degree, namely drop in interval [112.5,157.5], select template 5a in Fig. 7) or 5b) point that hits as process points.
Suppose that the number of the process points selected is k, edge amplitude is
LocalEdgeAm=[ea1, ea2, ea3 ..., eak], pixel value is
LocalPixel=[p1,p2,p3,…,pk]。
It should be noted that, for the purpose of directly perceived, what only give 5*5 size in Fig. 7 gets point template 2a)-5a) or 2b)-5b), template size in fact here should be M*N size.Wherein, 2a)-5a) be get point template, 2b when being single-point for border width)-5b) get point template when being wider for border width.If select template 2a)-5a), easily occur noise spot being strengthened, if select template 2b by mistake) and-5b), easily erased in some tiny edges, so will according to the edge width situation of concrete internal organs, select suitable to get point template.
Method 2: select the point being less than predetermined threshold value with the difference of the edge direction of current point (i, j) to be process points, the process flow diagram of method 2 as shown in Figure 8.In N*M point in the neighborhood of current point (i, j), the point selecting the difference of edge direction EdgeAn and current point (i, j) edge direction EdgeAn (i, j) to be less than the threshold value EdgeAnThresh of setting is process points.Suppose that the process points chosen has k, their edge magnitude value be LocalEdgeAm=[ea1, ea2, ea3 ..., eak], pixel value be LocalPixel=[p1, p2, p3 ..., pk].
Above-mentioned based in weighted direction median filtering algorithm, relate in step (5) (6), have selected process points and after the edge magnitude value having taken them and pixel value, be weighted medium filtering process, first, with edge amplitude to pixel value weighting, that is: LEAP=[ea1*p1, ea2*p2, ea3*p3,, eak*pk]; Secondly, the value LEAP sequence after weighting, the pixel value px got corresponding to intermediate value median (LEPA) replaces current point (i, j) pixel value at place, if intermediate value is ea2*p2, then replace the pixel value of point (i, j) with p2.
Ultrasonoscopy disposal route based on weighted direction medium filtering of the present invention; can be good at noise and the marginal information of distinguishing ultrasonoscopy; make the edge detail information effectively protecting ultrasonoscopy while denoising, advantageously in diagnosis and the analysis in later stage.And the basic algorithm that the present invention adopts is medium filtering, algorithm is simple, and time complexity is low, processes consuming time few, more meets the requirement of the real-time processes and displays image of ultrasonic image-forming system.