Local Defects

Several modules enable direct or indirect editing of the SPM data. Even though most data processing changes the data in one way or another, this section describes functions and tools designed specifically for correction of local defects. They remove bad data from an image, and replace them using some interpolation method.

See also section Scan Line Artefacts for methods that deal with defects related to scanning.

Remove Spots Tool

The Remove Spots tool can be used for removing very small parts of the image that are considered a scanning error, dust particle or anything else that should not be present in the data. Note that doing so can dramatically alter the resulting statistical parameters of the surface, so be sure not to remove things that are really present on the surface.

While using this tool you can pick up position of the spot to magnify its neighbourhood in the tool window. Then, in the tool window, select a rectangle or ellipse (depending on chosen Shape) around the area that should be removed. You can then select one of several interpolation methods for creating data in place of the former spot:

  • Hyperbolic flatten uses information from outer boundary pixels of the selected area to interpolate the information inside area.
  • Laplace solver solves Laplace's equation to calculate data inside area; the outer boundary is treated as virtual source.
  • Pseudo-Laplace is a faster approximation of true Laplace equation solution. For small areas one can always use the true solver.
  • Fractal correction uses whole image to determine fractal dimension. Then tries to create randomly rough data that have the same fractal dimension and put them into the area.
  • Fractal-Laplace blend is a weighted average of fractal interpolation and Laplace solver. The interior is given by fractal interpolation, but close to region edges the Laplace interpolation is mixed in to provide a smoother continuation to the exterior.
  • Zero simply fills the area with zeros.

Clicking Apply will execute the selected algorithm.


Spot removal will only work for regions of size 80 × 80 pixels or smaller. To remove larger regions, create a mask using the Mask Editor tool, then use Data ProcessCorrect DataInterpolate Data Under Mask.

Remove Grains Tool

The simple Remove Grains tool removes manually selected connected parts of mask or interpolates the data under them, or possibly both. The part of mask to remove is selected by clicking on it with left mouse button.

The data available interpolation methods are a subset of those offered by Remove Spots tool, in particular Zero, Laplace's equation solution, Fractal correction and their blend.

Interpolate Data Under Mask

Data ProcessCorrect DataInterpolate Data Under Mask

This function substitutes data under the mask by the solution of solving the Laplace's equation. The data values around the masked areas define the boundary conditions. The solution is calculated iteratively and it can take some time to converge.

Zero Data Under Mask

Data ProcessCorrect DataZero Data Under Mask

This function simply fills masked data with zeros, which is sometimes less distracting than interpolation.

Fractal Correction

Data ProcessCorrect DataFractal Correction

The Fractal Correction module, like the Interpolate Data Under Mask module, replaces data under the mask. However, it uses a different algorithm to come up with the new data: The fractal dimension of the whole image is first computed, and then the areas under the mask are substituted by a randomly rough surface having the same fractal dimension. The root mean square value of the height irregularities (roughness) is not changed by using this module.


This calculation can take some time, so please be patient.


Running this module on data that do not have fractal properties can cause really unrealistic results and is strictly not recommended.

Mask of Outliers

Data ProcessCorrect DataMask of Outliers

This module creates mask of areas in the data that not pass the criterion. All the values above and below this confidence interval are marked in mask and can be edited or processed by other modules afterwards, for instance Interpolate Data Under Mask. This outlier marking method is useful for global outliers with values very far from the rest of the data.

Mask of Disconnected

Data ProcessCorrect DataMask of Disconnected

Local outliers are values that stick out from their neighbourhood. Function Mask of Disconnected marks data that do not seem to belong in the distribution of surrounding values.

The outlier type to mark can be selected as Positive, Negative or Both for values much larger than their neighbours, much smaller and both types simultaneously, respectively. Note that selecting Both can mark different areas than if positive and negative outliers were marked separately and the results combined.

The marking proceeds by subtracting a local background from the image and then marking global outliers in the resulting flattened image. Specifically, the local background is obtained by an opening (minimum), closing (maximum) or a median filter of given radius. The radius of the filter is controlled with Defect radius. It determines the maximum size of defect that can be found and marked. However, it is often useful to use larger radius than the actual maximum defect size.

Defect marking sensitivity is controlled with option Threshold. Smaller values mean more conservative marking, i.e. less values marked as outliers. Larger value means more values marked as outliers.