Spatial Filtering of Images

Command: Preprocessing > Filter > Spatial

The command Preprocessing>Filter>Spatial allows to smooth images by replacing each pixel with the product of the selected filter kernel and the corresponding pixels in a square window surrounding it. The window size can be set by the "Window Size" control and may assume any odd integer value between 3 and 25. At the top of the window the spectrum at the image cursor position is displayed. Beneath the spectrum you find the images of the currently active layer and a preview of the smoothed result.

The tool provides the following filter modes:

  • uniform lowpass: moving average filter
  • binomial lowpass: binomial weighted average filter
  • binomial highpass: applies a binomial highpass filter
  • Sobel filter: applies a Sobel filter to the image (edge detection)
  • Laplace filter: calculates the (smoothed) two-dimensional second derivative of the image
  • spatial variance: each pixel is replaced by the variance of the pixels of the surrounding square window.
  • quantile filter: the quantile filter replaces each pixel by the quantile of the square window surrounding it. Setting the quantile to 0.5 results in a median filter.

In order to perform the smoothing of the image data click the "Apply" button. The layers to be processed can be selected by adjusting the corresponding controls, or by dragging the dashed cursors in the spectrum. Please note that these boundaries will differ between different types of spectra and are stored per spectral group. Hence you have to define the boundaries for each spectral group. In addition you can select a pixel mask which indicates all pixels which are not to be smoothed. This way you can selectively smooth parts of an image.

If the selected range of layers is less than 6 layers you have the option to add the processed layer to the image repository (instead of processing the original data) by ticking the checkbox "Results to Repository".

The following example shows the effect of smoothing on images. At the top left you see the unprocessed image which consists of 21 by 21 pixels (5-fold oversampled). Smoothing this image not only reduces noise but also blurs the image. The blurring effect may accumulate to result in completely destroyed image details if the size of the smoothing window approaches the size of the structure (bottom right image, where the smoothing window is 17x17 pixels).