Anisotropic Weighted KS-NLM Filter for Noise Reduction in MRI

The topic of denoising magnetic resonance (MR) images is considered in this paper. More in detail, an enhanced Non-Local Means (NLM) filter using the Kolmogorov-Smirnov (KS) distance is proposed. The KS-NLM approach estimates the similarity between image patches by computing the KS distance. To overcome that NLM filters assign the same role to all pixels in patches, that is, not privileging the central one, we propose a new filter, namely the Anisotropic Weighted KS-NLM (Aw KS-NLM), which better deals with central pixels within the patches by, on one hand, including a suitable weighted strategy and, on the other, by performing a local anisotropy analysis. The Aw KS-NLM has been compared to other existing non-local Means (NLM) methodologies in both MRI simulated and real datasets. The results provide excellent noise reduction and image-detail preservation.


I. INTRODUCTION
Magnetic Resonance Imaging (MRI) is a medical imaging technique commonly used in radiology to visualise internal structures of the human body for clinical diagnostics, threat planning or monitoring the evolution of a disease after medical treatment. Large data sets (MRI volume data) are generated and they require fast interpretation from radiologists. However, MRI data is corrupted with noise caused by several factors (movements of patients, limitations due to reconstruction algorithms, etc.) [1], [2]. To ease the interpretation of the MRI data, the signal-to-noise ratio (SNR) should be the highest possible (ideally infinite) and showing the least artefacts. Hence, MRI denoising is required.
Denoising is an active area of research and, in general, filtering methods pursue to remove noise whereas preserving image details (edges, textures) and also not introducing new artifacts.
Most filtering methods focus on the spatial pattern redundancy in the image and proceed with the signal averaging principle. Nevertheless, some other approaches refer to the statistical estimates such as the mean and the median to The associate editor coordinating the review of this manuscript and approving it for publication was Sudhakar Radhakrishnan . perform the processing [3], [4]. In addition to that, MRI filtering is presented by another family of approaches performed in frequency domain [5]. These filters have been widely used in various applications for such fMRI despite their act of blurring the edges by averaging pixels with non-similar patterns.
PDE-based (partial differential equations) methods to remove noise have been also applied to MRI images, such as anisotropic diffusion filter [6] or total variation methods [7], both offering also reasonable performance. In [8] the anisotropic diffusion filter is embedded into a tensorial formulation to enhance MRI images and, in [9], a combination of a total variation and compressed sensing model for filtering MRI data is discussed.
Statistical methods aims to model the noise for filters to better reduce it. Many approaches estimate the noise by means of Markov random process [10], or Bayesian schemes [11] or simply by maximum-likelihood [12] and then incorporated to filters.
Deep learning techniques (convolutional neural networks) have been applied recently to restore MRI data ( [13], [14]). In [15] an improved NLM method using a shallow convolutional neural network for denoising MRI images is discussed. Although results are indeed very promising, network design and training remain too much data dependent.
Another category of MRI filtering techniques is based on a non-local self-similarity approach [16]- [19]. This technique is based on identifying similar and dissimilar patches on the basis of a suitable patch distance. The choice of this distance introduces several requirements, such as defining a suitable model for a precise description of MRI data and their self-similarity. Hence, non-local algorithm's performance is strictly related to the validity of this model.
The original NLM filter is intended to remove Gaussian noise and hence, to denoise MRI data, usually modeled by Rician noise [20]. Thus, the NLM approach should be suitable to be modified. Manjón proposed an adaptation in a seminal paper [17], from which several articles proposed some variations to improve the denoising.
The unbiased NLM (named UNLM) filter proposed in [17] is widely used due to its good performance. However, it causes oversmoothing and blurs the edges in the case of high noise levels.
In [21], the lost of details related to non-local means filters caused by a non-optimal selection of weights is addressed.
In [18] and [19], a Maximum Likelihood (ML) estimator is adopted for fusing similar pixels. The former selects a fixed number of similar pixels according to the Euclidean distance, while the latter exploits the Kolmogorov-Smirnov (KS) test to decide whether a pixel is similar or not. Other statistical tests have been adopted in literature such as [22].
In [23] the similarity between patches is estimated by using the Kolmogorov-Smirnov (KS) distance, defined as the difference between the cumulative distribution function (CDF) between the patches. This approach is very effective, despite the amount of data required for estimating the CDF. Two solutions can be adopted: the first one exploit stacks of images for ensuring enough pixels, but this greatly limits the applicability of this solution [24]. The second one requires the adoption of big patches for the similarity measurement phase. Also this solution has some drawback: big patches imply that several pixels are considered that are far from the target, i.e. the central one. Thus, a weighting procedure could solve this issue, but it is not trivial to implement the weighting strategy in the CDF estimation. However, it is known that exploiting only this distance cannot always achieve an accurate similarity measure.
In this paper, to overcome the limitations of existing NLM filters, we propose an improved version of the KS-NLM algorithm that takes into account the local weights of the patches to better estimate their similarity. Additionally, to improve fine detail preservation, a novel local anisotropy analysis is introduced. The proposed filter, named Aw KS-NLM (anisotropic weighted KS-NLM), performs well in reducing noise and preserving fine details of MR images as shown in the experimental setup through visual analysis and the different objective metrics used.
The different mentioned NLM approaches are summarized in Figure 1. The remainder of the paper is structured as follows: the adopted approach is fully explained in Section II. In Section III, the filters to compare results with are summarized. Sections IV and V illustrate the experimental results related to the developed solution, obtained respectively for the simulated and the real data, in comparison with some other MRI denoising approaches. Finally, Section VI summarizes the conclusions and outlines the future work.

II. METHODOLOGY
In this Section, the statistical model is firstly introduced (Section II-A). Then, we illustrate the background related to the NLM approach (Section II-B). Thereafter, we detail one of the approaches inspired from the NLM algorithm: the NLM similarity estimation by using the Kolmogorov-Smirnov distance (KS-NLM) technique (Section II-C). Finally, we present our contributions to improve the KS-NLM filter: the optimal attribution of the local weights (Section II-D) and the inclusion of the anisotropy in its formulation (Section II-E).

A. DISTRIBUTION MODEL
Let Y = {y p |p ∈ I} be a noise-free MR image in amplitude mode defined on a discrete grid I. From [25], the noisy dataset corrupted by Rician noise, Z = {z p |p ∈ I}, is given by: where α p and β p ∼ N (0, σ 2 ) are two sets of Gaussian distributed random numbers, and σ denotes their standard deviation. The aim of any filtering technique applied to the noisy image Z is to reconstruct the noise-free image Y (reduce noise while preserving fine details and not adding artifacts).

B. NLM APPROACH
The NLM approach is a patch-based denoising technique that reconstructs the noise-free pixel by the mean of all pixels within the image weighted by how similar these pixels are VOLUME 8, 2020 to the target pixel. Originally, the similarity between the patches is calculated based on the Euclidean distance [16]. For the sake of completeness, a quick overview of the original NLM approach is dealt with in this subsection.
More in detail, the filtered value of a pixel at a position p is computed as a weighted average of all the pixels within the image as follows [16]: where p denotes the position of the pixel being filtered, q represents each one of the pixels in the image, η denotes a normalization parameter, and, (p, q) is the attributed weight related to the pixels p and q (0 ≤ (p, q) ≤ 1 and q∈I (p, q) = 1, ∀p).
The weights (p, q) are set according to a similarity criterion between the two considered patches, Z p and Z q centered at positions p and q respectively. In [16], this similarity criterion is calculated as: where, h acts as a degree of filtering that controls the decay of the exponential function and therefore the decay of the weights as a function of the distances and, d E is a Gaussian weighted Euclidean distance of all the pixels of each neighborhood given as: with G p a normalized Gaussian weighting function with zero mean and standard deviation usually set equal to 1. As mentioned above, several techniques were inspired from the original NLM approach. More in detail, in the next Subsection a brief description of the KS-NLM approach is proposed.

C. KS-NLM TECHNIQUE
The KS-NLM filter is a NLM approach inspired by the work of Buades et al. [16] but, the similarity between the patches is based on the KS distance instead on the Euclidean distance and a noise model is used to better account for the Rician noise within MR images [26].
More in detail, we calculate, firstly,the difference between the noisy patches Z p and Z q : By taking into consideration the Rician distribution that characterizes the MRI data, this difference can be statistically modelled as a Gaussian process [26]. More in details, in case of similar noise free texture of the patches, the (p, q) term will be characterized by zero mean and variance equal to 2σ 2 . For that, in order to measure the similarity between two patches, the KS distance between the CDF of and the Gaussian random variable N (0, 2σ 2 ), F N , is calculated. In fact, the first step consists of estimating the empirical CDF (eCDF)F (p,q) from the data by means of the Kaplan Meier non-parametric estimator [27]. Thereafter, the KS distance can be adopted on the basis of the following formula [28]: Once the distance is calculated, the NLM similarity criterion for an MR image is carried out by adapting Eq. (3) to the KS distance case: where u(·) is the unitary step function, while T is a threshold to control the filter strength. Finally, Eq. (2) is implemented for the estimation of the regularized pixel at location p will be given as:ŷ Hence, our contribution consists on improving the KS-NLM filtering solution on the basis of several techniques including: the local weights assignation and the anisotropy.

D. LOCAL WEIGHTS ASSIGNATION
In [16], it is shown that the adoption of a weighting function in measuring the similarity can largely improve the effectiveness of the filter, as it helps in reducing the noise influence on the similarity estimation and in giving more importance to the central area of the patch. For this aim, we modified the KS-NLM approach by including the kernel ξ reported in Figure 2. This kernel originally proposed by Manjon-Herrera and Buades [29] helps in reducing the noise influence on the similarity estimation and in giving more importance to the central area of the patch.
Clearly the use of a weighting kernel within the eCDF computation is not straightforward: the application of ξ to the patch would modify pixel values producing a different statistical description. Thus a specific procedure has been implemented. First, the eCDF of is computed without considering the weighting kernel. Then kernel ξ is used to compute the moments (mean and variance) of : where N is the number of pixels constituting the patch . These two moments are then substituted inF (p,q) . This procedure allows to have a new eCDF, in which the patch central pixels have a larger importance (i.e. influence) with respect to the border ones.
The proposed filtering solution is named, in the following, the weighted KS-NLM (wKS-NLM).

E. INTRODUCTION OF THE ANISOTROPY
In addition to the attribution of the weights in the patches, we introduce some anisotropic operators to improve the effectiveness KS-NLM filter when dealing with sharp edges.
The sub-optimality of NL in estimating sharp edges together with the usefulness of anisotropic approaches has been highlighted in literature [31]. In fact, it is clearly known that one of the main limitations of NL based approaches is that they are not able to attain optimal performance on images with sharp edges [32]. For that, the proposed algorithm manages this problem by introducing an anisotropy that takes into account the four principle directions (horizontal, vertical and the two main diagonals) as sketched in Figure 3. Clearly, more complex anisotropic patch shapes could have been used [30]. We decided to consider this anisotropy as a good trade off between accuracy and complexity.
For each anisotropic mask of Figure 3, the eCDF has been computed only considering pixels within the white area; the related distance are computed according to Eq. (6). The average of these distances is then used in Eq. (7).
The benefits of the inclusion of the anisotropy are indeed shown (visually and numerically) in Section IV-D.

F. IMPLEMENTATION ISSUES
Algorithm 1 describes the steps to proceed with our proposed methodology, called the Anisotropic Weighted KS-NLM (Aw KS-NLM) Filter framework. It should be noted that T -parameter must be tuned for each test case in order to get the highest performance of the filter. The algorithm has been coded in Matlab R2018a [33] environment, on a 16-Core 3.40 GHz Processor with Linux Debian as operative system. Anisotropy is efficiently evaluated through 4 masks and basic parallel techniques have been included to reduce computational load (Matlab par-for for unwrapping loops). As an example, for an image size of 434 × 362 (as the one used in our experiments and reported in Figure 7), the computational time required by the proposed filter is ≈100 seconds.

Algorithm 1: Anisotropic Weighted KS-NLM Framework
Inputs The MR image Z, the window search size M , the patch size N , the T -parameter and the estimatedσ .
Output The denoised imageŶ 1: for each patch centered at a pixel p do 2: Consider an M × M searching window. 3: for each patch centered at q in the window do 4: Compute (p, q) using (5).

7:
Setμ p,q andσ p,q as the mean and the variance of F (p,q) . 8: Compute the KS distance vector d KS p,q using (6) for each anisotropic mask, and average them. 9: Compute the weights KS (p, q) according to Eq. (7) 10: end for 11: Consider the largest k elements in KS . 12: Estimateŷ p using (8). 13: end for From the experiments, we set M (window search size) and N (patch size) to 11 and 13 respectively, and k = 50 (we recall that only k first elements in the D vector are considered). A more detailed discussion regarding the choice of these parameters is provided in Section IV-C. In the next Section, details about the other denoising filters considered in the experimental setup are provided.

III. COMPARISON ALGORITHMS
In order to evaluate the capabilities of our proposed MRI denoising technique on reducing the noise and preserving the main characteristics of the image, we compare it to other widely known MRI filtering approaches in the scientific community described below. For each of them, we adopted the filters parameters recommended by the Authors.
• The Unbiased Non-local Means (UNLM) Filter [17]: A non-local filtering algorithm presented as an unbiased version of one of the most commonly used NL approaches for image denoising in the image processing field which is NL-Means Filter [16]. In fact, this VOLUME 8, 2020 technique takes into account the mean of all pixels in the image, weighted by how similar these pixels are to the target pixel. Hence, this similarity between the patches is based on the typical Euclidean distance of the pixels intensities. Finally, the noise bias should be removed since this latter is no longer a signal-dependent one in the squared magnitude images as described by Manjón et al.
• Non-local Maximum Likelihood (NLML) Estimation [18]: A non-local approach inspired by the NL means approach [16]. This technique exploits the high degree of redundancy in the content of images and assumes that pixels which have similar neighborhoods come from the same distribution. Thus, the observations (intensities of pixels) are located in the NL neighborhoods of a certain pixel to estimate its true noise free signal. Moreover, the Maximum Likelihood Estimation (MLE) is deployed within a NL neighborhood to predict underlying noise-free signals. This ML function is not used for the direct estimation of the noise-free signal. Instead, this proposed approach estimates the noise-free signal by averaging over similar image content.
• Non-local Maximum Likelihood Estimation using KS distance (NLML KS ) [19]: A non-local technique inspired by the work of He et al. given in [18]. In this method, the samples for the MLE of the true underlying intensity are non-locally selected in the basis of the intensity similarity of the pixel neighborhoods given through an adaptive way using the Kolmogorov-Smirnov similarity test.

IV. SIMULATED DATA
In this Section, we provide quantitative and qualitative results for our approach. Quantitative comparison for a synthetic MRI data with the above detailed NLM filters is done through well-known image-quality indexes. Qualitative analysis is done by visual inspection. Additionally, the tuning technique to select the parameters of our denoised filter is also addressed.

A. MRI DATASET
A simulated MR magnitude dataset has been considered for evaluating the capabilities of our technique. Indeed, this simulated data is presented as a T1-Weighted noise-free brain phantom. The head slice is composed of 434 × 362 pixels with 6 gray levels in the [0, 255] range and another level for the background. More details about the brain phantom are provided by the BrainWeb database (https://www.mcgill.ca/bic/software/brainweb-mrisimulator) [34]- [36]. Thereafter, Rician noise has been generated in order to obtain various Rice-distributed data with different noise levels, i.e. σ ∈ {2, 5, 10, 15, 20}. In Figure 7, the simulated data in case of σ = 10 is reported.

B. DESCRIPTION OF THE ADOPTED INDEXES
We adopted the PSNR (Peak Signal to Noise Ratio) and the MSSIM (Mean Structure Similarity Index Matrix) as objective indices to compare results for the NLM filters used. The PSNR is a quality measurement that analyzes the difference between the original and a restored image. The higher is the PSNR, the better the reconstructed image matches with the original noise-free one.
The mathematical equation that describes the PSNR is given as follows: where R is the maximum fluctuation in the input image data; and MSE is the Mean Square Error of the scene described on the basis of the following equation: The MSSIM index has been developed in order to forecast the overall perceived quality of images [37]: where y j andŷ j are the image contents at the j-th local window and D is the number of local windows in the image.
In particular, the SSIM measures the similarity between two images by analyzing their luminance, their contrast and their structur according to the following equation: where µ Y and µŶ are the mean of Y andŶ respectively, σ Y and σŶ are the standard deviation of Y andŶ respectively. σ YŶ presents the covariance between Y andŶ. c 1 and c 2 are two constant parameters defined by the Authors in [37].

C. PARAMETERS SELECTION
Our approach requires to set some parameters: window search size equal to 11 × 11 and the patch size given as 13 × 13.
In this Section, we explain how such values have been selected.
To this aim, we perform a comparison between the behaviour of various KS distances cited in Section II including: the classical KS-NLM (without weights assignation), the wKS-NLM and the Aw KS-NLM for several noise levels. In fact, Figure 4 illustrate the evolution of PSNR and MSSIM as a function of a proposed range of T -parameter (from 0.05 to 0.35) with an 11×11 window search size and a 13×13 patch size in two different noise levels, σ = 5 and σ = 15, for the classical KS-NLM, the wKS-NLM and the Aw KS-NLM.
By analyzing these two figures simultaneously we assist to an improvement of the KS-distance moving from the classical KS-NLM to the weighted one. Moreover, after introducing the anisotropy to wKS-NLM, we notice an enhancement related to the shape of the graphs corresponding to the Aw KS-NLM. thus, we can admit that the Aw KS-NLM is the suitable KS filtering solution that we should focus on working with it for the rest of this paper. In addition, it should be noted that this solution shows regularly the maximum values of PSNR and MSSIM in the region of T-parameter between 0.125 and 0.175.
After taking into account the Aw KS-NLM as a proposed solution, we need to select the suitable parameters related to this NL filtering algorithm that should be used for the simulated Brain phantom in order to achieve its greatest capabilities in reducing the noise and preserving the main characteristics of the image. For that, we compute the PSNR and MSSIM matrices of the Aw KS-NLM as a function of the patch size, selected from 7 × 7 and 15 × 15, and the T-parameter performed between 0.075 and 0.25. These indexes have been calculated with a window search size equal to 11 × 11 in 5 different noise realizations as sketched in Figure 5.
Considering these matrices, we conclude that the proposed algorithm shows a good trade-off of high performance between the different noise levels, great values of PSNR and MSSIM, with a 13 × 13 patch size and an T-parameter equal to 0.15. Therefore, this latter's value should be attributed to the Aw KS-NLM algorithm and must be used for the experimental results' comparison throughout Section IV-D.

D. RESULTS
In this Section, we present and discuss the experimental results obtained by our proposed solution in comparison with some other NL filtering algorithms for instance: UNLM, NLML and NLM KS filters. In fact, we illustrate both visual and objective assessment (Section IV-D1). Next, we detail the Edge Preservation (Section IV-D2), Contrast (Section IV-D3), Sharpness (Section IV-D4) and Method Error (Section IV-D5) comparisons.

1) VISUAL AND NUMERICAL QUALITY COMPARISON
The synthetic data used is shown in Figure 7, which has been corrupted with different levels of Rician noise (σ ranging from 2 to 20). Table 1 reports the values of PSNR and MSSIM given by the NL filters. Figure 6 illustrates, for all VOLUME 8, 2020   the filters used, the evolution of PSNR and MSSIM as a function of the noise level σ . All filters have been applied in 2D datasets using default configurations as provided by the authors.
From these results, it is clear that the Aw KS-NLM filter shows the highest values for both PSNR and MSSIM indices. Thus, the Aw KS-NLM performs well in terms of noise reduction (PSNR) and image-detail preservation (MSSIM) followed by the UNLM, NLML KS and NLML filters. Moreover, as expected, the NLML KS filter performs better than the conventional NLM in all cases. Figure 7 show the visual comparison for the simulated data (brain) corrupted with a noise level σ = 10. The red box (180×150) is a selected area represented in Figure 8 to better evaluate the filter performance. As it can be seen in this figure, all the filtering NL methods perform well. However, it is clear that the Aw KS-NLM filter shows a superior trade-off for variance reduction (homogeneous areas resembles more homogeneous after filtering) and edge preservation.
Similar results and conclusions (Figures 9 and 10), applied to the case of synthetic data corrupted with high noise level (σ = 20).

2) EDGE PRESERVATION
As mentioned above, Aw KS-NLM provides visually a better preservation of edges when compared with the rest of NL filters used in the comparison analysis. However, an objective analysis is required to assess that superiority. VOLUME 8, 2020  For that purpose, we detect the edges from the restored outputs for a worst case (high noise level σ = 20) as shown in Figure 11. The estimation of the edges is performed on the basis of Canny technique using the default configuration of parameters in its Matlab implementation. From a first visual analysis of results highlighted in Figure 11, it is clear that the UNLM and the NLML KS lose edges in many areas. This is not the case for the proposed Aw KS-NLM filter.
To confirm this visual assessment, we refer to the Pratt's Figure Of Merit (FOM) [38] to quantify the filter's capabilities on detecting the edges and preserving their shape. This measure is based upon three issues: detection of all possible edges, localization (all edges should be placed in the correct location), and spurious response by avoiding false alarms [38]. FOM is a common measure used in image processing for assessment of edge preservation and it is calculated as, where N I and N A are the number of actual and detected edges respectively, d k denotes the Euclidean distance from the k th detected edge pixel to the nearest reference edge pixel and, α is a scaling constant that modulates the cost of edge displacement.The value of FOM parameter ranges from 0 to 1 and, the higher value, the better the filter is on detecting and preserving the edges. Table 2 reports the Pratt's FOM for the NL filters (high noise level(σ = 20). These results confirm the superiority of the Aw KS-NLM for preserving the edges (FOM ≈ 0.9). FOM results for the other noise levels are similar.

3) CONTRAST COMPARISON
The noise content within the image notably degrades the contrast between tissues in the MRI data which is mostly noticed with high noise levels (see for instance, Figure 16 for actual MRI data or Figure 9 for simulated data). Regarding the image contrast, the best NLM algorithm is the one providing a good restored contrast. For that, we focus on studying the contrast between the bright gray and the dark gray matters (see Figure 12), whose binary masks are obtained after applying a suitable threshold value. We multiply the restored images with these binary masks to obtain two isolated regions that correspond to the bright gray matter and white gray matter. Finally, we compute the contrast for each filtering solution by using [39]: where µ y BG and µ y DG denote the mean intensity values in the regions of bright gray matter and dark gray matter related to the noise-free image respectively and, µˆy BG and µˆy DG represent the mean intensity values in the regions of bright gray matter and dark gray matter related to the restored image respectively. Figure 13 illustrates the contrast values provided by the NLM filtering algorithms. We can confirm the good ability of our solution on restoring the contrast of the brain simulated MRI data since it presents the highest contrast values followed by the UNLM and, then, by the conventional NLM. Moreover, we notice that the NLML KS gets the lowest values of contrast which concludes its incapability on restoring the contrast for the different noise levels. In fact, when σ = 20, the restored contrast by NLMLKS is only 80% comparing to our proposed method that restores approximately 94% of the contrast. Contrasts between the bright gray matter and the dark gray matter given by: UNLM (black), the conventional NLML (blue), NLML KS (green) and our proposed method (red), on the simulated brain phantom dataset corrupted with Rician noise of σ varying from 2 to 20.

4) SHARPNESS COMPARISON
The aim of this comparison method is to conclude the best filter on preserving the sharpness of the image. Several methods have been implemented in order to measure the sharpness. In this paper, we focus on measuring the sharpness metric by referring to an extended gradient-based Tenengrad method [40].
Assuming that I (a, b) is the intensity pixel value at the position (a, b), the sharpness measure is given as follows: where 2 denote the horizontal and vertical weights respectively, G a and G b represent the horizontal and vertical gradients obtained using Sobel filters respectively and, r and c are the total number of rows and columns related to the image.
It should be noted that isolated noise points and blocks may increase sharpness values. Moreover, the higher is the sharpness values, the better the filter is.
The sharpness measurement for the different NL filtering algorithms used in this experimental setup are shown in Figure 14 where it can be seen that the conventional NLML, followed by the NLML KS filtering algorithm, present the lowest values of sharpness for the noise level σ range going from 5 to 20, differently from our proposed method that presents the highest values of sharpness measurement for a range of σ going from 2 to 15 which confirms its good ability on preserving the sharpness of the edges. As for the UNLM filter, it presents the worst value for this metric for the low noise level (σ = 2). However, it becomes better than both NLML and NLML KS as σ increases. Finally, for high noise levels, the UNLM provides the highest sharpness value, due to some isolated high noise points and blocks, followed by our developed Aw KS-NLM and, then, by NLML and NLML KS .

5) METHOD ERROR COMPARISON
Finally, we use the method error comparison to assess the filtering operation. Let Y = {y i |i ∈ I } andŶ = {ŷ i |i ∈ I } be the noise-free and the restored MR magnitude images respectively defined on a discrete grid I . Hence, the method error image D = {d i |i ∈ I } is described as follows: Therefore, the less edges and image details are contained in D, the better the filter performs (ideally, the remains in D should be as small as possible). Figure 15 shows the method error images for the NL filters applied to the MRI brain phantom simulated data with 3 different noise levels: σ = 2, σ = 10 and σ = 20. The proposed Aw KS-NLM filter shows little remains within the error image (it is the best under this metric) and, the worst result is for the UNLM. For the high noise levels, both UNLM and NLML KS filtering algorithms illustrate the worst error map images (texture, contours and details are highlighted, strongly implying that such information is lost in the estimated denoised images and confirming the graphical results previously mentioned).
From above, the excellent performances provided by the proposed Aw KS-NLM filter has been numerically assessed. Next Section is devoted to confirm its superiority over the other NL filters used in this comparative analysis for real MRI data.

V. REAL DATA
In this Section, we focus on evaluating the performance of our proposed solution, in comparison with the previously defined NL algorithms, on real MR images. We start to describe the main characteristics provided by the selected MRI data in two different test cases (Section V-A). We illustrate the experimental results given by the selected filtering approaches for both test cases (Sections V-B and V-C).

A. MRI DATASETS
We illustrate a 512 × 512 real MRI brain data which is provided by The Cancer Imaging Archive (TCIA) database (https://www.cancerimagingarchive.net/). This data was obtained using a gradient echo sequence on a Siemens 1.5-T MAGNETOM Sonata system and characterized by an Echo Time TE = 20 ms and a Repetition Time TR = 666.66 ms. The slice thickness is 5 mm, the FOV is 220 × 220 mm 2 and the Flip angle is 90 • . In addition, we present a 466×405 real MRI brain acquired using a Philip Achieva 3.0T MR scanner. The acquisition is characterized by a spatial resolution of 0.45 × 0.45 mm. The Spi Echo sequence has been adopted, with TE = 140 ms and TR = 700 ms. Figure 16 illustrates both real MRI datasets with two different noise levels.

B. EXPERIMENTAL RESULTS: BRAIN MRI LOW NOISE
First, we visually illustrate the filters performance on denoising the real data, and thereafter, we present the residual error maps. Finally, we discuss the local statistical metrics. Figure 17 shows the result for the low noise MRI brain data (see a zoom of a 150 × 150 selected area in Figure 18. It can be noticed that all filters perform well in reducing noise and preserving details, but, the proposed Aw KS-NLM technique resembles clearly superior, even providing a better image contrast.

2) RESIDUAL ERROR MAPS
Let us consider Z = {z i |i ∈ I } andŶ = {ŷ i |i ∈ I } two noisy and restored real MR magnitude images respectively defined on a discrete grid I . Thus, the residual error map image = { i |i ∈ I } is described as follows: It is expected that more amount of noise and few details should remain within the residual error map image (it would confirm the efficiency of the filter on removing the noise and preserving the main structure of the image).
The residual maps can be seen in Figure 19, where the good performance of the proposed Aw KS-NLM is confirmed under this metric.

3) LOCAL STATISTICAL METRICS
In this Section, we evaluate the filters' capabilities on the basis of the local statistical metrics related to the real MRI data. In fact, the best filtering solution is the one that, within an homogeneous area, provides the lowest estimated standard deviation while preserving the mean of the MRI data. For this reason, we select two different homogeneous Regions of Interest (RoI) from the noisy MRI brain (the blue box denotes the first RoI and the green box represents the second RoI as sketched in Figure 17) wherein we estimate the local mean and standard deviation. Thereafter, we compute the estimated meanμ and standard deviationσ provided by the NL filtering approaches for each RoI. Table 3 reports the values of local mean and local standard deviation, together with the percentage of mean preservation, related to the proposed NL approaches in two different RoIs.
From these results, the good performance of the Aw KS-NLM is confirmed. In fact, our proposed solution presents the highest % of mean preservation average (≈99.85) in both RoIs with a considerable low value ofσ . The UNLM filtering algorithm gets the lowest estimated variance (≈3.33 in the first RoI and ≈6.67 in the second RoI). As for the conventional NLML, it shows the worst values in terms of the percentage of mean preservation and variance estimation which confirms its poor performance previously discussed.

C. EXPERIMENTAL RESULTS: BRAIN MRI HIGH NOISE
We replicate the same experiments for the case of high noise MRI data and apply the same metrics. Figure 20 shows the results for all the NL filters used (see a zoom of a 180 × 150 selected area in Figure 21). As in the low noise case, all NL filters perform well in reducing  noise and preserving details, but, the proposed Aw KS-NLM technique resembles clearly superior, also providing a better image contrast.

2) RESIDUAL ERROR MAPS
The residual maps can be seen in Figure 22, where the good performance of the proposed Aw KS-NLM is  confirmed by this analysis. We also notice the presence of many details in the residual map images presented by NLML and NLML KS solutions which confirm their poor performance on preserving important features of the image.

3) LOCAL STATISTICAL METRICS
We selected two RoIs and estimated the local mean and standard deviation related to these areas (see Table 4). Once again, the proposed Aw KS-NLM reaches the highest percentage of mean preservation in both RoIs with a second lower variance reduction valueσ , which is slightly lower only for the UNLM filter. Also, the conventional NLML presents the lowest value of percentage of mean preservation and the highest value ofσ compared to the other NL filters which confirms the obtained denoising results and the visual inspection.
Finally, a sensitivity analysis for the T-parameter is provided for the Aw KS-NLM for the real brain MRI data (high noise case). To this aim, we evaluate the evolution of the percentage of distortion in mean preservation (distortion = (µ NoisyRoI −μ estimated )/µ NoisyRoI ) and variance estimation for   both selected RoIs while varying the T-parameter, ranging from 0.075 to 0.25, as shown in Figure 23.
It is worth to note that the maximum distortion in mean preservation is in the order of 2% in both selected VOLUME 8, 2020 FIGURE 23. Evolution of the % of the mean distortion and variance estimationσ related to the proposed Aw KS-NLM in the first selected RoI (blue) and the second one (green), as a function of the T-parameter, for the real brain MRI in high noise level.
homogeneous areas, which seems to be an interesting result that confirms the capability of our proposed solution on preserving statistical measures within the selected RoIs. Moreover, we analyzed the stability of the performance related to the Aw KS-NLM in terms of mean preservation and variance estimation while reaching a T-parameter equal to 0.175 which confirms the tuning process and the use of this value for the real MRI data case.

VI. CONCLUSION
MR image denoising draws an ever increasing attention in the scientific literature, with several new techniques developed and proposed each time. In this framework, the Authors have proposed an improved version of the KS-NLM algorithm that takes into consideration the local weights given by the patches, in addition to the anisotropy, for reducing Rician noise in MRI data.
The proposed test has shown interesting and promising capabilities in both simulated and real MR images comparing to some widely used NL algorithms: UNLM, NLML and NLML KS . Concerning the simulated framework, we referred to some widely known numerical indexes including: PSNR and MSSIM, that illustrate the good capabilities of our proposed solution on removing the Rician noise and preserving the most important characteristics of the simulated brain phantom image. In addition to visual and numerical assessments, we focus on proceeding with the edge preservation, contrast, sharpness and method error comparisons that prove the good performance of the Aw KS-NLM. Two different real MRI brain data (high noise and low noise) were analyzed. For both cases, based on the visual inspection and numerical assessment, it is clear that the proposed Aw KS-NLM turns to be a very useful instrument for removing noise from real MRI data. The main limitation of the algorithm is that, in case of homogeneous areas, it can produce some artifacts. In case of high noise this effect is more evident. Nevertheless, real data are generally less homogeneous than the simulated data, making this drawback less problematic.
Future work includes extending this study to compare filters performances on other MRI real data. Additionally, this work may be extended to deal with multicontrast stack of MRI data.