Abstract
The use of a mathematical model is proposed in order to denoise X-ray two-dimensional patterns. The method relies on a generalized diffusion equation whose diffusion constant depends on the image gradients. The numerical solution of the diffusion equation provides an efficient reduction of pattern noise as witnessed by the computed peak of signal-to-noise ratio. The use of experimental data with different inherent levels of noise allows us to show the success of the method even in the case, experimentally relevant, when patterns are blurred by Poissonian noise. The corresponding MatLab code for the numerical method is made available.
Keywords: X-ray patterns, denoising, diffusion equation
1. Introduction
The study of the properties of crystalline materials mainly relies on the use of X-ray diffraction (XRD) techniques, which give relevant information for several applications as, for example, in nanotechnology [1,2]. The processing of such data requires a chain of preliminary steps aiming at improving the quality of XRD data [3,4]. The removal of inherent noise is of fundamental importance since it helps in separating the effective crystallographic data from the background signal in order to estimate nano and biomaterial features. Several techniques were developed to reduce noise to acceptable levels [5,6,7,8,9,10,11,12,13,14,15,16]. Initial methods were based either on polynomial filtering of recorded spectra in spatial domain [5] or on the use of Fourier smoothing in frequency domain in order to remove the high-frequency components of the spectrum [17]. Other approaches were also proposed which make use either of the singular value decomposition [7,8] or of the Hankel-Lanczos singular value decomposition algorithms [10].
In the framework of image processing [18] a different approach was proposed by considering the diffusion process in order to filter images. The idea behind is that the diffusion equation applied to an image can smooth the noise. The main drawback is that the edge of images cannot be maintained since the Laplacian operator of the diffusion equation is linear. This aspect was conveniently overcome when anisotropic diffusion was proposed aiming to preserve the edge efficiently [19]. Indeed, the latter method is able to detect edges without smoothing and/or shifting them at the scale of interest. What the method makes is to iteratively filter the image by using a smoothing kernel with small support thus obtaining a sequence of diffused images with decreasing resolution. This is achieved by introducing an effective diffusion constant which depends inversely on the modulus of the image gradient. The net effect is to obtain a diffused image which converges to a final configuration without sharp edges. A further improvement was obtained by introducing a somewhat biased anisotropic diffusion [20] where the diffusion equation is supplemented by an additional source term which favors the convergence of the method to the solution of interest.
Several methods were later put forward. We cite, among others, non-local algorithms [21] and nonlinear scale-space approaches [22]. In the former case a procedure which relies on a non local averaging of all the pixels in the image, is introduced. The provided results show better performance in noise reduction with respect to local smoothing methods (like, for example, the ones in [19,20]) but the computational cost and complexity to be paid are relevant. This latter aspect is the main drawback of even more complicated formulations. Indeed, the results in [22] are very good but the method reveals to be complex in two spatial dimensions requiring the tuning of a total of four free parameters. The method which we propose to use for XRD data is very simple being local and with only one free parameter for two dimensional patterns, as later shown. The overall performance in terms of figure-of-merit indicators might be not the optimal one but this is a reasonable price to be paid when processing large set of images obtained in X-ray experiments. The rapidity and easiness in the processing chain are as well relevant to be taken into account. This does not preclude the possibility of further improvements [23].
The methods in [19,20] were devised to accomplish with the task on Gaussian-noise affected images, where mean and variance are not related each other; on the other hand, in several experimental setups the signal is recorded onto counting devices, such as photomultipliers, -counters, proportional chambers, imaging plates, charge-coupled-devices, (e.g., in XRD [24] or micrographs in cryo-electron microscopy experiments [25]), where a Poisson statistics is understood. It is known that a Poisson statistics resembles a Normal (Gaussian) one in the large counting limit (The probability density function for a Poisson distributed random variable reads:
i.e., a Gaussian probability density function () with mean n and variance n, q.e.d.). In the present paper, we propose for the first time the use of the biased anisotropic diffusion equation [20] to XRD images showing the possibility of using it as a powerful method in the pre-processing of such images for Poisson noise reduction. We prove that the present method is simple and computationally efficient accomplishing its scope. A finite-difference method (FDM) is adopted to solve numerically the aforementioned equation. The paper is organized in the following way. In the next section we outline the mathematical model used and the numerical procedure to solve the diffusion equation. Then we present the results obtained when processing images with either Gaussian or Poissonian noise. Finally, we discuss the main findings of this work.
2. The Model
In this section, we present the model used to derive the anisotropic diffusion equation and the method to solve it.
Any image has an intensity level that can be represented as a function where D is an open two-dimensional domain. Several methods were proposed that use the minimization of a proper energy functional to obtain a reconstructed image u starting from the degraded image f. Here we will consider the functional proposed in Ref. [20] which proved to be efficient in image filtering [26]. It reads as
| (1) |
where dimensional parameters , and are non-negative and is a continuity control function such that for each reconstructed image u, the cost has its minimum for one optimal control function . The resulting partial differential equation is obtained from the minimization of Equation (1) by using the maximum principle [27] and reads as [20]
| (2) |
where the function w is chosen to be [20]. Equation (2) is a diffusion equation with diffusion constant supplemented by a source term . It is useful to cast it in dimensionless form
| (3) |
where the new variables and are dimensionless being and .
The diffusion Equation (3) is solved by using a finite-difference scheme [28]. The function u is defined on the nodes of a square lattice with spacing . The variable is discretized in steps with values , . Any discretized function at time on a node () () of the lattice of size is denoted by . The diffusive term is implemented by using an explicit Euler algorithm as
| (4) |
where the derivatives are computed by using a second-order centered scheme
| (5) |
The degraded image f is used as initial condition. We set and the value of in the function w was fixed to be where is the resolution of the image [29]. The parameter was varied to guarantee the numerical stability of the numerical method while was used to optimize the procedure for getting the best improved image in the sense that will be later discussed.
3. Numerical Results
In this section, the results in the processing of different kinds of images will be presented.
The only parameters that are left in the numerical solution of Equation (3) are and . We found that is the highest value that can be used to guarantee stability without slowing down the convergence of the method to the optimal solution. Indeed, one has to balance between the need for using the highest possible value of to reduce the number of iterations to achieve the final reconstructed image and the requirement of stability which fixes an upper bound for . The efficiency in image filtering is evaluated by measuring the peak signal noise ratio (PSNR) defined as
| (6) |
where is the original image without noise and denotes a sum over all the pixels of the images. This quantity is measured in decibels and higher values correspond to a better denoising. The parameter was varied in our method to obtain the highest possible values of PSNR.
We first tested the method on the classical Lenna image where Gaussian noise with zero average and variance 0.05 is added on the noiseless image with resolution . The results are shown in Figure 1. It can be seen that for , the PSNR decreases at high values of after reaching a maximum. For values keeps constant after an initial increase. The final value decreases with the increase of . The best performance, in terms of the PSNR, is obtained for and the corresponding final reconstructed image is reported in the bottom right panel of Figure 1.
Figure 1.
Algorithm performance for the Lenna image with resolution . Top left: Noiseless image ; Top right: PSNR as a function of for and . Bottom left: Input noisy image f with Gaussian noise; Bottom right: Best output image for .
In previous studies [26], where Equation (2) was solved by using a different mathematical method, the role of the image resolution on the PSNR was not investigated. To fill this gap we repeated the aforementioned procedure of Figure 1 by changing the resolution of the processed image. The qualitative behavior of the PSNR is similar for the different resolutions a shown in Figure 2. However, some comments are in order. For the lower resolution () the best output is obtained for while better resolutions ( and ) have the optimal performance for which is the same values found in Figure 1. This indicates that when increasing the resolution of the image, the best value for does not change (To keep the correct scale with respect to the original image (L = 512) the value was preliminarily rescaled, i.e., ). On the contrary, the final value of the PSNR increases when improving the resolution.
Figure 2.
Top: PSNR as a function of for different resolutions of the Lenna image. Left: , and resolution ; Middle: , and resolution ; Right: , and resolution . Bottom: PSNR as a function of for different noise level of the Lenna image (resolution ). Left: , and noise ; Middle: , and noise ; Right: , and noise .
Beside the Gaussian-noise affected images, the experimental setups often collect data on two-dimensional arrays, where a Poisson counting statistics accordingly needs a noise reduction. In order to investigate the present approach on such noisy data, we applied the model to denoise XRD patterns collected on the collagen molecules in tendon-derived collagens, where under several biochemical conditions, a super-organization of tissue into triple helices (with a preferred orientation displayed by the -symmetric partial arcs of Figure 3 replacing the fully -symmetric circles) and a high crystalline domain can trigger mechanical stiffness (for details on sample preparation and experimental setup the interested reader is addressed to [30]). In Figure 3 the XRD patterns are shown. The noisy image (bottom left panel) was integrated on a collection time of 2400 s, resulting in a maximum counts below 1000, while the noiseless one (top left panel) required 327,350 s, with maxima reaching some 60,000. The input image was processed for several values of the parameter . The results for the PSNR are illustrated in the top right frame of Figure 3. The PSNR has trends similar to the case of Figure 1 with Gaussian noise. It can be seen that for , the PSNR decreases in the limit of high after reaching a maximum. When , the PSNR stays constant after an initial increase. The final value decreases when increasing . The output image with the best PSNR, obtained with , is reported in the bottom right panel.
Figure 3.
Algorithm performance for the XRD image with resolution . Top left: Noiseless image (rescaled to the input image); Top right: PSNR as a function of for and ; Bottom left: Input image f with Poissonian noise; Bottom right: Best output image with .
The optimal values of in maximizing PSNR depend on the type of noise. They are reported in Table 1 where we also compare the efficiency in noise reduction for the images with Gaussian (different levels) and Poissonian noises considered in the present work. The final values of PSNR strongly depend on the type of noise being higher in the case of XRD patterns.
Table 1.
Improvement of the PSNR and SSIM values with the use of the denoising procedure in the cases of images () with Gaussian (Lenna) and Poissonian (XRD) noise with the corresponding values of .
| Image | Noise | PSNR (Initial) | PSNR (Final) | SSIM (Initial) | SSIM (Final) | |
|---|---|---|---|---|---|---|
| Lenna | 4 | 0.01 | 45.31 | 45.77 | 0.93 | 0.94 |
| Lenna | 0.3 | 0.05 | 31.33 | 34.52 | 0.59 | 0.64 |
| Lenna | 0.08 | 0.10 | 25.31 | 30.22 | 0.41 | 0.46 |
| XRD | 0.06 | − | 49.61 | 49.77 | 0.10 | 0.33 |
To stress the algorithmic efficiency, we added the values of another figure of merit, namely the structure similarity (SSIM), as defined for instance in [31] and implemented in MatLab: PSNR/SSIM values increase for all cases analysed in this paper; they are in agreement with the visual inspection of the difference-images before/after applying the algorithm, as reported in Figure 4.
Figure 4.
Difference-images with respect to the noiseless 2D pattern for the initial (noisy, on the left) and final (denoised, on the right) images with resolution . The colorbar shows the difference ratios with respect to the noiseless pattern. Top: Lenna ( Gaussian noise level); Bottom: XRD pattern (Poissonian noise).
4. Discussion and Conclusions
We proposed the use of a denoising procedure for X-ray diffraction patterns. The method, which is based on the numerical solution of a generalized diffusion equation, was never been tested and adopted for XRD images which are of relevant experimental interest. Such images are characterized by the presence of Poissonian noise, typical of patterns obtained by counting detectors. The processing of such images is completely different from those affected by Gaussian noise due to the very different inherent nature of the noises, as previously commented. For this reason the elaboration of the former patterns required in the years devoted approaches. The main limitations in the available studies are related either to the computational cost [11] or complexity [14]. Very recent algorithms were proposed to tackle this problem for high-energy X-ray patterns [16] or for X-ray medical images [15].
The proposed method is characterized by a significant simplicity since the Equation (3) can be easily implemented by, for example, a MatLab code. Despite of this, it can attain significant performance even in this case by reducing the noise level as witnessed by the measured values of the peak signal-to-noise ratio and of the structure similarity. In particular, we showed that an improvement in the values of the PSNR and of the SSIM can be obtained when considering also the source term () in Equation (2). The parameter is the only free parameter that has to be tuned to obtain the better performance of the method. The advantage in using an effective diffusion constant, which depends inversely on the modulus of the image gradient, is to obtain a final image without sharp edges while the source term facilitates the convergence of the algorithm.
The present results open up the possibility of using the method in the pre-processing chain of X-ray diffraction images or cryo-electron microscopy micrographs. Moreover, the MatLab code developed to implement the method is computationally efficient to allow the processing of a high numbers of images in reasonable amount of time. As a matter of comparison we report that the processing-time for a typical XRD pattern is of a few seconds on a laptop. The availability of several denoising methods asks for an intensive and accurate comparison among them. We devote this study to a future publication.
Acknowledgments
The authors wish to acknowledge D. Altamura and C. Giannini for providing them with XRD patterns.
Author Contributions
M.L. and A.L. conceived the project, developed the method, interpreted the data and wrote the paper. Both authors discussed the results and commented on the manuscript. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Conflicts of Interest
The authors declare no conflict of interest.
Footnotes
Sample Availability: MatLab codes are available.
References
- 1.Guagliardi A., Giannini C., Cedola A., Mastrogiacomo M., Ladisa M., Cancedda R. Toward the X-ray microdiffraction imaging of bone and tissue-engineered bone. Tissue Eng. Part B Rev. 2009;15:423–442. doi: 10.1089/ten.teb.2009.0034. [DOI] [PubMed] [Google Scholar]
- 2.Sibillano T., Terzi A., De Caro L., Ladisa M., Altamura D., Moliterni A., Lassandro R., Scattarella F., Siliqi D., Giannini C. Toward the X-ray microdiffraction imaging of bone and tissue-engineered bone.Wide angle x-ray scattering to study the atomic structure of polymeric fibers. Crystals. 2020;10:274. doi: 10.3390/cryst10040274. [DOI] [Google Scholar]
- 3.Cervellino A., Guagliardi A., Giannini C., Ladisa M. Folding a two-dimensional powder diffraction image into a one-dimensional scan: A new procedure. J. Appl. Crystallogr. 2006;39:745–748. doi: 10.1107/S0021889806026690. [DOI] [Google Scholar]
- 4.Siliqi D., De Caro L., Ladisa M., Scattarella F., Mazzone A., Altamura D., Sibillano T., Giannini C. SUNBIM: A package for X-ray imaging of nano and biomaterials using SAXS, WAXS, GISAXS and GIWAXS techniques. J. Appl. Crystallogr. 2016;49:1107–1114. doi: 10.1107/S1600576716006932. [DOI] [Google Scholar]
- 5.Mierzwa B., Pielaszek J. Smoothing of low-intensity noisy X-ray diffraction data by Fourier filtering: application to supported metal catalyst studies. J. Appl. Crystallogr. 1997;30:544–546. doi: 10.1107/S0021889897000198. [DOI] [Google Scholar]
- 6.Hieke A., Dörfler H.-D. Methodical developments for X-ray diffraction measurements and data analysis on lyotropic liquid crystals applied to K-soap/glycerol systems. Colloid Polym. Sci. 1999;277:762–776. doi: 10.1007/s003960050450. [DOI] [Google Scholar]
- 7.Schmidt M., Rajagopal S., Ren Z., Moffat K. Application of singular value decomposition to the analysis of time-resolved macromolecular X-ray data. Biophys. J. 2003;84:2112–2129. doi: 10.1016/S0006-3495(03)75018-8. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Rajagopal S., Schmidt M., Anderson S., Ihee H., Moffat K. Analysis of experimental time-resolved crystallographic data by singular value decomposition. Acta Crystallogr. Sect. D. 2004;60:860–871. doi: 10.1107/S0907444904004160. [DOI] [PubMed] [Google Scholar]
- 9.Ladisa M., Lamura A., Laudadio T., Nico G. Model independent pre-processing of X-ray powder diffraction profiles. Digit. Signal Process. 2007;17:327–334. doi: 10.1016/j.dsp.2006.02.001. [DOI] [Google Scholar]
- 10.Ladisa M., Lamura A., Laudadio T., Nico G. Application of the HLSVD Technique to the Filtering of X-Ray Diffraction Data. EURASIP J. Adv. Signal Process. 2007 doi: 10.1155/2007/39575. [DOI] [Google Scholar]
- 11.Makitalo M., Foi A. Optimal inversion of the anscombe transformation in low-count poisson image denoising. IEEE Trans. Image Process. 2010;20:99–109. doi: 10.1109/TIP.2010.2056693. [DOI] [PubMed] [Google Scholar]
- 12.Bindilatti A.A., Mascarenhas N.D. A nonlocal poisson denoising algorithm based on stochastic distances. IEEE Signal Process. Lett. 2013;20:1010–1013. doi: 10.1109/LSP.2013.2277111. [DOI] [Google Scholar]
- 13.Salmon J., Harmany Z., Deledalle C.A., Willett R. Poisson noise reduction with non-local PCA. J. Math. Imaging Vis. 2014;48:279–294. doi: 10.1007/s10851-013-0435-6. [DOI] [Google Scholar]
- 14.Xu J., Zhang L., Zuo W., Zhang D., Feng X. Patch group based nonlocal self-similarity prior learning for image denoising; Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV); Santiago, Chile. 7–13 December 2015; pp. 244–252. [Google Scholar]
- 15.Mandić I., Peić H., Lerga J., Štajduhar I. Denoising of X-ray Images Using the Adaptive Algorithm Based on the LPA-RICI Algorithm. J. Imaging. 2018;4:34. doi: 10.3390/jimaging4020034. [DOI] [Google Scholar]
- 16.Kim K., Choi J., Lee Y. Effectiveness of Non-Local Means Algorithm with an Industrial 3 MeV LINAC High-Energy X-ray System for Non-Destructive Testing. Sensors. 2020;20:2634. doi: 10.3390/s20092634. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Aubanel E.E., Oldham K.B. Fourier smoothing without the fast Fourier transform. Byte. 1985;10:207–222. [Google Scholar]
- 18.Aubert G., Kornprobst P. Mathematical Problems in Image Processing. Springer; New York, NY, USA: 2002. [Google Scholar]
- 19.Perona P., Malik J. Scale-space and edge detection using anisotropic diffusion. IEEE Trans. Pattern Anal. Mach. Intell. 1990;12:629–639. doi: 10.1109/34.56205. [DOI] [Google Scholar]
- 20.Nordström K.N. Biased anisotropic diffusion: A unified regularization and diffusion approach to edge detection. Image Vis. Comput. 1990;8:318–327. doi: 10.1016/0262-8856(90)80008-H. [DOI] [Google Scholar]
- 21.Buades A., Coll B., Morel J.M. A non-local algorithm for image denoising; Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition; San Diego, CA, USA. 20–25 June 2005. [Google Scholar]
- 22.Burger M., Gilboa G., Osher S., Xu J. Nonlinear inverse scale space methods. Commun. Math. Sci. 2006;4:179–212. doi: 10.4310/CMS.2006.v4.n1.a7. [DOI] [Google Scholar]
- 23.Chatterjee P., Milanfar P. Is Denoising Dead? IEEE Trans. Image Process. 2010;19:895–911. doi: 10.1109/TIP.2009.2037087. [DOI] [PubMed] [Google Scholar]
- 24.Altamura D., Lassandro R., De Caro L., Siliqi D., Ladisa M., Giannini C. X-ray MicroImaging Laboratory (XMI-LAB) J. Appl. Crystallogr. 2012;45:869–873. doi: 10.1107/S0021889812025733. [DOI] [Google Scholar]
- 25.Cressey D., Callaway E. Cryo-electron microscopy wins chemistry Nobel. Nature. 2017;550:167. doi: 10.1038/nature.2017.22738. [DOI] [PubMed] [Google Scholar]
- 26.Chen J., Chai Z., Shi B., Zhang W. Lattice Boltzmann method for filtering and contour detection of the natural images. Comput. Math. Appl. 2014;68:257–268. doi: 10.1016/j.camwa.2014.05.023. [DOI] [Google Scholar]
- 27.Nirenbarg L. A strong maximum principle for parabolic equations. Commun. Pure Appl. Math. 1953;VI:167–177. doi: 10.1002/cpa.3160060202. [DOI] [Google Scholar]
- 28.Strikwerda J.C. Finite Difference Schemes and Partial Differential Equations. Chapman and Hall; New York, NY, USA: 1989. [Google Scholar]
- 29.Canny J. A computational approach to edge detection. IEEE Trans. Pattern Anal. 1986;6:679–698. doi: 10.1109/TPAMI.1986.4767851. [DOI] [PubMed] [Google Scholar]
- 30.Terzi A., Storelli E., Bettini S., Sibillano T., Altamura D., Salvatore L., Madaghiele M., Romano A., Siliqi D., Ladisa M., et al. Effects of processing on structural, mechanical and biological properties of collagen-based substrates for regenerative medicine. Sci. Rep. 2018;8:1429. doi: 10.1038/s41598-018-19786-0. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 31.Wang Z., Bovik A.C., Sheikh H.R., Simoncelli E.P. Image Quality Assessment: From Error Visibility to Structural Similarity. IEEE Trans. Image Process. 2004;13:600–612. doi: 10.1109/TIP.2003.819861. [DOI] [PubMed] [Google Scholar]




