The salt-and-pepper noise randomly changes the pixel values of the image to zero or \({2}^{k}-1\), where k is the maximum number of bits used in the image, and it’s equal to 16 for all databases in this study [18]. After applying multimodal noise, the noise filtering and removal stage enhances the image quality, with noise levels from 1–98% in brain MRI images. Multimodal noise means that an MRI image has different noise densities simultaneously. The proposed method for the removal of salt-and-pepper noise with multimodal densities in medical images is described below:
For each pixel of the noisy input image, an adaptive \(n\times n\) window is considered in the neighborhood of that pixel, where \(n\) depends on the noise value. If the pixels of this window are not noisy, they are weighted according to their distance from the desired pixel. The greater the distance, the less weight they gain. The relation between this weight and distance shows in Eq. (1):
$$W\left(k\right)={10}^{-\left(k-1\right)} , k=\text{1,2},\text{3,4},\dots \left(1\right)$$
where \(k\) is the distance between the window pixel and desired pixel, and \(W\), is the desired weight.
Then, the weighted sum of the neighboring pixels is averaged, and the noisy pixel replaces with the resulting value. Indeed, the value of a pixel that is one unit or less away from the desired pixel appears with the weight of one. The farther pixels appear with a weight of less than one in calculating the average of total values of neighboring pixels. For calculating the final value, the weighted sum of the value of the adjacent pixels is divided by the number of pixels at the same distance from the desired pixel, multiplied by the weight of that distance. In this process, the desired window dimensions are the size of the first window that contains healthy pixels without noise. The higher the noise density, the larger the window size in which healthy pixels are found. All windows with low to high dimensions are tested, and the first window with a healthy pixel will be the best window for noise removal at that density. In addition, the desired weight is larger for a window with smaller dimensions and vice versa. In this method, in addition to removing multimodal noise in an image, noise with a specific density (single mode) in each image is also removed with similar or better results. The new method is an adaptive local window-based method. That is its main novelty, which eliminates the existing noise from its region-even a tiny region- in the image, and the other areas remain without change. Other methods tampered and blurred the whole image. The proposed method is applied to seven databases containing 208 medical images of brain MRI. Figure 2 shows some examples of the existing database with multimodal noise. The pseudocode of new mentioned algorithm is shown as Algorithm 1.
Algorithm 1. The pseudocode of the new method |
\(input=mainImage\) \(output=filteredImage\) \(for m=1:size\left(rows\left(input\right)\right)\) \(for n=1:size\left(column\left(input\right)\right)\) \(d=distance between desired and window pixel\) \(if input\left(m,n\right)=S\&P noise\) \(for i=m-d:m+d\) \(for j=n-d:n+d\) \(if input\left(i,j\right)\ne S\&P noise\) \(for k=1:d\) \(if k\le d\) \(W\left(k\right)={10}^{-(k-1)}\) \(sum=sum+(input\left(i,j\right)\times W\left(k\right))\) \(count\left(k\right)=count\left(k\right)+1\) \(continue\) \(end\);\(end\);\(end\);\(end\);\(end\);\(end\); \(if W\times count\ne 0\) \(output=\frac{sum}{W\times count}\) \(end\);\(end\);\(end\); |
The evaluation results of the proposed salt-and-pepper noise removal method based on two key factors, the PSNR and SSIM, are done on the existing databases with Eq. 2 and Eq. 3 [18, 19]. The mean PSNR and SSIM results for multimodal noise (in the range of 1% -98%) in each database are shown in Table 1.
$$PSNR\left(I,{I}_{n}\right)=10 \times {\text{log}}_{10}\frac{\left({MAX}_{I}^{2}\right)}{\frac{1}{MN}\sum _{i=0}^{N-1}\sum _{j=0}^{M-1}{(I\left(i,j\right)- {I}_{n}\left(i,j\right))}^{2} } \left(2\right)$$
$$SSIM\left(I,{I}_{n}\right)=\frac{\left(2{\mu }_{I}{\mu }_{{I}_{n}}+{c}_{1}\right)\left(2cov+{c}_{2}\right)}{\left({\mu }_{I}^{2}+{\mu }_{{I}_{n}}^{2}+{c}_{1}\right)\left({\sigma }_{I}^{2}+{\sigma }_{{I}_{n}}^{2}+{c}_{2}\right)}, \left\{\begin{array}{c}{c}_{1}={\left({k}_{1}L\right)}^{2} {k}_{1}=0.01\\ {c}_{2}={\left({k}_{2}L\right)}^{2} {k}_{2}=0.03\end{array}\right. \left(3\right)$$
where \({MAX}_{I}\), is the maximum possible pixel value of the original image \(\left(I\right)\), \({I}_{n}\) is the noisy image, \(M\times N\) indicates the dimensions of the original image, \({\mu }_{I}\) is the mean of the original image and \({\mu }_{{I}_{n}}\) is mean of the noisy image; \({\sigma }_{I}^{2}\)and \({\sigma }_{{I}_{n}}^{2}\) are the variances of the original and noisy images, respectively; \(cov\) is the value of noisy image covariance and \(L={2}^{nbp}-1\), where \(nbp\) is the\(\text{n}\text{u}\text{m}\text{b}\text{e}\text{r} \text{o}\text{f} \text{b}\text{i}\text{t}\text{s} \text{p}\text{e}\text{r} \text{p}\text{i}\text{x}\text{e}\text{l}\).
In addition, the mean results of these factors for each noise density (single mode) on every database are shown in Fig. 3 and Fig. 4 respectively.
Table 1
Mean PSNR and SSIM values of images of all databases, after multimodal noise removal
Database No. | Mean SSIM | Mean PSNR |
DB1 | 0.6338 | 25.9271 |
DB2 | 0.5412 | 30.1087 |
DB3 | 0.7389 | 27.5257 |
DB4 | 0.5524 | 29.5421 |
DB5 | 0.6054 | 27.2676 |
DB6 | 0.7598 | 32.5638 |
DB7 | 0.7011 | 32.4906 |
The comparison between previous methods and the proposed method to remove salt-and-pepper noise is shown in Table 2. In addition, the average PSNR of different noise cancellation methods is shown in Fig. 5. The most important advantage of the proposed method is that in addition to well eliminating each separate noise density in an image, it also removes several simultaneous noise densities in an image (multimodal noise) with the same algorithm, and high PSNR (Average 29.3465) is obtained. The proposed method has also been evaluated on many MRI medical images. It, therefore, has very reliable results compared to other methods tested on a small database.
Table 2
Comparison between previous methods of salt-and-pepper noise removal and the proposed method
Method | Database info | S&P Noise info | Average PSNR | Average SSIM |
ASWMF-Non medical images[10] | Non-medical, 20 grayscale images from UC Berkeley | 20%-40%-60%-80% | 26.8505 | 0.8071 |
ASWMF-MRI images[10] | MRI brain-124 grayscale images from MIRIAD | 20%-40%-60%-80% | 18.4946 | 0.5098 |
DAF-Non medical images[9] | Non medical-Barbara,Baboon,Cameraman,Couple,Lena,Peppers,Street,Man-made images | 10–90% | 29.7919 | 0.8799 |
Modified Two-Stage- Non-medical images[8] | Non-medical, Lena image | 60–97% | 33.9167 | 0.7427 |
New Enhanced Filter- Non-medical images[20] | Non-medical, mandrill, and Lena images | 10–90% | 27.0292 | not available |
CAMF-MRI images[4] | "MRI-15 images from Medanta Hospital" | results for 20% - others not available | 27.8158 | not available |
CDBFA- Non medical images[21] | Non-medical, Lena image | 10–90% | 32.5078 | not available |
Proposed method-MRI images (single-density noise) | MRI- 208 images from 7 databases | single density on each image - from 1–98% | 35.3028 | 0.7103 |
Proposed method- MRI images(multimodal noise) | MRI- 208 images from 7 databases | Multimodal on each image -from 1–98% | 29.3465 | 0.6475 |