Fit Line to Profile

Description

This Step is used to fit a line to the input profile and measure the deviations from the fitted line.

line fitting illustration

Fits a line to the entire profile

Workflow

The process of configuring this Step is shown below.

fit line to profile process
  1. Configure the input. Connect the Step ports in the graphical programming workspace or select the input under Input in the parameter configuration panel.

  2. Select Feature Region Mode.

  3. Set relevant parameters according to the selected mode.

  4. Select the desired output items under Output. For an expandable output item, click ▶ and configure the Min and Max values to determine the acceptable range for the item.

  5. Run the Step and view output.

Parameter Description

Feature Region Mode

This parameter determines the regions for line fitting and measurement and whether the region for line fitting and the region for measurement are the same.

Options: None, Combined, Separated

  • None mode: Use the entire profile input into the Step for line fitting and measurement.

  • Combined mode: A feature region should be set for line fitting and measurement.

  • Separated mode: Feature regions should be set for line fitting and measurement separately, where up to two feature regions can be set for line fitting.

For more information on how to set the feature region, see Set the Feature Region.
Fitting Method

This parameter specifies the method for fitting a line to the profile.

Options: Simple, Robust

  • Simple: A fast line fitting method. The fitted line is roughly accurate.

  • Robust: An iterative line fitting method. The fitted line is accurate, but it takes a long time to fit the line. When selecting this method, you need to set the Outlier Fraction parameter.

Default setting: Simple

Outlier Fraction

This parameter defines the proportion of outliers to be removed during line fitting so as to best fit a line. The default value is 30%.

Measurements Percentage

This parameter is used to set the percentage of data points with the smallest errors considered when evaluating the error from the data points to the fitted line. The default value is 50%.

Once the Error at Percentile option is selected in the Output section, the Step will output the error value at the percentile corresponding to the percentage set here, that is, the maximum error corresponding to a point within the set “Measurements Percentage.”

“Percentile” is a statistical concept usually used to represent a position in the dataset. After sorting a set of data in ascending order, you can use the percentile to describe the value at a specific percentage.

Output Description

Select the output item(s) according to the actual measurement requirements. Then, the corresponding data will be output after the Step is run.

If you select an expandable output item, you must expand it by clicking ▶, and then set the Min and Max values to determine the acceptable range. If the output value falls within the acceptable range, the measurement item is judged as passing (OK), or else it is judged as failing (NG).

Output Item Description

Standard Deviation

The standard deviation of the data points with respect to the fitted line.

Min Error

The minimum error of the data points from the fitted line.

Max Error

The maximum error of the data points from the fitted line.

Error at Percentile

The maximum error of points within “Measurements Percentage” from the fitted line.

Offset

The Z value of the intersection of the fitted line with the Z-axis.

Angle

The angle of the fitted line with respect to the X-axis.

Min Error X

The X value of the point with the minimum error.

Min Error Z

The Z value of the point with the minimum error.

Max Error X

The X value of the point with the maximum error.

Max Error Z

The Z value of the point with the maximum error.

Arithmetic Mean

The mean of the distances from the data points to the fitted line.

Error Range

The range of errors of the data points from the fitted line.

Fitted Line

The best fitted line.

Troubleshooting

See Common Errors and Solutions for common error messages and fixes for all Steps.

Invalid Parameter

No. Error Error Description Possible Causes Solution

1

Inappropriate outlier fraction

When Fitting Method is set to Robust, Outlier Fraction is not set properly.

The set outlier fraction is not within [0, 1].

Reset Outlier Fraction to ensure that the value is within [0, 1].

2

Inappropriate measurements percentage

Measurements Percentage is not set properly.

The set measurements percentage is not within [0, 1].

Reset Measurements Percentage to ensure that the value is within [0, 1].

Invalid ROI

No. Error Error Description Possible Causes Solution

1

Insufficient data points in the region for measurement

There are not enough points in the measurement region for the measurement to be completed.

Data points are not included in the region for measurement.

Check and adjust the region for measurement to ensure that data points are included.

2

Insufficient data points in the region for line fitting

There are not enough points in the fitting region for the fitting to be completed.

The number of points in the region for line fitting is less than 2.

Check and adjust the region for line fitting to ensure that the number of points in it is no less than 2.

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.