Filters, Filters, Filters

New tools for extracting the shapes that matter from your profiles

When it comes to analyzing surface texture profiles, the most important step is getting at the shapes and scales that matter. This is called filtering and is traditionally associated with separating roughness from waviness. In the image below the data in the Primary profile is filtered to produce the Roughness and Waviness profiles.

A good representation of the filtering process is to superimpose the smoothed data (i.e., the Waviness profile) onto the unfiltered surface (the Primary profile). This Primary + Waviness view shows us how well the waviness “fits” the underlying shapes that are of interest.

Filtering can be used for tasks other than separating roughness and waviness. However, in this context we will use primary, roughness, and waviness to describe the filters themselves.

Let’s begin with the classic…

The Gaussian Filter (ISO 16610-21)

The Gaussian filter improves on the idea of a moving average by using a specifically shaped, “weighted” moving average.

From “The Surface Texture Answer Book”

This bell-curve shaped moving average provides the sharpest separation between roughness and waviness. We can plot this separation by showing the transmission curves for the roughness cutoff filter. The curves indicate the amount that each wavelength is transmitted. For the case of separating roughness from waviness with a Gaussian filter, we have curves that are shaped as below. 100% of the amplitude (height) of the short wavelengths are transmitted as roughness, and 100% of the amplitude of the long wavelengths are transmitted as waviness. The wavelengths close to the filter cutoff wavelength are transmitted partially as roughness and partially as waviness.

The Gaussian filter’s transmission of roughness and waviness.

Wouldn’t a vertical line be an ideal separation between roughness and waviness?

A vertical line for the transmission is often called a “brickwall” filter. This kind of filter would be considered “ideal” in that one side of the cutoff wavelength transmits exactly 100% and the other side transmits 0%.

The Brickwall filter’s transmission of roughness and waviness.

While the Brickwall filter might be ideal in terms of transmission, such a filter can also introduce strange artifacts in the data known as Gibbs Effects. These are mathematically generated “false” peaks and valleys that can occur in the data and can give misleading roughness values. We can think of the Gibbs effect much like a shock absorber that bounces a few extra times when encountering a bump in the road (though in this case the bounces occur both before and after the bump). In any case, the shock absorber reacts quickly, but the price of the reaction is the extra bounces.

Following the shock absorber analogy, the Gaussian filter is “critically damped,” meaning it follows the curvatures (lumps and bumps) in the profile as fast and as sharp as possible, without any additional errors being added to the data.

This difference can be seen here as we look at a stepped profile and apply both filter types at the same cutoff wavelength.

Gaussian and Brickwall filtering at the same cutoff wavelength.

Back to the Gaussian…

Because of these effects with a Brickwall filter, the Gaussian filter is the best possible filter for separating short and long wavelengths (roughness and waviness.) However, there is an important nuance to the Gaussian filter’s moving average: iIt doesn’t reach the ends of the profile. More specifically, to compute a windowed average at a given lateral location, we need data on both sides of that location.

From “The Surface Texture Answer Book”

Most traditional Gaussian filtering approaches simply discard some amount of data at the edges, beyond which the average can’t be calculated. This length is typically one half of a cutoff wavelength or, in some cases, one full cutoff wavelength from each end of the profile.

The discarding of one half of a cutoff wavelength from each end of the profile.
The discarding of one full cutoff wavelength from each end of the profile.

But what if I need the edge data?

Discarding data is “built into” many traditional roughness measurement systems. The need for discarding data is often attributed to the acceleration and deceleration of the probe at these parts of the curve, but that’s not the case: it’s due to filtering mathematics.

However, there are many cases where we do not want to discard these edges. A common example is the case where we want to use filtering for a straightness assessment over the full length of a surface. In this case, we want to make sure to capture any edge conditions on the surface.

Historically, there have been approaches developed for filtering all the way to the edges. For example, a Fourier-based Gaussian filter simply repeats the profile over and over again:

A repeating version of a profile.

This approach can, however, introduce problems when there are steep slopes at the edges of a profile.

A repeating version of the convex profile.

This edge problem also appears if we simply mirror the profile:

A “mirrored” version of a profile.

A (slightly) better way to handle edges: the collapsing kernel (ISO 16610-28)

The weighting function that is averaged through the profile is called the filter’s “kernel.” As we’ve seen above, the calculation of Gaussian waviness requires points on both sides of the bell-shaped kernel.

One way to work around this problem is to simply let the kernel “collapse” as it approaches an edge in order to provide filtering over the full profile length. In ISO 16610-28 this is referred to as the “moment retainment criterion.” This is a mathematical way of saying that the area under the curve remains constant.

This approach can be useful on generally flat surfaces. If the profile has steep edges, however, the waviness filter does not follow the underlying Primary profile.

The collapsing filter departs from steep edges.

The 1st Order Gaussian for improved edge following (ISO 16610-31)

Another way to improve the Gaussian filter is to fit a line through the kernel region at each point. A line is a 1st order polynomial – thus the name. This type of filter is generically called a Gaussian “regression filter” as we are fitting (regressing) a shape along with the convolution. The 1st order Gaussian uses “weighted linear regression” in which the midpoint of the fitted line is used for the local waviness point. The line is fit through the points based on local weighting according to the Gaussian shape. ISO 16610-31 introduces this 1st order Gaussian filtering concept in the context of robust filtering (which we will discuss later), but the filter can be used without the robust wrapper as well.

The 1st order Gaussian filter: a weighted linear regression line at each kernel position.

One interesting property of the 1st order Gaussian is that the weighted linear regression yields exactly the same Waviness profile as the traditional (zero order ISO 16610-21) Gaussian filter in the central region. The 1st order regression only affects the edges of the profile—the central region is exactly the same. If we discard ½ cutoff from each end, the filtering result is the same with both approaches.

Comparing the zero order and 1st order Gaussian filters.

If a 1st order Gaussian filter is good, how about a 2nd Order Gaussian? (ISO 16610-31)

The second order Gaussian regression filter is similar to the 1st order in that we locally fit a geometry at each kernel position. For the 2nd order version, we fit a 2nd order polynomial (parabola) at each position. ISO 16610-31 introduces this 2nd order Gaussian filtering concept in the context of robust filtering, but the filter can be used without the robust wrapper as well.

We can visualize the second order filtering process as shown in this figure. A parabola is fitted in kernel region around each point, and its midpoint is reported as the local waviness point.

The 2nd order Gaussian filter – a weighted parabolic fit at each kernel position.

Since the 2nd order fit does tend to follow local curvature a bit more closely, the kernel shape is adjusted to achieve 50% transmission at the cutoff wavelength.

The 2nd order filter conforms to local waviness.

Despite this small tweak, the 2nd order Gaussian is a very useful filter when the full length of a profile is critical. It follows steep/extreme edges very well.

A comparison of Gaussian regression filters.

Spline Filters (ISO 16610-22)

Spline filter, like Gaussian filters, can be used to separate roughness and waviness; however, they use an equation to create the Waviness profile rather than a convolution of a filtering kernel. In the case of spline filters, a smoothing, cubic spline is used to create a Waviness profile based on a cutoff wavelength. In fact, it’s a special cubic spline that has been tuned to act somewhat like a Gaussian filter, transmitting 50% of the amplitude at the cutoff wavelength. With tension “beta” (β) equal to 0.0, the filter acts like a cubic spline and provides good “form following” and good edge following properties.

The Spline filter with “form following” (β = 0.0) tension.

By setting the tension parameter “β” to 0.625242, the spline filter can also be tuned to act more like the standard, Zero Order Gaussian filter. This does come at the cost of introducing edge effects into the spline filtered Waviness profile, just as was the case with the Gaussian filter.

The Spline filter with “Gaussian” (β = 0.625242) tension.

But wait, there are more. Robust Filters! (ISO 16610-31, ISO 16610-32)

One problem with all the above filters is that they can be influenced by outlying data points such as deep pores or valleys. They can also be influenced in a similar way by an extreme, outlying peak.

In the region of a deep valley, a Gaussian or Spline filter gets pulled downward into the valley. A similar problem can happen with localized peaks.

The red Waviness profile gets pulled down by deep valleys.

When the Waviness profile gets pulled downward it can cause false peaks to appear in the Roughness profile. This is due to the fact that the roughness peaks are defined as everything above the Waviness profile, while the roughness valleys are everything below the Waviness profile. When the waviness dips downward due to a valley, there is more peak area exposed above the valley. This area becomes a “false peak” in the Roughness profile.

Where the waviness is pulled downward, the roughness peaks become higher.

Ideally, we do not want extreme valleys to influence the filter, which can lead to wrong interpretations of the waviness and the roughness data. Waviness will appear to be greater, and roughness peaks will appear to be higher.

To remedy this problem, a class of “robust” filters have been introduced. Robust filters act like standard Gaussian and spline filters, with the added “wrapper” of an iterative weighting process.

The robust filter works as follows:

  1. Perform a standard Gaussian (an order) or Spline (any tension) filtering operation.
  2. Look at the Primary profile points and evaluate how far each point is from the Waviness profile.
  3. Set a weight at each primary point based on its distance from the Waviness profile. If the point is close to the Waviness profile, the weight is 1.0. If the point is farther away from waviness, it gets less weight.
  4. Repeat this weighting and filtering until no more changes to the weights are needed.
Robust filtering by adjusting profile data point weighting.

Why not use robust for everything?

Robust filters are designed to handle outlying data points, which can be very useful in dealing with random surfaces like those resulting from grinding, lapping, honing, etc. However, some surfaces, such as those created by turning, boring, or milling, can be inherently composed of “outlying” features. Using a robust filter on these surfaces may attenuate or remove actual peaks or valleys from the surface texture.

A robust filter can “latch” on to valleys in some kinds of surfaces like those from turning.

Which filter should I use?

If you’ve been keeping up, you will see that we have introduced 10 filters:

  • Traditional (zero order) Gaussian
  • 1st Order Gaussian
  • 2nd Order Gaussian
  • Spline with “form following” (? = 0.625242) tension
  • Spline with “Gaussian-like” (? = 0.0) tension

and

  • Robust (zero order) Gaussian
  • Robust 1st Order Gaussian
  • Robust 2nd Order Gaussian
  • Robust Spline with “form following” (? = 0.625242) tension
  • Robust Spline with “Gaussian-like” (? = 0.0) tension

But this raises the question: “which should I use?”

Short Filter (for producing the Primary profile):

ISO 21920-3 establishes the (zero order) Gaussian filter as the default short filter type. Note: the 1st order Gaussian is also a good alternative as the edge effects for a short filter are minimal and there is a greater benefit in retaining the full length of the input profile when creating the Primary profile.

Long Filter (for separating roughness and waviness):

ISO 21920-3 establishes the (zero order) Gaussian filter as the default filter type for separating roughness and waviness. ISO 16610-21 also indicates a default edge discarding length of ½ of a cutoff from each side.

Some important notes on filtering

  • Most important, try the filters on your actual data and see their shapes and their influences. Digital Metrology’s OmniSurf software provides all 10 of the filters as well as many tools for visualizing how the filters fit your data and how they extract the shapes you care about.
  • The “default” filters may not be the best filters for your application. For example:
    • If you need to assess the edges of a profile, a 2nd order Gaussian or a “form following” spline filter may be your best choice.
    • If your surface has outlying features such as extraneous peaks or deep pits/valleys, you may need to use a robust filter. Which type of robust filter will depend on the other characteristics that you are wanting to explore.
  • Regardless of your filter type selections, it is very important that these filter types be specified on the drawing or specification. ISO 21920-1 and ASME Y14.36 provide mechanisms for indicating the filtering alongside the roughness tolerance limits.