Declaration: CalcInvCalibCoeffs(FirstIx, LastIx: integer; Offs, Fact, Shft: double; Coeffs: TDoubleArray; var InvOffs, InvFact, InvShft: double; var InvCoeffs: TDoubleArray; var FitQual: double): integer;
Calculates the inverse calibration coefficients for a given forward calibration. The parameters FirstIx and LastIx define the range of indices which should be used for the inverse calibration. This range has to be a minimum of 10 values. The parameters of the forward calibration model are defined by the following parameters:
Offs ... the offset
Fact ... the scale factor
Shft ... the shift factor
Coeffs ... the coefficients of the calibration polynomial (max. order = 6)

On return the method CalcInvCalibCoeffs delivers the following parameters of the inverse calibration model:

InvOffs ... the offset
InvFact ... the scale factor
InvShft ... the shift factor
InvCoeffs ... the coefficients of the calibration polynomial (max. order = 6)
FitQual ... the quality of the fit

The function returns the following error codes:

 0 ... everything is OK
-1 ... could not calculate the inverse regression model
-2 ... warning: unstable coefficients (due to near singular equations)
-3 ... range between FirstIx and LastIx too small

Hint: Please note that the calibration model in Epina ImageLab is based on a polynomial fit. While this is adequate for most paractical applications it can be problematic if the inverse calibration model cannot be approximated by polynomials. Thus it is strongly recommended to check the parameter FitQual in order to evaluate the adequateness of the inverse model. FitQual should be close to 1.0.