SPIP has two methods for linearity analysis implemented the Coarse Hysteresis Correction method and the Fine Linearity Correction method.
The first applies to images where the distortions are caused by hysteresis. A 2nd order polynomial model is used for describing the hysteresis and the model is tuned so that the Fourier peaks are maximized. You can try the method on the hyst.bcr file which came with SPIP (to get adequate result on this specific file a license for analyzing images larger than 128 x 128 pixels is required).
Open hyst.bcr.

You will find that the repeat distance for the features is highest on the upper left part and smallest on the lower right part. This is an effect of non-uniform scanning caused by hysteresis. The scanner has sampled at equal time intervals but the scanning speed was lower on the upper left part where the scan started than the lower right part.
Take a look on the Fourier image and you will see that the narrow peaks typical of calibration objects have broadened to rectangular forms:

Click on the Coarse linearity button and a new corrected image will be calculated:

Make a new Fourier image and you will see that the Fourier peaks associated with the real structure have been restored

The Fine Linearity Correction method is a very powerful tool for finding non-linearity even smaller than the size of a pixel. It is therefore the best method for checking the quality of high-end metrology systems.
Example:
If you continue the with the hysteresis corrected image calculated as shown above by a fine linearity analysis
you will get a new image with the unit cell indicated together with error vectors.

The red error vectors are of relative size and mainly used for visualizing the error direction and relative magnitude; the black points are the (0,0) anker points of the vectors. You can turn the unit cell and error vector indication off by the oblique marker tool
’
The absolute magnitude of the linearity errors are best found in the scatter diagrams or the Linearity Correction Dialog where you still find some residual error within +/- 1.5 pixels:
Continue by pressing Correct followed by New Estimate and you will find that all errors are in the sub-pixel regime:

The linearity analysis relies on the definition of a template, which is a representative repetitive structure. The user can define the template with the rectangle marker tool. When no selection is made SPIP will just create one which can cover a unit cell. Selecting a large template will provide the most robust result but requires more computation time. Smaller templates can provide more information about the linearity close to the image borders.
When a template is selected, the associated toolbar button starts the fine linearity analysis. If the unit cell has not been found earlier it will automatically be calculated by the Fourier method first. Then SPIP finds from the cross correlation the sub-pixel positions of all structures similar to the template shown in the zoom window. It will compare the positions with those predicted from the unit cell data. The differences are described as linearity errors, which are further, minimized by minimizing the sum of square errors (now in the spatial domain). The results are shown in the Linearity Correction Menu:

Consequently, we have quantified the non-linearity as well as the best-fit unit cell. Experiments have shown that this gives a better reproducibility than the faster Fourier method. However, the Fourier method is needed for getting a good initial estimate of the unit cell.
The overall linearity error Mean Position Error is also shown in the Linearity Correction Menu and more detailed information is written into the *.linc file.
The correction parameters are based on a third-order polynomial model of the scanning system. They describe how to resample the image. A more detailed description of the parameters is found in the reference guide. It is possible to enter your own values.
You can apply the correction parameters on the main image by clicking on the Correct button.
Recheck the linearity by clicking on New Estimate and you should observe that the correction parameters become more neutral, that the errors in the scatter diagram reduces to the sub-pixel level and that the Mean Position Error decreases.
When clicking on this button you will get a new estimation as above but without changing the current unit cell parameters. This gives you the possibility to see how sensitive the linearity analysis is to correct estimation of the unit cell.
The unit cell co-ordinates are found from a least error fit, except when the New Est, Keep Unit Cell button is used. In this case you may enter your own co-ordinates and observe how sensitive the analysis is to the unit cell co-ordinates.
The mean position error measure the combined X and Y dislocations. Regard also this as a quality measure for the combined
· Linearity of the instrument
· Uniformity of the surface structure
· Accuracy of the image processing.
The calculated correction parameters can be stored and retrieved. To apply the correction parameters to a different image you can active this menu directly from the menu bar: select ProcessingàLinearityàCorrection Menu.