Gaussian kernels: convert FWHM to sigma

When smoothing images and functions using Gaussian kernels, often we have to convert a given value for the full width at the half maximum (FWHM) to the standard deviation of the filter (sigma, \sigma). This happens because the implementation generally is in terms of sigma, while the FWHM is the more popular parameter in certain areas. The conversion is trivial, but it may well worth write it up here.

The probability density function (pdf) for the Gaussian distribution with mean \mu and standard deviation \sigma is:

f(x)=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}

If the filter is centered at the origin, the mean is 0 and the FWHM is the distance between the -x_w and +x_w that produces the half of the peak. For the normal distribution, the mean is the same as the mode (peak) and we have then to find the x_w that will produce f(x_w) = f(\mu)/2:

\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{x_{w}^{2}}{2\sigma^2}} = \frac{1}{2} \frac{1}{\sigma\sqrt{2\pi}}

For \sigma \neq 0 and solving for x_w:

x_w = \pm \sqrt{2\sigma^2\ln 2}

The FWHM is +x_w - (-x_w)=2 x_w:

\text{FWHM}=2\sqrt{2\sigma^2\ln 2}=\sigma\sqrt{8\ln 2}

Which gives 2.35482004503 as the conversion factor, i.e., \text{FWHM} \approx 2.355\cdot \sigma.

Some software packages, such as SPM and FreeSurfer, interact with the user in terms of FWHM, whereas others, such as FSL, prefer \sigma. The relation above allows converting quickly between one and other representation.

1 thought on “Gaussian kernels: convert FWHM to sigma

Leave a comment