CT Lab

Chapter 29: Filtering and Denoising

Linear (Gaussian) and edge-preserving (median, bilateral, non-local means, anisotropic diffusion, TV) denoising. The trade-off between noise and detail.

Reconstructed images carry noise (Chapter 9). Raising the dose lowers noise, but there is a trade-off against exposure. So post-processing that reduces noise in the finished image is used. The difficulty of denoising is that noise and detail (edges and fine structures) are both high-frequency components. Smoothing naively erases the fine detail along with the noise. Good denoising smooths flat regions while keeping edges.

Linear filtering: Gaussian

The simplest is a linear filter that takes a weighted average of neighboring pixels. A Gaussian filter averages with larger weights for pixels closer to the center. Noise cancels out under averaging and does decrease, but because the weights depend only on spatial closeness, pixels on the far side of an edge enter the average too, and the edge is blurred. Linear filters are fast and straightforward, but they cannot escape this "blur the edge too" property.

Gaussian (linear)edge blurredBilateral (edge-preserving)edge keptw = w_space · w_range

Linear (Gaussian) vs edge-preserving (bilateral). The dashed line is the true step. Left: the Gaussian averages by spatial closeness alone, so the far side of the edge mixes in and the step is blurred. Right: the bilateral also weights by intensity closeness (w = w_space·w_range), so it does not average across the edge and keeps the step.

Edge-preserving nonlinear filters

To keep edges, you need the nonlinear trick of "averaging only similar pixels." There are several standard methods.

  • Median filter: takes the median of the window. Unlike the mean it is robust to outliers, removing salt-and-pepper (impulse) noise almost completely. Edges are kept because the median switches in a step.
  • Bilateral filter: weights by intensity closeness (wrangew_\text{range}) in addition to spatial closeness (wspacew_\text{space}). The far side of an edge differs greatly in intensity, so its weight is small, and smoothing does not cross the edge.
  • Non-local means (NLM): averages pixels whose surrounding small patches are similar. It exploits the redundancy that "similar patterns appear elsewhere in the image," smoothing while preserving texture.
  • Anisotropic diffusion (Perona–Malik): an iterative smoothing that diffuses heat only in directions of small intensity gradient and does not cross high-gradient edges.
  • TV (total variation) denoising: minimizes uf2+λTV(u)\lVert u-f\rVert^2 + \lambda\,\mathrm{TV}(u), favoring piecewise-flat solutions. It is the post-processing version of the TV regularization from Chapters 10 and 11.

Denoising is a trade against detail

Every denoiser reduces noise more as you smooth harder, but eventually it starts erasing real detail. Applied strongly, TV and anisotropic diffusion can turn gentle gradations into stepped flat patches (a cartoon-like look). How far to reduce noise is a trade against how fine the detail you want to keep is. The right answer depends on the purpose (the structure you want to see).

Quality metrics

How should the quality of denoising be measured? The simplest is the pixel difference from the truth. RMSE (root-mean-square error) is the size of that difference, smaller being closer to the truth. PSNR (peak signal-to-noise ratio) recasts RMSE as decibels on a log scale, where larger is better.

But RMSE and PSNR simply add up per-pixel differences equally, without seeing where the difference falls. Brighten the whole image slightly, for instance, and PSNR drops sharply even though the structure is preserved. Perceived quality is more sensitive to the preservation of structure (edges and patterns) than to a shift in brightness. SSIM (structural similarity index) captures this, measuring the agreement of luminance, contrast, and structure over local windows and averaging. It is 1 for a perfect match and falls as structure breaks down. SSIM is considered close to human perception and is widely used to evaluate denoising and super-resolution.

Simulation: comparing filters

A phantom with edges and flat regions is given Gaussian noise, and you choose a filter to apply. Left is the ground truth, middle is the noisy image, right is the denoised result. Closeness to the truth is measured by RMSE (smaller is better), PSNR (larger is better), and SSIM (closer to 1 is better; denoised / noisy). Applied strongly, the Gaussian blurs edges, while the bilateral filter and anisotropic diffusion reduce noise while keeping edges. Raise the strength too far and every method eventually loses detail, and SSIM drops.

Ground truth

WL 0.500 / WW 1.00Drag to adjust WL/WW

Noisy

WL 0.500 / WW 1.00Drag to adjust WL/WW

Denoised

WL 0.500 / WW 1.00Drag to adjust WL/WW
RMSE (denoised)0.046
PSNR26.7 dB
SSIM (after / before)0.708 / 0.181

A phantom with edges and flat regions is given Gaussian noise, and you choose a filter to apply. Left is ground truth, middle is noisy, right is denoised. RMSE is the difference from the truth; smaller is closer. Applied strongly the Gaussian blurs edges, while the bilateral filter and anisotropic diffusion reduce noise while keeping edges. Too much strength and every method eventually loses detail.

Relation to learned denoising

The deep-learning denoising of Chapter 13 is in this lineage too. The difference is that instead of a human designing the filter's shape, the network learns the statistics of the noise to remove from pairs of noisy and clean images. Trained well, it can outdo hand-designed filters, but it is weak on inputs outside its training distribution and risks fabricating structures that are not there. Hand-designed filters are transparent and predictable in behavior, so the two are chosen by the task.

Key points

Denoising is hard because noise and detail are both high-frequency, and good methods smooth flat regions while keeping edges. Linear filters like the Gaussian are fast but blur edges. Median, bilateral, non-local means, anisotropic diffusion, and TV keep edges through the nonlinear trick of "averaging only similar pixels." But every method eventually loses real detail as smoothing is pushed harder, so noise reduction and detail preservation are always a trade. Deep-learning denoisers differ by learning the noise statistics, aiming for higher quality at the cost of transparency.

References

On this page