Mathematical approach to the validation of form removal surface texture software

A new approach to the validation of surface texture form removal methods is introduced. A linear algebra technique is presented that obtains total least squares (TLS) model fits for a continuous mathematical surface definition. This model is applicable to both profile and areal form removal, and can be used for a range of form removal models including polynomial and spherical fits. The continuous TLS method enables the creation of mathematically traceable reference pairs suitable for the assessment of form removal algorithms in surface texture analysis software. Multiple example reference pairs are presented and used to assess the performance of four tested surface texture analysis software packages. The results of each software are compared against the mathematical reference, highlighting their strengths and weaknesses.


Introduction
Surface texture characterisation is a valuable application of metrology in the field of precision engineering [1,2]. The accurate measurement of part surface topography enables the verification of part tolerances which is crucial to high precision applications [3,4]. Furthermore, surface texture is a primary factor in part-surface interactions and can impact attributes such as energy efficiency and component lifespan through surface properties, such as lubricant retention [5,6].
Measured surface height information is used in surface texture analysis to calculate surface texture parameters [1]. These parameters are numerical descriptors that provide information about the statistical distribution of surface heights across the measurement range, as well as frameworks for the identification of topographical features [7,8]. Obtaining surface texture parameters first requires preparation of the measured surface data. This involves form removal to separate the nominal shape of a measured surface from its texture, and filtration operations to isolate a finite spatial frequency band of interest from the entire measured spatial frequency range [9,10]. A priori knowledge is required to determine the nominal form present in the surface measurement data in order to perform effective surface texture analysis that is fit for purpose.
It is important that the surface texture analysis software used to perform each of the operations required for surface texture characterisation is properly validated to prevent systematic errors in the implementation of these operations from affecting analyses. Definitions and guidelines for form removal, filtration and parameter calculation are given in international ISO standards to facilitate meaningful international cross-collaboration in the field of surface texture characterisation by ensuring all are working to the same definitions [7,11,12]. National metrology institutes (NMIs) provide reference software and reference datasets as a point of comparison for the validation of surface texture analysis software [13][14][15][16]. However, these reference software packages are numerical by nature, developed using similar discretebased algorithms as used in commercial software and are thus subject to the same approximations. Furthermore, algorithmic implementations of the operations given in the standards can vary, depending on developer, programming language, or interpretation of the standards, leading to variations in the outputs provided by different 'reference' software [17]. Baker et al Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI. [18] performed an international comparison between sixteen laboratories using two simulated profile datasets along with real test samples and found variations between the software used by each laboratory for all of the seven surface texture parameters tested. Koenders et al [19] performed a similar international comparison and found different calculation methods for multiple parameters between software implementations. In 2009, an NPL report by Li et al [20] focussed on NMI reference software using type F1 reference data sets [13] and highlighted implementation differences between each of the software packages. Such an outcome makes the value of reference software limited, as it cannot be held as a reliable reference against which commercial software developers can validate their implementations.
These shortcomings in the current state of the art justify the need for an alternative approach to surface texture analysis software validation that is free from the inaccuracies that are introduced with discretebased reference software. This new approach introduces a mathematical foundation in which the operations of form removal, filtration and parameter calculation are performed on continuous mathematical surface functions in line with the mathematical definitions provided in the international standards. This method ensures mathematical traceability throughout the process and can produce reliable reference pairs for the validation of surface texture analysis software [21].
This paper is part of a series that describes the development of this mathematical reference framework for different stages in surface texture analysis. Previous work has presented the mathematical software validation approach for surface texture field and functional parameter calculation and surface filtration [22][23][24]. The work introduced here extends the framework to surface texture form removal. A technique is presented that enables the application of a total least squares (TLS) approximation to a continuous surface function while maintaining mathematical traceability. This allows form to be removed from a surface function, revealing surface texture. Section 2 details the mathematical process for obtaining a TLS approximation on a continuous surface. Section 3 showcases the application of this technique to create reference pairs suitable for software validation. Section 4 applies the reference pairs to a range of surface texture analysis software to demonstrate their use in the validation of software performance.

Continuous total least squares approximation
Form removal is a crucial operation in the surface texture characterisation pipeline that aims to identify the nominal form, or shape, of a measured surface in order to isolate the surface texture. This could be a slope, curve, cylinder or sphere, depending on the part or surface being measured. Specific guidelines and definitions for form removal operations have historically been vague, with areal standard ISO 25 178-2 describing the F-operation as 'very fuzzy' [8]. ISO 3774 gives a little more information, specifying a 'best fit least squares form' [11]. The new profile surface texture parameter definition standard currently under development (ISO 21 920-2 [25]), will give more information, the draft currently stating that the F-operation is 'usually a straight line total least squares fit', implying this is the choice most commonly taken when using surface texture analysis software. Such software also commonly offers higher order polynomials and circular/spherical form removal options. Following on from these guidelines, it was decided that a TLS fit to remove form on profile and areal continuous surface functions for linear, polynomial and circular shapes would be the most appropriate form removal reference. As the purpose of this paper is to introduce a traceable method to verify form removal software against the definitions given in the ISO specification standards, it is necessary to implement a TLS solution, rather than an ordinary least squares (OLS) solution. For surface texture applications with very small deviations from the horizontal plane, OLS solutions can achieve sufficiently similar results to TLS solutions, but with reduced computational complexity, making it a worthwhile substitution for commercial software.

Background
Previous literature defines the TLS fit for a finite set of points [26,27]. The aim of the TLS approach is to find the best solution to the linear system » Xa y, where Î X m n , Î a n 1 and Î y m 1 . Here, y is the y value vector, For our purposes, this corresponds to the surface height values along a profile. The value of n is determined by the complexity of the model being applied to the data, given by the number of variables needed to be found in order to obtain an approximate height value, yˆ. For the example of a straight line fit, with equation ax+b, n=2. In the case m>n, the system is overdetermined and there is typically no exact solution to obtain a. As m corresponds to the number of data points and n the number of variables in the fit model, in practice, m n  . Suppose Î C m n . The theory of singular value decomposition (SVD) [28] determines that C can be separated and rewritten in the form with I being the identity matrix of length n. U and V are built from the orthonormal eigenvectors of CC T and C C T , respectively. Σ is a diagonal matrix comprised of the square roots of the eigenvalues of C C T . Let where V nn is an n×n matrix, v nq and v qn are n×1 and 1×n vectors, respectively, and v qq is a scalar. The TLS theorem [26,27] states that a TLS solution to the system is given by

Extension to continuous surfaces
As mentioned, existing literature defines the TLS method for finite datasets of length m. For the purpose of establishing mathematically traceable reference pairs for form removal, it is necessary to extend this to continuous surface expressions. Let a continuous surface height function, f (x), defined within some range x l xx h , be represented as a dataset of infinite length The matrix C defined in section 2.1 would, therefore, be of size ¥´+ n 1 ( ). In order to obtain a TLS solution, the V matrix is required. This can be found by calculating C C T , which results in a +´+ n n 1 1 ( ) ( ) square matrix, W, the elements of which are comprised of an infinite number of terms found using Any element in C is either from X or y, so is some function of x. Given that x l xx h and each value x i in the dataset can be defined as = + , where i is an integer and x d is the interval between them (infinitesimal in this case). Equation (7) can be rewritten as and c is equivalent to the first row of C with x 1 replaced with x. This allows a finite size matrix to be defined that is comprised of definite integrals. From here, basic matrix algebra can be used to obtain the eigenvalues and corresponding eigenvectors for the matrix C C T by evaluating the definite integrals in each element when required. To construct V, each eigenvector must also be orthogonalised. Throughout this paper, orthogonalisation was performed using the Gram-Schmidt process via computer algebra system Mathematica 11.3. The orthogonal eigenvectors are then combined, each becoming one column, to create V. From here, the TLS solution can be found using equation (6) which defines the form calculated for the given surface function.
Consider the example of performing a linear TLS fit to a surface, f (x) to obtain a solution of the form + a x a 0 1 . The linear system for this can be written as In calculating C C T , the first element is which, following the process for equation (8), becomes The same process can be applied for each element, leading to the matrix .
From here, the orthogonalised eigenvectors can be obtained following evaluation of the definite integrals. The value in this approach is that the process remains the same for a wide variety of linear algebra systems, allowing for a range of mathematically traceable form types to be obtained. For example, a 2nd order polynomial TLS fit can be represented by the system

Form removal reference pairs
The creation of form removal reference pairs suitable for the assessment of surface texture analysis software comprises three steps: defining a pre-form surface function, f (x), calculating the TLS form expression, TLS(x), using the method presented in section 2.2 and removing the TLS form from the original surface function to obtain a post-form surface, z(x). For functions defining surface height with position, as used here, form removal can be performed by simple subtraction, For the reference pairs used throughout this paper, pre-form surface functions have been defined as a superposition of a low-order polynomial form and a high spatial-frequency sinusoid. This has the effect of adding an identifiable texture to a nominal form. Figure 1 shows an example profile reference pair for 2nd order polynomial form removal. The preform surface function is an x 2 function combined with a cosine with a frequency of 4000 m −1 , defined in the   Figure 1 shows the pre-form surface in blue and the TLS fit in orange on the right.
The right-hand side shows the result of subtracting the TLS form from the pre-form surface. Note that the post-form surface is not a perfect cosine and presents a slight curve, indicating presence of residual form in the final surface. This is because the amplitude of the cosine is included in the TLS fit and affects the minimisation algorithm, preventing the approximation from ignoring it entirely and only extracting the underlying x 2 function. The cosine is a function of x and has been added vertically to the underlying form. Because of this, there is not an equal amount of positive and negative cosine function perpendicular to the underlying form, causing into the effect the final TLS fit. This effect is reduced as the amplitude of the texture is reduced relative to the amplitude of the form. Figures 2 and 3 show example reference pairs for a circular TLS form removal process and an areal 2nd order polynomial TLS form removal, respectively.

Software comparisons
To use the mathematical reference pairs to assess the performance of form removal software, it is necessary to produce discrete surface datasets that can be input into the software under test. This is achieved by sampling the surface functions f (x) and z(x) (or f (x, y) and z(x, y) in the areal case) at a series of uniformly spaced points to obtain a dataset of height values.
These height values are then stored in a compatible file format, such as the .SDF format defined in ISO 25  178-71 [29]. For the comparisons presented in this paper, all profile datasets were sampled at a resolution of 1001 pixels, and all areal datasets were sampled at a resolution of 701×701. Mathematical form removal reference pairs were used to assess the performance of four surface texture analysis software packages, including both commercial and reference software. Each pre-form reference surface was input into the software under test, which was then used to perform the corresponding form removal operation. The resulting surface was exported and the post-form reference surface heights were then subtracted from the software results to obtain surface height difference datasets. Figure 4 shows the software obtained results for a linear TLS form removal operation, subtracted from the post-form reference surface. All tested software shows good agreement with the reference, with deviation occurring on the order of the dataset precision. Software D displays small regions of larger disagreement with the reference at either ends of the profile. This could be due to an end effect in their form removal algorithm, however, the return to a small deviation from reference at the rightmost edge of the profile suggests this may not be the case and the effect is instead caused by some other aspect of their software. Upon closer inspection when cropping in, it can be seen that software A and D both perform almost identically for the majority of the profile, suggesting a similar algorithm is used by both. While most of the software tested displays noise-like variation at small scales, software C presents a small difference from the reference across the entirety of the profile. This implies some form of averaging or interpolation to account for the small-scale variations in the results, which may arise from the precision of the data used during operation.
All tested software displayed a consistent linear slope to the difference results, indicating a variation in the gradient of the form obtained by the software compared to that of the reference surface. To investigate, an ordinary least squares (OLS) mathematical form removal was calculated for the same surface. This surface was then compared to the software results, as shown in figure 5. This shows no linear slope as seen in the comparison between the software and mathematical TLS form removal surface results, strongly indicating that all test software packages have implemented an OLS form removal algorithm instead of a TLS form removal algorithm, even NMI reference software, despite the guideline given in the ISO specification standards. This result highlights the importance of full   disclosure by the NMI reference software providers of the form removal algorithms implemented, as variations from the methods mentioned in the ISO specification standards can lead to differences. For commercial software, implementation details are industrial secrets and so are not expected to be disclosed. However, deviations from reference values, such as those presented here, can be disclosed, in the same way that surface measurement instrument manufacturers state noise level on a data sheet. This effect is even more pronounced when the amplitude of the texture on the surface relative to the form is increased and the differences between the outputs of TLS and OLS algorithms become more significant. This effect is shown in figure 6, which presents a surface with the same underlying linear form but with the sinusoidal texture amplitude increased by a factor of four. Here, the gradient present in the software difference results is several orders of magnitude larger than in figure 4. Figure 7 presents the results for an areal spherical TLS form removal operation. Only software A and B gave the option to perform spherical form removal. Both software packages show reasonable agreement with the post-form reference surface, however, clear evidence of the sphere is present on both images, indicating an imperfect spherical fit to the data when compared to the TLS approach. In addition to a slightly higher amplitude of deviation, software B also present a regular diagonal striation across the surface. This is some form of artefact due to the form removal algorithm applied by the software, as no presence of such striations are found in the pre-form reference surface. Cropping closer into the centre, software B also presents interesting radial patterns; again, artefacts of the form removal algorithms used.

Conclusions
The methods presented in this paper enable the calculation of TLS solutions for mathematically traceable surfaces to facilitate the creation of reference pairs for the assessment of form removal algorithms. The methods are applicable to both profile and areal surfaces and can be used for a variety of linear form equations.
The technique was applied to assess four surface texture analysis software packages. The results found generally good agreement with the references, however, they revealed the use of OLS form fitting rather than the ISO specified TLS form fitting. This is likely due to the increased simplicity of the OLS method over TLS, allowing for both speed benefits and ease of implementation. Alternatively, this could be due to a misinterpretation of the standards, as earlier standards are less clear about the type for least-squares fitting to be used. Another important consideration is that explicit mention of TLS is only given in the most recent standard, meaning software developers may not have yet been able to update their algorithms. Nevertheless, it is important that the deviations of each software from the reference values are disclosed to users to ensure transparency and awareness of how the results of the software may differ from ISO recommendations. In surface texture measurement data, it is typical that the surface form and lateral range are orders of magnitude higher than the vertical topography height, z. The effects of texture variations are small relative to the lateral range, meaning the effect of including lateral variations in a form fitting algorithm by using a TLS method may be negligible compared to the results of a simpler OLS method. A possible avenue for future work on this topic is to investigate the effect of TLS versus OLS numerical form removal methods on real measurement data to understand where the differences between the two approaches are significant in practice. Such an investigation could be valuable in justifying the use of the simpler OLS form removal methods in certain scenarios for commercial software.
A limitation of this new approach is its relative complexity compared to traditional discrete dataset TLS algorithms. This complexity increases as the order of the form equation increases, potentially leading to prohibitive scenarios for very high-order form fitting requirements. However, typical form removal operations use relatively simple models, ensuring this new approach is still of benefit to the industry. A further limitation is the disconnect between a continuously defined reference pair and discrete-based software. For assessment of the software to occur, appropriate sampling of the reference pair is required. While this has the benefit of enabling a reference dataset of theoretically infinite resolution to be produced, at practical resolutions there will be a disparity between the reference and the dataset due to the information lost by finite sampling. To account for this, it is important that the sampling method and resolution are stated alongside any software assessment using a continuous original reference.
This paper is the final part in a series that introduces the use of continuous surface topography definitions to obtain mathematically traceable references for the assessment of surface texture analysis software. By utilising the methods presented in this series, the full surface texture characterisation pipeline, including form removal, surface filtration and surface texture parameter calculation, can be validated against a mathematically traceable reference pair.