Background technology
In the ultrasonoscopy forming process, when ultrasonic wavelength is suitable with the irradiating object surfaceness, will produce speckle noise, this phenomenon can be explained with the random scatter model.The existence of these noises makes that the sharpness of ultrasonoscopy is not high, and this also is one of major defect of ultrasonic imaging.The distinctive speckle noise of ultrasonoscopy not only makes the second-rate of ultrasonoscopy, especially covers and has reduced some detailed information of image, also makes to the identification of image detail and the analysis difficulty more that becomes.Be later state of an illness diagnosis and quantitative test, image characteristics extraction and identification cause adverse influence.Therefore, suppress these speckle noises, improving picture quality is the important preprocessing link of ultrasonoscopy analysis and identification.
It is one of important topic of domestic and international ultrasonic imaging technique that the speckle noise of ultrasonoscopy is removed problem always.The general effectively inhibition speckle noise that requires of ultrasonoscopy denoising will keep the image detail information useful with diagnosis to post analysis simultaneously.The main difficult point of ultrasonoscopy denoising is: 1) speckle noise can roughly be seen a kind of multiplicative noise as; 2) the random nature more complicated of noise; 3) noise is prone to mix mutually with image detail, and image detail is complicated and various.
At present, to suppressing the ultrasonoscopy speckle noise, improve picture quality, people have proposed many methods.1) image averaging method is utilized in a series of images that different time, different frequency or different scanning direction obtain same target, with their average signal to noise ratio (snr)s that forms a width of cloth combination picture with the raising image.Although this method is simple, quick, yet it receives some restrictions: need the formation of strict control image series, and need the registration of image; Because image blurring influence, some little details (for example little blood vessel, texture etc.) can be lost, and have therefore reduced spatial resolving power.2) adaptive weighted median filter method is to the value of each pixel in the image, with the weighted median replacement of its local neighborhood window.Setting window center point is (i
n, i
n), window size is (2w+1) * (2w+1), then the each point weighting coefficient is calculated as in the window: weight (i, j)=[w (i
o, i
o)-a*d* σ
2/ m]
Wherein, [] is rounding operation, and a is a coefficient, and d is that (i is j) to central point (i for point
n, i
n) distance, σ 2 and m are respectively variance and average in the local neighborhood window.Get the pixel value of the weighted median replacement central point in the neighborhood window.Wherein, the weights of each point can come according to the partial statistics characteristic of image to choose automatically in the neighborhood window, and the size of neighborhood window also can be regulated according to its local signal to noise ratio (S/N ratio) automatically.With respect to simple medium filtering, this adaptive weighted processing is obtaining certain effect aspect the reservation details.But the selection to window is very sensitive, has limited treatment effect, when removing noise, also can cause the loss of some small details.3) the wavelet threshold contraction is the method for one type of important removal speckle noise; This method is mainly shunk denoising based on the small echo soft-threshold (soft-thresholding) that Donoho proposes: at first image wavelet is decomposed; Set a threshold value, replace with zero, replace and deduct threshold value with it for wavelet coefficient greater than threshold value for wavelet coefficient less than threshold value; Wavelet coefficient after being processed is made inverse wavelet transform, just can obtain reconstructed image.Simultaneously, also have many improvement algorithms for wavelet threshold.Yet said method mainly is the noise to Gaussian distribution, and when solving the noise of other distribution, effect is not satisfactory; Simultaneously, choosing of wavelet threshold also is the problem that needs solve emphatically, and that can not select loses some edges and local detail too greatly, and that can not select is too little and insufficient to Noise Suppression.How to select the yardstick and the threshold value of wavelet transformation still not to have definite method.4) based on the denoising method of anisotropy diffusion model.Anisotropy diffusion is actually nonlinear PDE, decides rate of propagation by the gradient of image, can take into account two aspects of noise removing and characteristic maintenance simultaneously.At present, be that (Anisotropic Diffusion AD) has obtained widely using for the anisotropic diffusion equation of representative with Perona-Malik (PM) model.Yu etc. are applied to anisotropic diffusion equation during speckle suppresses, proposed to remove speckle noise the anisotropy diffusion model (Speckle Reducing Anisotropic Diffusion, SRAD).Yu etc. have revised coefficient of diffusion, make diffusion equation adjust coefficient of diffusion according to the situation of picture noise, and can be responsive more to the detailed information of image.But also there is obvious defects in the SRAD model: model mesoscale function is to be calculated by homogeneous area big as far as possible in the initial pictures; The key of model be how to choose in the image one big as far as possible; Suitable homogeneous area; Choosing of this zone often affects the diffusion result to a great extent, brings bigger contingency to experimental result.In addition, the employed local statistic information of SRAD model is actually isotropic, and this has also deviated from the essence of anisotropy broadcast algorithm.And the anisotropy diffusion needs repeatedly that iterative processing just can obtain reasonable effect, and iteration is again very consuming time, so this algorithm is difficult to satisfy the demand of ultrasonic real-time processing.
Sum up; The method of existing removal ultrasonoscopy speckle noise has two relatively more crucial deficiencies to need to improve: the one, when image smoothing is removed noise; Fuzzy more serious to details and edge caused the loss of some edge details, influenced the diagnosis and the analysis in later stage; The 2nd, the time complexity of handling is difficult to satisfy the demand of the real-time processes and displays image of ultrasonic image-forming system than higher.
Summary of the invention
The purpose of this invention is to provide ultrasonoscopy disposal route based on the weighted direction medium filtering; This disposal route has been protected the edge details information of ultrasonoscopy effectively in denoising; And the basic algorithm that this disposal route adopts is medium filtering, and algorithm is simple, and time complexity is low.
For achieving the above object, the present invention has adopted following technical scheme: the ultrasonoscopy disposal route based on the weighted direction medium filtering may further comprise the steps:
(1) edge amplitude and the edge direction of each pixel in the said ultrasonoscopy of calculating;
(2) get a pixel in the said image as current point;
(3) judge according to the edge amplitude or the edge direction of said current point whether this current point is marginal point,, then this current point is carried out adaptive weighted medium filtering and handle if not marginal point; If marginal point then carries out the processing of following step (4) (5) (6) to this current point;
(4) get the M*N neighborhood of this current point, select point relevant in this M*N neighborhood as process points with the edge direction of this current point;
(5) get the pixel value and the edge amplitude value of said process points, the pixel value of said process points with the weighting of respective edges range value, is sorted to the value after the weighting, find out intermediate value;
(6) with the pixel value of this current point of said intermediate value corresponding pixel value replacement;
(7) get next pixel and carry out the processing of step (3), all pixels in handling said image, the image after output is handled at last as current point.
A kind of embodiment of step (1), the edge amplitude of said pixel and the computing method of edge direction comprise:
(1a) calculate the horizontal direction of this pixel and the gradient of vertical direction, the position of setting this pixel for (i, j); The pixel value of this pixel be I (i, j), the gradient G x (i of the horizontal direction of this pixel then; J), the gradient G y of vertical direction (i, account form j) is following:
Gx(i,j)=I(i,j+1)-I(i,j-1) Gy(i,j)=I(i+1,j)-I(i-1,j);
(1b) calculate the gradient amplitude GradientAm and the gradient direction GradientAn of this pixel, account form is following:
Whether the gradient amplitude GradientAm that (1c) judges this pixel is greater than pre-set threshold; If this gradient amplitude GradientAm is more than or equal to said threshold value; Then get this gradient amplitude GradientAm, this gradient direction GradientAn edge amplitude and edge direction, represent that this pixel is a marginal point for this pixel; If this gradient amplitude GradientAm is less than said threshold value, edge amplitude and the edge direction of then setting this pixel are negative value, represent that this pixel is not a marginal point.
The another kind of embodiment of step (1), the edge amplitude of said pixel and the computing method of edge direction comprise:
(1a) choose the edge detection operator of different directions;
(1b), take absolute value after the summation as output valve with multiply each other back summation of the respective pixel value in the numerical value in the edge detection operator of each direction and this pixel neighborhood of a point;
(1c) in the output valve of different directions; Maximal value is deducted minimum value get difference; If this difference is more than or equal to pre-set threshold; The maximal value of then getting in the output valve of said different directions is the edge amplitude value of this pixel, gets the edge direction of the direction of the corresponding edge detection operator of this maximal value for this pixel, representes that this pixel is a marginal point; If this difference, is then set the edge amplitude and the edge direction of this pixel less than said threshold value and is negative value, represent that this pixel is not a marginal point.
First kind of embodiment of step (4), from said M*N neighborhood, select the point relevant to comprise as the method for process points with the edge direction of said current point:
(4a) choose the point template of getting of different directions;
(4b), get the get point template corresponding with the immediate direction of the edge direction of said current point from the getting the point template of said different directions;
(4c) in said M*N neighborhood, get by corresponding the getting of the said immediate direction point that point template hits as process points.
Second kind of embodiment of step (4), from said M*N neighborhood, the difference of edge direction of selecting edge direction and said current point less than the point of pre-set threshold as process points.
During step (5) practical implementation, the pixel value of said process points carries out weighted with the respective edges range value and refers to such an extent that be the processing of multiplying each other of this pixel value and respective edges range value.
Because the utilization of technique scheme; The present invention compared with prior art has advantage: the ultrasonoscopy disposal route based on the weighted direction medium filtering of the present invention; On the basis of medium filtering; Considered edge of image direction and edge amplitude information,, only chosen point close in the neighborhood window and do medium filtering with the current point edge direction to certain concrete current pixel point; And the ordering of intermediate value to choose be on the pixel value after the edge amplitude weighting, to carry out; Method of the present invention can be good at distinguishing the noise and the marginal information of ultrasonoscopy, makes the edge details information of in denoising, having protected ultrasonoscopy effectively to help the diagnosis and the analysis in later stage more.And the basic algorithm that the present invention adopts is medium filtering, and algorithm is simple, and time complexity is low, handles consuming time fewly, meets the requirement of the real-time processes and displays image of ultrasonic image-forming system more.
Embodiment
Come further to set forth the present invention below in conjunction with accompanying drawing.
The present invention proposes a kind of weighted direction median filtering algorithm; The basic ideas of this algorithm are as shown in Figure 1, are background with the ultrasonoscopy, on the basis of medium filtering; Edge of image direction and edge amplitude information have been considered; To certain concrete current point, only choose point close in the filter window and do medium filtering with the current point edge direction, and the ordering of intermediate value to choose be on the pixel value after the edge amplitude weighting, to carry out.The weighted direction median filtering algorithm considers that the edge is different from background, and there is evident difference in its intensity profile, and this species diversity has directivity, the method that therefore adopts edge amplitude and edge direction to combine.
Based on the weighted direction median filtering algorithm, be used for the denoising and the enhancing of ultrasonoscopy.The process flow diagram of this algorithm is referring to Fig. 1, at first the edge amplitude and the edge direction of each pixel among the computed image I; Then on this basis, pointwise is handled, and to each pixel, the point of selecting directional correlation in its M*N neighborhood according to edge direction is as process points; At last, to the process points of selecting in the neighborhood, carry out the weighted median Filtering Processing with edge amplitude.After importing ultrasound image data, mainly may further comprise the steps:
(1) the edge amplitude EdgeAm and the edge direction EdgeAn of each pixel in the calculating ultrasonoscopy;
(2) get a pixel in the image as current point;
(3) judge according to the edge amplitude or the edge direction of current point whether this current point is marginal point; If not marginal point; Then this current point being carried out adaptive weighted medium filtering handles; What the method that this adaptive weighted medium filtering is handled adopted is prior art, specifically referring to " background technology "; If marginal point then carries out the processing of following step (4) (5) (6) to this current point;
(4) get the M*N neighborhood of this current point, select point relevant in this M*N neighborhood as process points with the edge direction of this current point;
(5) get the pixel value and the edge amplitude value of above-mentioned process points, the pixel value of process points with the weighting of respective edges range value, is sorted to the value after the weighting, find out intermediate value;
(6) with the pixel value of above-mentioned intermediate value corresponding pixel value replacement current point;
(7) get next pixel and carry out the processing of step (3), all pixels in handling image, the image after output is handled at last as current point.
In this algorithm, through edge amplitude control minimizing influence of noise to medium filtering, the adding of edge directional information makes this algorithm responsive especially to edge direction again, and it is strong to keep the details ability, has reduced ill-defined degree.Therefore, this improved median filtering algorithm is being removed the speckle noise ability, is being kept all having obtained reasonable effect on the indexs such as edge ability and processing speed.
In the above-mentioned algorithm, every edge amplitude and direction have a variety of methods to realize among step (1) the computed image I.Here provide two kinds of concrete implementation methods: 1. gradient amplitude and the direction through image obtains edge of image amplitude and direction; 2. the edge detection operator with different directions obtains edge of image amplitude and direction.But be not limited only to this two kinds of methods.
Method 1: the method that gradient amplitude and the direction through image obtains edge of image amplitude and direction, its process flow diagram is referring to Fig. 2.At first, according to the gradient G x of horizontal direction (i, j) with the gradient G y of vertical direction (account form is following for i, j) the gradient amplitude GradientAm of computed image and gradient direction GraditenAn:
The position of setting the image slices vegetarian refreshments be (i, j), the pixel value of this pixel be I (i, j), then the Gx of this pixel (i, j), Gy (i, j):
Gx(i,j)=I(i,j+1)-I(i,j-1) Gy(i,j)=I(i+1,j)-I(i-1,j)
Then the gradient amplitude GradientAm of this pixel and gradient direction GraditenAn:
GradientAn=atan(Gy/Gx)
Secondly, whether the gradient amplitude value of judging this pixel is greater than pre-set threshold GradientAmThresh.If more than or equal to threshold value, represent that then this pixel is a marginal point, regard gradient amplitude as edge amplitude, gradient direction is regarded edge direction as; If less than threshold value, then think non-flanged (representing that this pixel is not a marginal point) all to be set as negative value (such as-1) to edge amplitude and direction, so that whether distinguishing pixel point is marginal point in handling in the back.That is:
Above-mentioned processing is carried out in all pixel pointwises to image I, then obtains the edge amplitude EdgeAm and the edge direction EdgeAn of each pixel.
Method 2: obtain the method for image border amplitude and direction through the edge detection operator of different directions,, at first choose one group of edge detection operator that different directions is arranged referring to Fig. 3; Secondly act on this group operator respectively on the pixel neighborhood of a point on the image, obtain the output of operator on each direction; The relatively output on all directions if difference is bigger, is chosen the edge amplitude of maximum output as current pixel point, and the direction of the operator that maximum output is corresponding is an edge direction; If difference is little, think that then current pixel point is not a marginal point.
Illustrate, choose four direction as shown in Figure 5 (90 degree, 0 degree; 45 degree, 135 degree) edge detection operator on uses on this group edge detection operator computed image edge amplitude and direction at every; Referring to Fig. 3, at first, to the pixel (i in the image; J), get point on the 2*2 neighborhood as shown in Figure 4; Then, act on the 2*2 neighborhood of Fig. 4 to the edge detection operator of four direction shown in Figure 5 respectively, get the multiply each other absolute value of back summation of each operator template and corresponding numerical value in the neighborhood template; As output valve 0peratorAm=[am90, am0, am45; Am135], corresponding direction 0peratorAn=[90,0; 45,135]; Then, compare the output valve on the four direction, if difference is bigger; The difference that just maximal value deducts minimum value in the output valve of four direction representes that then this pixel is a marginal point, current pixel point (i more than or equal to pre-set threshold 0peratorAmThresh; J) edge amplitude is the direction of the corresponding edge detection operator of maximal value for the maximal value of output, edge direction, supposes that the maximal value of output is am45; Then edge amplitude is am45, and edge direction is 45.If the output difference is very little, just maximal value deduct minimum value difference less than threshold value, then think non-flanged (expression current pixel point be not marginal point), the edge amplitude of current pixel point and direction all are set as negative value (such as-1).Be formulated as follows:
Wherein, index is max (OperatorAm) corresponding sequence number.
All pixels to image are all handled according to above-mentioned steps, just can obtain the edge amplitude EdgeAm and the direction EdgeAn of each pixel.
In the above-mentioned step (4) based on the weighted direction median filtering algorithm; How to select in the M*N neighborhood and current point (i; J) point that edge direction is correlated with is as process points; Here also provided two kinds of concrete implementation methods: 1. the edge direction with current point is as the criterion, and the point in the selection neighborhood on this direction is a process points; 2. the edge direction difference of selection and current point is a process points less than the point of predetermined threshold value.But be not limited only to this two kinds of methods.
Method 1: the edge direction with current point is as the criterion, and the point in the selection neighborhood on this direction is a process points, and the process flow diagram of method 1 is as shown in Figure 6.At first choose the point template of getting of different directions, like Fig. 7, Fig. 7 has shown the point template of getting of four direction (90 degree, 0 degree, 45 degree, 135 degree); The judgement current point (i, and edge direction EdgeAn j) (i, j) the most approaching with which direction (45 spend for 90 degree, 0 degree, and 135 spend); That is to say that (i j) drops on following which angular interval the inside: [67.5,112.5], [0,22.5] U [157.5 to EdgeAn; 180], [22.5,67.5], [112.5,157.5]; Then, choose in the neighborhood point on this direction according to following rule:
If the most approaching, just drop in the angular interval [67.5,112.5], select template 2a among Fig. 7 with 90 degree) or the point that 2b) hits as process points;
If the most approaching, just drop among interval [0, the 22.5] U [157.5,180], select template 3a among Fig. 7 with 0 degree) or the point that 3b) hits as process points;
If the most approaching, just drop in the interval [22.5,67.5], select template 4a among Fig. 7 with 45 degree) or the point that 4b) hits as process points;
If the most approaching, just drop in the interval [112.5,157.5], select template 5a among Fig. 7 with 135 degree) or the point that 5b) hits as process points.
The number of the process points of supposing to select is k, and the edge amplitude does
LocalEdgeAm=[ea1, ea2, ea3 ..., eak], pixel value does
LocalPixel=[p1,p2,p3,…,pk]。
Need to prove that for the purpose of directly perceived, what only provided the 5*5 size among Fig. 7 gets point template 2a)-5a) or 2b)-5b), the template size in fact here should be the M*N size.Wherein, 2a)-5a) be the point template of getting that is directed against under the situation that border width is a single-point, 2b)-5b) be than the point template of getting under the situation of broad to border width.If select template 2a)-5a), occur mistake easily and strengthen noise spot, if select template 2b)-5b), erase some tiny edges easily, so will select the suitable point template of getting according to the edge width situation of concrete internal organs.
Method 2: selection and current point (i, the difference of edge direction j) is a process points less than the point of predetermined threshold value, the process flow diagram of method 2 is as shown in Figure 8.(i, in the N*M in neighborhood j) the point, (i, j) (i, difference j) is a process points less than the point of preset threshold EdgeAnThresh to edge direction EdgeAn to select edge direction EdgeAn and current point in current point.Suppose the process points of choosing have k, their edge amplitude value be LocalEdgeAm=[ea1, ea2, ea3 ..., eak], pixel value be LocalPixel=[p1, p2, p3 ..., pk].
Above-mentioned based in the weighted direction median filtering algorithm, relate in the step (5) (6), after having selected process points and having taken their edge amplitude value and pixel value; Carry out the weighted median Filtering Processing, at first, with edge amplitude to the pixel value weighting; That is: LEAP=[ea1*p1, ea2*p2, ea3*p3;, eak*pk]; Secondly, the ordering of the value LEAP after the weighting, (i, the pixel value of j) locating if intermediate value is ea2*p2, then replace point (i, pixel value j) with p2 to get the pairing pixel value px replacement of intermediate value median (LEPA) current point.
Ultrasonoscopy disposal route based on the weighted direction medium filtering of the present invention; Can be good at distinguishing the noise and the marginal information of ultrasonoscopy; Make and the edge details information of in denoising, having protected ultrasonoscopy effectively help the diagnosis and the analysis in later stage more.And the basic algorithm that the present invention adopts is medium filtering, and algorithm is simple, and time complexity is low, handles consuming time fewly, meets the requirement of the real-time processes and displays image of ultrasonic image-forming system more.