Extended Data Edit

This section presents extended modules designed for editing (correcting)
SPM data. Using simple data editing tools presented in chapter
Data Edit and Correction
it is possible to correct many local scanning defects that
can be found on SPM images. There are also many error sources within SPM
methods that lead to global errors, like low frequencies modulated on
the data or data drift in the slow scanning axis.

Drift Compensation

Data Process → Correct Data → Compensate Drift

Compensate Drift calculates and/or corrects drift in the fast scanning
axis (horizontal). This adverse effect can be caused by thermal
effects or insufficient mechanical rigidity of the measuring device.

The drift graph, which is one of possible outputs,
represents the horizontal shift of individual rows compared to
a reference row (which could be in principle chosen arbitrarily, in
practice the zero shift is chosen to minimize the amount of data
sticking out of the image after compensation), with the row
y-coordinate on the abscissa.

The drift is determined in two steps:

A mutual horizontal offset is estimated for each couple of rows not
more distant than Search range. It is
estimated as the offset value giving the maximum mutual correlation
of the two rows. Thus a set of local row drift estimations is
obtained (together with the maximum correlation scores providing
an estimate of their actual similarity).

Global offsets are calculated from the local ones. At present the
method is very simple as it seems sufficient in most cases: local
drift derivatives are fitted for each row onto the local drift
estimations and the global drift is then obtained by integration
(i.e. summing the local drifts).

Option Exclude linear skew subtracts the linear
term from the calculated drift, it can be useful when the image is
anisotropic and its features are supposed to be oriented in a direction
not paralled to the image sides.

1D FFT Filter

Data Process → Correct Data → 1D FFT Filtering

One excellent way of removing frequency based of noise from an image is
to use Fourier filtering. First, the Fourier transform of the image is
calculated. Next, a filter is applied to this transform. Finally, the
inverse transform is applied to obtain a filtered image. Gwyddion uses
the Fast Fourier Transform (or FFT) to make this intensive calculation
much faster.

Within the 1D FFT filter the frequencies that should be removed from
spectrum (suppress type: null) or suppressed to value of neighbouring
frequencies (suppress type: suppress) can be selected by marking
appropriate areas in the power spectrum graph. The selection can be
inverted easily using the Filter type choice. 1D FFT filter can be used
both for horizontal and vertical direction.

2D FFT Filter

Data Process → Correct Data → 2D FFT Filtering

2D FFT filter acts similarly as the 1D variant (see above) but using 2D
FFT transform. Therefore, the spatial frequencies that should be
filtered must be selected in 2D using mask editor. As the frequencies
are related to center of the image (corresponding to zero frequency),
the mask can be snapped to the center (coordinate system origin) while
being edited. There are also different display and output modes that are
self-explanatory – image or FFT coefficients can be outputted by module
(or both).

Affine Distortion

Data Process → Correct Data → Affine Distortion

Affine distortion in the horizontal plane caused by thermal drift is
common for instance in STM. If the image contains a regular structure,
for instance an atomic lattice of known parameters, the distortion can
be easily corrected using this function.

The affine distortion correction requires to first select the distorted
lattice in the image. This is done by moving the lattice selection on
the preview with mouse until it matches the regular features present in
the image. For images of periodic lattices, it is usually easier to
select the lattice in the autocorrelation function image
(2D ACF).
Also, only a rough match needs to be found manually in this case. Button
Refine refines the selected lattice vectors to the
nearest maxima in autocorrelation function with subpixel precision.

The correct lengths of the lattice vectors
a1 and a2
and the angle φ between them, entered to
the dialog, determine the affine transformation to perform. A few common
lattice types (such as HOPG surface) are offered predefined, but it is
possible to enter arbitrary lengths and angle.

It should be noted that the correction method described above causes all
lateral scale information in the image to be lost because the new lateral
scale is fully determined by the correct lattice vectors. This is
usually the best option for STM images of known atomic lattices, however,
for a general skew or affine correction it can be impractical.
Therefore, the dialog offers three different scaling choices:

Exactly as specified

Lattice vectors in the corrected image will have the specified
lengths and angle between them. Scale information of the original
image is discarded completely.

Preserve area

Lattice vectors in the corrected image will have the specified
ratio of lengths and angle between them. However, the overall
scale is calculated as to make the affine transformation
area-preserving.

Preserve X scale

Lattice vectors in the corrected image will have the specified
ratio of lengths and angle between them. However, the overall
scale is calculated as to make the affine transformation
preserve the original x-axis scale.
This is somewhat analogous to the scale treatment in
Drift compensation.

Polynomial Distortion

Data Process → Correct Data → Polynomial Distortion

General distortion in the horizontal plane can be compensated, or
created, with Polynomial distortion. It performs transforms that
can be expressed as

where Px and
Py are polynomials up to the third total
order with user-defined coefficients. Note the direction of the
coordinate transform – the reverse direction would not guarantee an
unambiguous mapping.

The polynomial coefficients are entered as scale-free, i.e.
as if the coordinate ranges were always [0, 1]. If
Instant updates are enabled, pressing
Enter in a coefficient entry (or just leaving moving
keyboard focus elsewhere) updates the preview.

XY denoising

Data Process → Multidata → XY denoise

Calculates denoised image on the basis of two measurements of the same area
– one performed in x direction and one in y direction (and rotated back to be aligned
the same way as the x direction one). It is based on
work of E. Anguiano and M. Aguilar (see [1]).
Module performs FFT of both images, combines information from both images in reciprocal space, and then
performs backward FFT in order to get denoised image. It is useful namely for large scars
and fast scanning axis stripes removal.