A computer implemented method of processing an EDX/XRF map, comprising the steps select a data point (dp) among a plurality of data points of the EDX/XRF map, wherein each of the data points comprise a local measured value (m) and a local dispersion value (v) of a measured variable; compare the local measured value (m) of the selected data point (dp) with a local threshold value (th), the local threshold value (th) based on the local dispersion value (v) of the selected data point (dp); determine a first modified mean value (M) based on the local measured value (m) of the selected data point (dp) and the local measured value of at least one neighboring data point neighboring the selected data point (dp), and determine a first modified dispersion value (V) based on the local dispersion value (v) of the selected data point (dp) and the dispersion value of the at least one neighboring data point, both when the local measured value (m) of the selected data point (dp) is below the local threshold value (th); compare the first modified mean value (M) with a first modified threshold value (TH) based on the first modified dispersion value (V); replace the local measured value (m) of the selected data point (dp) by the first modified mean value (M), when the first modified mean value (M) is above the first modified threshold value (TH), and when the first modified mean value (M) is below the first modified threshold value (TH): repeat determining a modified mean value based on local measured values of additional data points and repeat determining a modified dispersion value based on local dispersion values of the additional data points until an n-th modified mean value (M[n]) with n≥2 is above an n-th modified threshold value (TH[n]) being based on the n-th modified dispersion value (V[n]), and replace the local measured value (m) of the selected data point (dp) by the n-th modified mean value (M[n]), when the n-th modified mean value (M[n]) is above the n-th modified threshold value (TH[n]). select a data point (dp) among a plurality of data points of the EDX/XRF map, wherein each of the data points comprise a local measured value (m) and a local dispersion value (v) of a measured variable; compare the local measured value (m) of the selected data point (dp) with a local threshold value (th), the local threshold value (th) based on the local dispersion value (v) of the selected data point (dp); determine a first modified mean value (M) based on the local measured value (m) of the selected data point (dp) and the local measured value of at least one neighboring data point neighboring the selected data point (dp), and determine a first modified dispersion value (V) based on the local dispersion value (v) of the selected data point (dp) and the dispersion value of the at least one neighboring data point, both when the local measured value (m) of the selected data point (dp) is below the local threshold value (th); compare the first modified mean value (M) with a first modified threshold value (TH) based on the first modified dispersion value (V); replace the local measured value (m) of the selected data point (dp) by the first modified mean value (M), when the first modified mean value (M) is above the first modified threshold value (TH), and when the first modified mean value (M) is below the first modified threshold value (TH): repeat determining a modified mean value based on local measured values of additional data points and repeat determining a modified dispersion value based on local dispersion values of the additional data points until an n-th modified mean value (M[n]) with n≥2 is above an n-th modified threshold value (TH[n]) being based on the n-th modified dispersion value (V[n]), and replace the local measured value (m) of the selected data point (dp) by the n-th modified mean value (M[n]), when the n-th modified mean value (M[n]) is above the n-th modified threshold value (TH[n]). repeat determining a modified mean value based on local measured values of additional data points and repeat determining a modified dispersion value based on local dispersion values of the additional data points until an n-th modified mean value (M[n]) with n≥2 is above an n-th modified threshold value (TH[n]) being based on the n-th modified dispersion value (V[n]), and replace the local measured value (m) of the selected data point (dp) by the n-th modified mean value (M[n]), when the n-th modified mean value (M[n]) is above the n-th modified threshold value (TH[n]).