Woolz Image Processing  Version 1.8.3
WlzFunction

Files

file  WlzBasisFn.c
 Functions for creating and manipulating basis functions.
 

Data Structures

struct  _WlzBasisFnMapData3D
 Used to memorise the nodes of a mesh element between 3D distance function evaluation calls. More...
 
struct  _WlzBasisFn
 A basis function. Typedef: WlzBasisFn. More...
 

Typedefs

typedef WlzPixelV(* Wlz3DProjectionIntFn) (WlzPixelP, int, int, void *, WlzErrorNum *)
 Callback function for the WlzGetProjectionFromObject(). More...
 
typedef double(* WlzBasisEvalFn) (void *, double)
 An alternative basis function evaluation function that may may be called. More...
 
typedef double(* WlzBasisDistFn) (void *, int, WlzVertex, void *)
 An alternative basis function distance function that may may be called. More...
 
typedef int(* WlzThreshCbFn) (WlzObject *, void *, WlzThreshCbStr *)
 Callback function for the WlzCbThreshold() More...
 

Enumerations

enum  _WlzFnType {
  WLZ_FN_BASIS_2DGAUSS,
  WLZ_FN_BASIS_3DGAUSS,
  WLZ_FN_BASIS_2DIMQ,
  WLZ_FN_BASIS_3DIMQ,
  WLZ_FN_BASIS_2DPOLY,
  WLZ_FN_BASIS_3DPOLY,
  WLZ_FN_BASIS_2DMQ,
  WLZ_FN_BASIS_3DMQ,
  WLZ_FN_BASIS_2DTPS,
  WLZ_FN_BASIS_3DTPS,
  WLZ_FN_BASIS_2DCONF_POLY,
  WLZ_FN_BASIS_3DCONF_POLY,
  WLZ_FN_BASIS_3DMOS,
  WLZ_FN_BASIS_SCALAR_3DMOS,
  WLZ_FN_SCALAR_MOD,
  WLZ_FN_SCALAR_EXP,
  WLZ_FN_SCALAR_LOG,
  WLZ_FN_SCALAR_SQRT,
  WLZ_FN_SCALAR_INVSQRT,
  WLZ_FN_SCALAR_SQR,
  WLZ_FN_COUNT
}
 The types of function. Typedef: WlzFnType. More...
 

Functions

WlzErrorNum WlzBasisFnFree (WlzBasisFn *basisFn)
 Free's the given basis function. More...
 
WlzDVertex2 WlzBasisFnValuePoly2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D polynomial basis function. This is not a basis function just a polynomial, but it makes sense for it to be incuded in the basis functions since they have a polynomial component. More...
 
WlzDVertex2 WlzBasisFnValueGauss2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D Gaussian basis function. More...
 
WlzDVertex2 WlzBasisFnValueMQ2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D multiquadric basis function. More...
 
WlzDVertex3 WlzBasisFnValueMQ3D (WlzBasisFn *basisFn, WlzDVertex3 srcVx)
 Calculates the displacement value for the given vertex using a 3D multiquadric basis function. More...
 
WlzDVertex2 WlzBasisFnValueIMQ2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D inverse multiquadric basis function. More...
 
WlzDVertex3 WlzBasisFnValueIMQ3D (WlzBasisFn *basisFn, WlzDVertex3 srcVx)
 Calculates the displacement value for the given vertex using a 3D inverse multiquadric basis function. More...
 
WlzDVertex2 WlzBasisFnValueTPS2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D thin plate spline basis function. More...
 
WlzDVertex2 WlzBasisFnValueConf2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D conformal polynomial basis function. More...
 
WlzDVertex3 WlzBasisFnValueMOS3D (WlzBasisFn *basisFn, WlzDVertex3 srcVx)
 Calculates the value for the given vertex using a 3D multiorder basis function:

\[ \phi(r) = \frac{1}{4 \pi \delta^2 r} (1 - \frac{w}{w - v} e^{- \sqrt{v} r} + \frac{v}{w - v} e^{- \sqrt{w} r}) \]

\[ v = \frac{1 + \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ w = \frac{1 - \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

. More...

 
double WlzBasisFnValueScalarMOS3D (WlzBasisFn *basisFn, WlzDVertex3 srcVx)
 Calculates the value for the given vertex using a scalar 3D multiorder basis function:

\[ \phi(r) = \frac{1}{4 \pi \delta^2 r} (1 - \frac{w}{w - v} e^{- \sqrt{v} r} + \frac{v}{w - v} e^{- \sqrt{w} r}) \]

\[ v = \frac{1 + \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ w = \frac{1 - \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

. More...

 
double WlzBasisFnValueMOSPhi (double r, double delta, double tau)
 Computes the value of a single multiorder radial basis function:

\[ \phi(r) = \frac{1}{4 \pi \delta^2 r} (1 - \frac{w}{w - v} e^{- \sqrt{v} r} + \frac{v}{w - v} e^{- \sqrt{w} r}) \]

\[ v = \frac{1 + \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ w = \frac{1 - \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

. More...

 
WlzBasisFnWlzBasisFnGauss2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr)
 Creates a new Gaussian basis function. More...
 
WlzBasisFnWlzBasisFnPoly2DFromCPts (int nPts, int order, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzErrorNum *dstErr)
 Creates a new polynomial basis function. More...
 
WlzBasisFnWlzBasisFnConf2DFromCPts (int nPts, int order, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzErrorNum *dstErr)
 Creates a new conformal basis function. More...
 
WlzBasisFnWlzBasisFnMQ2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr)
 Creates a new multiquadric basis function. More...
 
WlzBasisFnWlzBasisFnMQ3DFromCPts (int nPts, WlzDVertex3 *dPts, WlzDVertex3 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh3D *mesh, WlzErrorNum *dstErr)
 Creates a new multiquadric basis function. More...
 
WlzBasisFnWlzBasisFnIMQ2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr)
 Creates a new inverse-multiquadric basis function. More...
 
WlzBasisFnWlzBasisFnIMQ3DFromCPts (int nPts, WlzDVertex3 *dPts, WlzDVertex3 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh3D *mesh, WlzErrorNum *dstErr)
 Creates a new inverse-multiquadric basis function. More...
 
WlzBasisFnWlzBasisFnTPS2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr)
 Creates a new thin plate spline basis function. More...
 
WlzBasisFnWlzBasisFnMOS3DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double *alpha, double *param, WlzErrorNum *dstErr)
 Creates a new 3D multi order spline basis function:

\[ \phi(r) = \frac{1}{4 \pi \delta^2 r} (1 - \frac{w}{w - v} e^{- \sqrt{v} r} + \frac{v}{w - v} e^{- \sqrt{w} r}) \]

\[ v = \frac{1 + \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ w = \frac{1 - \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ f(\mathbf{x}) = P(\mathbf{x}) + \sum_{i=1}^{n}{\lambda_i \phi(r_i)} \]

\[ r_i = |\mathbf{x} - \mathbf{x'_i}| \]

The multi order spline may either be an exact interpolating function or one which approximates the given control points. In the approximating case values for the regularization parameters should be given, with the regularization parameters \(\alpha_i\) given by:

\[ H[f] = \beta[f] + \sum_{i=1}^{n}{\frac{(y_i - f(x))^2}{\alpha_i}} \]

Giving the design equation:

\[ \left( \begin{array}{cccccccc} 0 & 0 & 0 & 0 & 1 & 1 & \cdots & 1 \\ 0 & 0 & 0 & 0 & x_1 & x_2 & \cdots & x_n \\ 0 & 0 & 0 & 0 & y_1 & y_2 & \cdots & y_n \\ 0 & 0 & 0 & 0 & z_1 & z_2 & \cdots & z_n \\ 1 & x_1 & y_1 & z_1 & \phi(r_{11}) + \alpha_1 & \phi(r_{12}) & \cdots & \phi(r_{1n}) \\ \dotfill \\ 1 & x_n & y_n & z_n & \phi(r_{n1}) & \phi(r_{n2}) & \cdots & \phi(r_{nn} + \alpha_n) \end{array} \right) \left( \begin{array}{c} a_o \\ a_1 \\ a_2 \\ a_3 \\ \lambda_1 \\ \lambda_1 \\ \vdots \\ \lambda_n \end{array} \right) = \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ 0 \\ f(\mathbf{x_1}) \\ f(\mathbf{x_1}) \\ \vdots \\ f(\mathbf{x_n}) \end{array} \right) \]

The vertex values with components \(x\), \(y \) and \(z\) are used to solve for the four polynomial coefficients and the three basis function weights \(\lambda\), \(\mu\) and \(\nu\). The given values of \(\lambda\) and \(\tau\) are constrained by \(\lambda > 0, \tau > 0\) and \(\lambda \tau < 0.5\). More...

 
WlzBasisFnWlzBasisFnScalarMOS3DFromCPts (int nPts, WlzDVertex3 *cPts, double *cVal, double *alpha, double *param, WlzErrorNum *dstErr)
 Computes a new 3D multi order spline basis function which either interpolates or approximates the given scalar values. See WlzBasisFnMOS3DFromCPts() for details of the multi order spline. The given values of \(\lambda\) and \(\tau\) are constrained by \(\lambda > 0, \tau > 0\) and \(\lambda \tau < 0.5\). More...
 

Detailed Description

Typedef Documentation

◆ Wlz3DProjectionIntFn

Wlz3DProjectionIntFn

Callback function for the WlzGetProjectionFromObject().

◆ WlzBasisEvalFn

WlzBasisEvalFn

An alternative basis function evaluation function that may may be called.

◆ WlzBasisDistFn

WlzBasisDistFn

An alternative basis function distance function that may may be called.

◆ WlzThreshCbFn

WlzThreshCbFn

Callback function for the WlzCbThreshold()

Enumeration Type Documentation

◆ _WlzFnType

enum _WlzFnType

The types of function. Typedef: WlzFnType.

Enumerator
WLZ_FN_BASIS_2DGAUSS 

Gaussian basis function.

WLZ_FN_BASIS_3DGAUSS 
WLZ_FN_BASIS_2DIMQ 

Inverse multiquadric basis function.

WLZ_FN_BASIS_3DIMQ 
WLZ_FN_BASIS_2DPOLY 

Polynomial basis function.

WLZ_FN_BASIS_3DPOLY 
WLZ_FN_BASIS_2DMQ 

Multiquadric basis function.

WLZ_FN_BASIS_3DMQ 
WLZ_FN_BASIS_2DTPS 

Thin plate spline basis fn.

WLZ_FN_BASIS_3DTPS 
WLZ_FN_BASIS_2DCONF_POLY 

2D Conformal polynomial basis function.

WLZ_FN_BASIS_3DCONF_POLY 
WLZ_FN_BASIS_3DMOS 

3D Multi-order spline.

WLZ_FN_BASIS_SCALAR_3DMOS 

3D Multi-order spline with scalar values.

WLZ_FN_SCALAR_MOD 

Modulus (abs() or fabs()).

WLZ_FN_SCALAR_EXP 

Exponential (exp()).

WLZ_FN_SCALAR_LOG 

Logarithm (log()).

WLZ_FN_SCALAR_SQRT 

Square root (x^-1/2).

WLZ_FN_SCALAR_INVSQRT 

Inverse square root (x^-1/2).

WLZ_FN_SCALAR_SQR 

Square (x * x).

WLZ_FN_COUNT 

Not a function but the number of functions. Keep this the last of the enums!

Function Documentation

◆ WlzBasisFnFree()

WlzErrorNum WlzBasisFnFree ( WlzBasisFn basisFn)

◆ WlzBasisFnValuePoly2D()

WlzDVertex2 WlzBasisFnValuePoly2D ( WlzBasisFn basisFn,
WlzDVertex2  srcVx 
)

Calculates the value for the given vertex using a 2D polynomial basis function. This is not a basis function just a polynomial, but it makes sense for it to be incuded in the basis functions since they have a polynomial component.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References _WlzVertexP::d2, _WlzBasisFn::nPoly, _WlzBasisFn::poly, _WlzDVertex2::vtX, and _WlzDVertex2::vtY.

Referenced by WlzBasisFnSetMesh(), and WlzBasisFnTransformVertexD().

◆ WlzBasisFnValueGauss2D()

WlzDVertex2 WlzBasisFnValueGauss2D ( WlzBasisFn basisFn,
WlzDVertex2  srcVx 
)

Calculates the value for the given vertex using a 2D Gaussian basis function.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References _WlzBasisFn::basis, _WlzVertexP::d2, _WlzVertex::d2, _WlzBasisFn::distFn, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::vertices, _WlzDVertex2::vtX, and _WlzDVertex2::vtY.

Referenced by WlzBasisFnSetCMesh2D(), WlzBasisFnSetMesh(), and WlzBasisFnTransformVertexD().

◆ WlzBasisFnValueMQ2D()

WlzDVertex2 WlzBasisFnValueMQ2D ( WlzBasisFn basisFn,
WlzDVertex2  srcVx 
)

Calculates the value for the given vertex using a 2D multiquadric basis function.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References _WlzBasisFn::basis, _WlzVertexP::d2, _WlzVertex::d2, _WlzBasisFn::distFn, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::vertices, _WlzDVertex2::vtX, and _WlzDVertex2::vtY.

Referenced by WlzBasisFnSetCMesh2D(), WlzBasisFnSetMesh(), and WlzBasisFnTransformVertexD().

◆ WlzBasisFnValueMQ3D()

WlzDVertex3 WlzBasisFnValueMQ3D ( WlzBasisFn basisFn,
WlzDVertex3  srcVx 
)

Calculates the displacement value for the given vertex using a 3D multiquadric basis function.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References _WlzBasisFn::basis, _WlzVertexP::d3, _WlzVertex::d3, _WlzBasisFn::distFn, _WlzBasisFnMapData3D::elmIdx, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::vertices, _WlzDVertex3::vtX, _WlzDVertex3::vtY, and _WlzDVertex3::vtZ.

Referenced by WlzBasisFnSetCMesh3D().

◆ WlzBasisFnValueIMQ2D()

WlzDVertex2 WlzBasisFnValueIMQ2D ( WlzBasisFn basisFn,
WlzDVertex2  srcVx 
)

Calculates the value for the given vertex using a 2D inverse multiquadric basis function.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References _WlzBasisFn::basis, _WlzVertexP::d2, _WlzVertex::d2, _WlzBasisFn::distFn, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::vertices, _WlzDVertex2::vtX, and _WlzDVertex2::vtY.

Referenced by WlzBasisFnSetCMesh2D(), WlzBasisFnSetMesh(), and WlzBasisFnTransformVertexD().

◆ WlzBasisFnValueIMQ3D()

WlzDVertex3 WlzBasisFnValueIMQ3D ( WlzBasisFn basisFn,
WlzDVertex3  srcVx 
)

Calculates the displacement value for the given vertex using a 3D inverse multiquadric basis function.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References _WlzBasisFn::basis, _WlzVertexP::d3, _WlzVertex::d3, _WlzBasisFn::distFn, _WlzBasisFnMapData3D::elmIdx, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::vertices, _WlzDVertex3::vtX, _WlzDVertex3::vtY, and _WlzDVertex3::vtZ.

Referenced by WlzBasisFnSetCMesh3D().

◆ WlzBasisFnValueTPS2D()

WlzDVertex2 WlzBasisFnValueTPS2D ( WlzBasisFn basisFn,
WlzDVertex2  srcVx 
)

Calculates the value for the given vertex using a 2D thin plate spline basis function.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References _WlzBasisFn::basis, _WlzVertexP::d2, _WlzVertex::d2, _WlzBasisFn::distFn, _WlzBasisFn::nVtx, _WlzBasisFn::vertices, _WlzDVertex2::vtX, and _WlzDVertex2::vtY.

Referenced by WlzBasisFnSetCMesh2D(), WlzBasisFnSetMesh(), and WlzBasisFnTransformVertexD().

◆ WlzBasisFnValueConf2D()

WlzDVertex2 WlzBasisFnValueConf2D ( WlzBasisFn basisFn,
WlzDVertex2  srcVx 
)

Calculates the value for the given vertex using a 2D conformal polynomial basis function.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References AlgCMult(), _WlzVertexP::d2, _ComplexD::im, _WlzBasisFn::nPoly, _WlzBasisFn::poly, _ComplexD::re, _WlzDVertex2::vtX, and _WlzDVertex2::vtY.

Referenced by WlzBasisFnSetMesh(), and WlzBasisFnTransformVertexD().

◆ WlzBasisFnValueMOS3D()

WlzDVertex3 WlzBasisFnValueMOS3D ( WlzBasisFn basisFn,
WlzDVertex3  srcVx 
)

Calculates the value for the given vertex using a 3D multiorder basis function:

\[ \phi(r) = \frac{1}{4 \pi \delta^2 r} (1 - \frac{w}{w - v} e^{- \sqrt{v} r} + \frac{v}{w - v} e^{- \sqrt{w} r}) \]

\[ v = \frac{1 + \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ w = \frac{1 - \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

.

Returns
New vertex value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References ALG_M_PI, _WlzBasisFn::basis, _WlzVertexP::d3, _WlzBasisFn::evalFn, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::vertices, _WlzDVertex3::vtX, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_VTX_3_LENGTH, and WLZ_VTX_3_SUB.

◆ WlzBasisFnValueScalarMOS3D()

double WlzBasisFnValueScalarMOS3D ( WlzBasisFn basisFn,
WlzDVertex3  srcVx 
)

Calculates the value for the given vertex using a scalar 3D multiorder basis function:

\[ \phi(r) = \frac{1}{4 \pi \delta^2 r} (1 - \frac{w}{w - v} e^{- \sqrt{v} r} + \frac{v}{w - v} e^{- \sqrt{w} r}) \]

\[ v = \frac{1 + \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ w = \frac{1 - \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

.

Returns
New scalar value.
Parameters
basisFnBasis function.
srcVxSource vertex.

References ALG_M_PI, _WlzBasisFn::basis, _WlzVertexP::d3, _WlzBasisFn::evalFn, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzVertexP::v, _WlzBasisFn::vertices, WLZ_VTX_3_LENGTH, and WLZ_VTX_3_SUB.

◆ WlzBasisFnValueMOSPhi()

double WlzBasisFnValueMOSPhi ( double  r,
double  delta,
double  tau 
)

Computes the value of a single multiorder radial basis function:

\[ \phi(r) = \frac{1}{4 \pi \delta^2 r} (1 - \frac{w}{w - v} e^{- \sqrt{v} r} + \frac{v}{w - v} e^{- \sqrt{w} r}) \]

\[ v = \frac{1 + \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ w = \frac{1 - \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

.

Returns
The value of a single multiorder radial basis function.
Parameters
rRadial distance, \((r > 0)\).
deltaThe 1st order smoothness parameter \(\delta\), \((\delta > 0)\).
tauThe 3rd order smoothness parameter \(\tau\), \((\tau > 0)\).

References ALG_M_PI.

◆ WlzBasisFnGauss2DFromCPts()

WlzBasisFn* WlzBasisFnGauss2DFromCPts ( int  nPts,
WlzDVertex2 dPts,
WlzDVertex2 sPts,
double  delta,
WlzBasisFn prvBasisFn,
WlzCMesh2D mesh,
WlzErrorNum dstErr 
)

Creates a new Gaussian basis function.

Returns
New basis function.
            This function may be used either to compute a new Gaussian
            radial basis function, or if given a previous Gaussian
            radial basis function, to recompute a Gaussian basis
            recycling the buffers (and distance map if used) from
            the prevoius basis function when the control points
            have changed. If recycling the buffers a new basis
            function is created which uses the (reallocated)
            buffers of the previous basis function. After this function
            has been called the previous basis function should be freed.
Parameters
nPtsNumber of control point pairs.
dPtsDestination control points.
sPtsSource control points.
deltaNormalized delta value in range [> 0.0 , < 1.0 ].
prvBasisFnPrevious basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling.
meshUsed to compute constrained distances. If NULL Euclidean distances will be used.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcFree(), AlcMalloc(), AlcRealloc(), ALG_MIN, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d2, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m2, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _WlzBasisFn::sVertices, _WlzCMesh2D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, WLZ_CMESH_2D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_FN_BASIS_2DGAUSS, and WlzGeomCmpVtx2D().

Referenced by WlzBasisFnTPS2DChangeCPtsParam(), and WlzBasisFnTrFromCPts2DParam().

◆ WlzBasisFnPoly2DFromCPts()

WlzBasisFn* WlzBasisFnPoly2DFromCPts ( int  nPts,
int  order,
WlzDVertex2 dPts,
WlzDVertex2 sPts,
WlzErrorNum dstErr 
)

Creates a new polynomial basis function.

Returns
New basis function.
Parameters
nPtsNumber of control point pairs.
orderOrder of polynomial.
dPtsDestination control points.
sPtsSource control points.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcMalloc(), AlgMatrixRectNew(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _AlgMatrix::core, _WlzBasisFn::nBasis, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzBasisFn::poly, _AlgMatrix::rect, _WlzBasisFn::type, _WlzVertexP::v, _WlzDVertex2::vtX, _WlzDVertex2::vtY, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_FN_BASIS_2DPOLY, and WlzErrorFromAlg().

Referenced by WlzBasisFnTPS2DChangeCPtsParam(), and WlzBasisFnTrFromCPts2DParam().

◆ WlzBasisFnConf2DFromCPts()

WlzBasisFn* WlzBasisFnConf2DFromCPts ( int  nPts,
int  order,
WlzDVertex2 dPts,
WlzDVertex2 sPts,
WlzErrorNum dstErr 
)

Creates a new conformal basis function.

Returns
New basis function.
Parameters
nPtsNumber of control point pairs.
orderOrder of conformal poly.
dPtsDestination control points.
sPtsSource control points.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcMalloc(), AlgCMult(), AlgMatrixRectNew(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _AlgMatrix::core, _ComplexD::im, _WlzBasisFn::nBasis, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzBasisFn::poly, _ComplexD::re, _AlgMatrix::rect, _WlzBasisFn::type, _WlzVertexP::v, _WlzDVertex2::vtX, _WlzDVertex2::vtY, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_FN_BASIS_2DCONF_POLY, and WlzErrorFromAlg().

Referenced by WlzBasisFnTPS2DChangeCPtsParam(), and WlzBasisFnTrFromCPts2DParam().

◆ WlzBasisFnMQ2DFromCPts()

WlzBasisFn* WlzBasisFnMQ2DFromCPts ( int  nPts,
WlzDVertex2 dPts,
WlzDVertex2 sPts,
double  delta,
WlzBasisFn prvBasisFn,
WlzCMesh2D mesh,
WlzErrorNum dstErr 
)

Creates a new multiquadric basis function.

Returns
New basis function.
    To improve the design matix condition number the problem
    is rescaled when a distance map is not being used.

            This function may be used either to compute a new MQ
            radial basis function, or if given a previous MQ
            radial basis function, to recompute a MQ basis
            recycling the buffers (and distance map if used) from
            the prevoius basis function when the control points
            have changed. If recycling the buffers a new basis
            function is created which uses the (reallocated)
            buffers of the previous basis function. After this function
            has been called the previous basis function should be freed.
Parameters
nPtsNumber of control point pairs.
dPtsDestination control points.
sPtsSource control points.
deltaNormalized delta value in range [> 0.0 , < 1.0 ].
prvBasisFnPrevious basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling.
meshUsed to compute constrained distances. If NULL Euclidean distances will be used.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcFree(), AlcMalloc(), AlcRealloc(), ALG_MIN, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d2, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m2, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _WlzBasisFn::sVertices, _WlzCMesh2D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, WLZ_CMESH_2D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_FN_BASIS_2DMQ, and WlzGeomCmpVtx2D().

Referenced by WlzBasisFnTPS2DChangeCPtsParam(), and WlzBasisFnTrFromCPts2DParam().

◆ WlzBasisFnMQ3DFromCPts()

WlzBasisFn* WlzBasisFnMQ3DFromCPts ( int  nPts,
WlzDVertex3 dPts,
WlzDVertex3 sPts,
double  delta,
WlzBasisFn prvBasisFn,
WlzCMesh3D mesh,
WlzErrorNum dstErr 
)

Creates a new multiquadric basis function.

Returns
New basis function.
Parameters
nPtsNumber of control point pairs.
dPtsDestination control points.
sPtsSource control points.
deltaNormalized delta value in range [> 0.0 , < 1.0 ].
prvBasisFnPrevious basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling.
meshUsed to compute constrained distances. If NULL Euclidean distances will be used.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcFree(), AlcMalloc(), AlcRealloc(), ALG_MIN, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d3, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m3, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _WlzBasisFn::sVertices, _WlzCMesh3D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, WLZ_CMESH_3D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_FN_BASIS_3DMQ, and WlzGeomCmpVtx3D().

Referenced by WlzBasisFnTrFromCPts3DParam().

◆ WlzBasisFnIMQ2DFromCPts()

WlzBasisFn* WlzBasisFnIMQ2DFromCPts ( int  nPts,
WlzDVertex2 dPts,
WlzDVertex2 sPts,
double  delta,
WlzBasisFn prvBasisFn,
WlzCMesh2D mesh,
WlzErrorNum dstErr 
)

Creates a new inverse-multiquadric basis function.

Returns
New basis function.
    To improve the design matix condition number the problem
    is rescaled when a distance map is not being used.

            This function may be used either to compute a new IMQ
            radial basis function, or if given a previous IMQ
            radial basis function, to recompute a IMQ basis
            recycling the buffers (and distance map if used) from
            the prevoius basis function when the control points
            have changed. If recycling the buffers a new basis
            function is created which uses the (reallocated)
            buffers of the previous basis function. After this function
            has been called the previous basis function should be freed.
Parameters
nPtsNumber of control point pairs.
dPtsDestination control points.
sPtsSource control points.
deltaNormalized delta value in range [> 0.0 , < 1.0 ].
prvBasisFnPrevious basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling.
meshUsed to compute constrained distances. If NULL Euclidean distances will be used.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcFree(), AlcMalloc(), AlcRealloc(), ALG_MIN, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d2, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m2, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _WlzBasisFn::sVertices, _WlzCMesh2D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, WLZ_CMESH_2D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_FN_BASIS_2DIMQ, and WlzGeomCmpVtx2D().

Referenced by WlzBasisFnTPS2DChangeCPtsParam(), and WlzBasisFnTrFromCPts2DParam().

◆ WlzBasisFnIMQ3DFromCPts()

WlzBasisFn* WlzBasisFnIMQ3DFromCPts ( int  nPts,
WlzDVertex3 dPts,
WlzDVertex3 sPts,
double  delta,
WlzBasisFn prvBasisFn,
WlzCMesh3D mesh,
WlzErrorNum dstErr 
)

Creates a new inverse-multiquadric basis function.

Returns
New basis function.
Parameters
nPtsNumber of control point pairs.
dPtsDestination control points.
sPtsSource control points.
deltaNormalized delta value in range [> 0.0 , < 1.0 ].
prvBasisFnPrevious basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling.
meshUsed to compute constrained distances. If NULL Euclidean distances will be used.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcFree(), AlcMalloc(), AlcRealloc(), ALG_MIN, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d3, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m3, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _WlzBasisFn::sVertices, _WlzCMesh3D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, WLZ_CMESH_3D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_FN_BASIS_3DIMQ, and WlzGeomCmpVtx3D().

Referenced by WlzBasisFnTrFromCPts3DParam().

◆ WlzBasisFnTPS2DFromCPts()

WlzBasisFn* WlzBasisFnTPS2DFromCPts ( int  nPts,
WlzDVertex2 dPts,
WlzDVertex2 sPts,
WlzBasisFn prvBasisFn,
WlzCMesh2D mesh,
WlzErrorNum dstErr 
)

Creates a new thin plate spline basis function.

Returns
New basis function.
Parameters
nPtsNumber of control point pairs.
dPtsDestination control points.
sPtsSource control points.
prvBasisFnPrevious basis function, which if not NULL, may be used to avoid recomputing values (eg distance map).
meshMesh which is used to compute constrained distances. If non NULL and the mesh type is WLZ_CMESH_2D then constrained distances are used and these are computed using the mesh. If NULL or the transform is some other type then Euclidean distances are used. indexed using the node index.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcFree(), AlcMalloc(), AlcRealloc(), ALG_MIN, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d2, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m2, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _WlzBasisFn::sVertices, _WlzCMesh2D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, WLZ_CMESH_2D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_FN_BASIS_2DTPS, and WlzGeomCmpVtx2D().

Referenced by WlzBasisFnTPS2DChangeCPtsParam(), and WlzBasisFnTrFromCPts2DParam().

◆ WlzBasisFnMOS3DFromCPts()

WlzBasisFn* WlzBasisFnMOS3DFromCPts ( int  nPts,
WlzDVertex2 dPts,
WlzDVertex2 sPts,
double *  alpha,
double *  param,
WlzErrorNum dstErr 
)

Creates a new 3D multi order spline basis function:

\[ \phi(r) = \frac{1}{4 \pi \delta^2 r} (1 - \frac{w}{w - v} e^{- \sqrt{v} r} + \frac{v}{w - v} e^{- \sqrt{w} r}) \]

\[ v = \frac{1 + \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ w = \frac{1 - \sqrt{1 - 4 \pi \tau^2 \delta^2}}{2 \tau^2} \]

\[ f(\mathbf{x}) = P(\mathbf{x}) + \sum_{i=1}^{n}{\lambda_i \phi(r_i)} \]

\[ r_i = |\mathbf{x} - \mathbf{x'_i}| \]

The multi order spline may either be an exact interpolating function or one which approximates the given control points. In the approximating case values for the regularization parameters should be given, with the regularization parameters \(\alpha_i\) given by:

\[ H[f] = \beta[f] + \sum_{i=1}^{n}{\frac{(y_i - f(x))^2}{\alpha_i}} \]

Giving the design equation:

\[ \left( \begin{array}{cccccccc} 0 & 0 & 0 & 0 & 1 & 1 & \cdots & 1 \\ 0 & 0 & 0 & 0 & x_1 & x_2 & \cdots & x_n \\ 0 & 0 & 0 & 0 & y_1 & y_2 & \cdots & y_n \\ 0 & 0 & 0 & 0 & z_1 & z_2 & \cdots & z_n \\ 1 & x_1 & y_1 & z_1 & \phi(r_{11}) + \alpha_1 & \phi(r_{12}) & \cdots & \phi(r_{1n}) \\ \dotfill \\ 1 & x_n & y_n & z_n & \phi(r_{n1}) & \phi(r_{n2}) & \cdots & \phi(r_{nn} + \alpha_n) \end{array} \right) \left( \begin{array}{c} a_o \\ a_1 \\ a_2 \\ a_3 \\ \lambda_1 \\ \lambda_1 \\ \vdots \\ \lambda_n \end{array} \right) = \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ 0 \\ f(\mathbf{x_1}) \\ f(\mathbf{x_1}) \\ \vdots \\ f(\mathbf{x_n}) \end{array} \right) \]

The vertex values with components \(x\), \(y \) and \(z\) are used to solve for the four polynomial coefficients and the three basis function weights \(\lambda\), \(\mu\) and \(\nu\). The given values of \(\lambda\) and \(\tau\) are constrained by \(\lambda > 0, \tau > 0\) and \(\lambda \tau < 0.5\).

Returns
New basis function.
Todo:
WlzBasisFnMOS3DFromCPts() has yet to be implemented.
Parameters
nPtsNumber of control point pairs.
dPtsDestination control points.
sPtsSource control points.
alphaRegularization parameter for the control points. If NULL all regularization parameters are set to zero for exact interpolation.
paramSmoothness parameters \(\delta\) and \(\tau\) in that order, but may be NULL in which case default parameter values will be used.
dstErrDestination error pointer, may be NULL.

References WLZ_ERR_UNIMPLEMENTED.

◆ WlzBasisFnScalarMOS3DFromCPts()

WlzBasisFn* WlzBasisFnScalarMOS3DFromCPts ( int  nPts,
WlzDVertex3 cPts,
double *  cVal,
double *  alpha,
double *  param,
WlzErrorNum dstErr 
)

Computes a new 3D multi order spline basis function which either interpolates or approximates the given scalar values. See WlzBasisFnMOS3DFromCPts() for details of the multi order spline. The given values of \(\lambda\) and \(\tau\) are constrained by \(\lambda > 0, \tau > 0\) and \(\lambda \tau < 0.5\).

Returns
New basis function.
Parameters
nPtsNumber of values.
cPtsPositions of the control points.
cValValues at the control points.
alphaRegularization parameter for the control points. If NULL all regularization parameters are set to zero for exact interpolation.
paramSmoothness parameters \(\delta\) and \(\tau\) in that order, but may be NULL in which case default parameter values will be used.
dstErrDestination error pointer, may be NULL.

References _AlgMatrix::core, WLZ_ERR_NONE, and WLZ_ERR_PARAM_DATA.