Woolz Image Processing
Version 1.8.3
|
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... | |
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... | |
WlzBasisFn * | WlzBasisFnGauss2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr) |
Creates a new Gaussian basis function. More... | |
WlzBasisFn * | WlzBasisFnPoly2DFromCPts (int nPts, int order, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzErrorNum *dstErr) |
Creates a new polynomial basis function. More... | |
WlzBasisFn * | WlzBasisFnConf2DFromCPts (int nPts, int order, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzErrorNum *dstErr) |
Creates a new conformal basis function. More... | |
WlzBasisFn * | WlzBasisFnMQ2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr) |
Creates a new multiquadric basis function. More... | |
WlzBasisFn * | WlzBasisFnMQ3DFromCPts (int nPts, WlzDVertex3 *dPts, WlzDVertex3 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh3D *mesh, WlzErrorNum *dstErr) |
Creates a new multiquadric basis function. More... | |
WlzBasisFn * | WlzBasisFnIMQ2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr) |
Creates a new inverse-multiquadric basis function. More... | |
WlzBasisFn * | WlzBasisFnIMQ3DFromCPts (int nPts, WlzDVertex3 *dPts, WlzDVertex3 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh3D *mesh, WlzErrorNum *dstErr) |
Creates a new inverse-multiquadric basis function. More... | |
WlzBasisFn * | WlzBasisFnTPS2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr) |
Creates a new thin plate spline basis function. More... | |
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\). More... | |
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\). More... | |
Wlz3DProjectionIntFn |
Callback function for the WlzGetProjectionFromObject().
WlzBasisEvalFn |
An alternative basis function evaluation function that may may be called.
WlzBasisDistFn |
An alternative basis function distance function that may may be called.
WlzThreshCbFn |
Callback function for the WlzCbThreshold()
enum _WlzFnType |
The types of function. Typedef: WlzFnType.
WlzErrorNum WlzBasisFnFree | ( | WlzBasisFn * | basisFn | ) |
Free's the given basis function.
basisFn | Given basis function, may be NULL. |
References AlcFree(), _WlzBasisFn::basis, _WlzBasisFn::distMap, _WlzBasisFn::evalData, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _WlzBasisFn::sVertices, _WlzVertexP::v, _WlzBasisFn::vertices, WLZ_ERR_NONE, and WlzFreeHistogramDomain().
Referenced by WlzBasisFnFreeTransform(), and WlzBasisFnTPS2DChangeCPtsParam().
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.
basisFn | Basis function. |
srcVx | Source vertex. |
References _WlzVertexP::d2, _WlzBasisFn::nPoly, _WlzBasisFn::poly, _WlzDVertex2::vtX, and _WlzDVertex2::vtY.
Referenced by WlzBasisFnSetMesh(), and WlzBasisFnTransformVertexD().
WlzDVertex2 WlzBasisFnValueGauss2D | ( | WlzBasisFn * | basisFn, |
WlzDVertex2 | srcVx | ||
) |
Calculates the value for the given vertex using a 2D Gaussian basis function.
basisFn | Basis function. |
srcVx | Source 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().
WlzDVertex2 WlzBasisFnValueMQ2D | ( | WlzBasisFn * | basisFn, |
WlzDVertex2 | srcVx | ||
) |
Calculates the value for the given vertex using a 2D multiquadric basis function.
basisFn | Basis function. |
srcVx | Source 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().
WlzDVertex3 WlzBasisFnValueMQ3D | ( | WlzBasisFn * | basisFn, |
WlzDVertex3 | srcVx | ||
) |
Calculates the displacement value for the given vertex using a 3D multiquadric basis function.
basisFn | Basis function. |
srcVx | Source 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().
WlzDVertex2 WlzBasisFnValueIMQ2D | ( | WlzBasisFn * | basisFn, |
WlzDVertex2 | srcVx | ||
) |
Calculates the value for the given vertex using a 2D inverse multiquadric basis function.
basisFn | Basis function. |
srcVx | Source 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().
WlzDVertex3 WlzBasisFnValueIMQ3D | ( | WlzBasisFn * | basisFn, |
WlzDVertex3 | srcVx | ||
) |
Calculates the displacement value for the given vertex using a 3D inverse multiquadric basis function.
basisFn | Basis function. |
srcVx | Source 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().
WlzDVertex2 WlzBasisFnValueTPS2D | ( | WlzBasisFn * | basisFn, |
WlzDVertex2 | srcVx | ||
) |
Calculates the value for the given vertex using a 2D thin plate spline basis function.
basisFn | Basis function. |
srcVx | Source 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().
WlzDVertex2 WlzBasisFnValueConf2D | ( | WlzBasisFn * | basisFn, |
WlzDVertex2 | srcVx | ||
) |
Calculates the value for the given vertex using a 2D conformal polynomial basis function.
basisFn | Basis function. |
srcVx | Source vertex. |
References AlgCMult(), _WlzVertexP::d2, _ComplexD::im, _WlzBasisFn::nPoly, _WlzBasisFn::poly, _ComplexD::re, _WlzDVertex2::vtX, and _WlzDVertex2::vtY.
Referenced by WlzBasisFnSetMesh(), and WlzBasisFnTransformVertexD().
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} \]
.
basisFn | Basis function. |
srcVx | Source 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.
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} \]
.
basisFn | Basis function. |
srcVx | Source 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.
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} \]
.
r | Radial distance, \((r > 0)\). |
delta | The 1st order smoothness parameter \(\delta\), \((\delta > 0)\). |
tau | The 3rd order smoothness parameter \(\tau\), \((\tau > 0)\). |
References ALG_M_PI.
WlzBasisFn* WlzBasisFnGauss2DFromCPts | ( | int | nPts, |
WlzDVertex2 * | dPts, | ||
WlzDVertex2 * | sPts, | ||
double | delta, | ||
WlzBasisFn * | prvBasisFn, | ||
WlzCMesh2D * | mesh, | ||
WlzErrorNum * | dstErr | ||
) |
Creates a new Gaussian 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.
nPts | Number of control point pairs. |
dPts | Destination control points. |
sPts | Source control points. |
delta | Normalized delta value in range [> 0.0 , < 1.0 ]. |
prvBasisFn | Previous basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling. |
mesh | Used to compute constrained distances. If NULL Euclidean distances will be used. |
dstErr | Destination 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().
WlzBasisFn* WlzBasisFnPoly2DFromCPts | ( | int | nPts, |
int | order, | ||
WlzDVertex2 * | dPts, | ||
WlzDVertex2 * | sPts, | ||
WlzErrorNum * | dstErr | ||
) |
Creates a new polynomial basis function.
nPts | Number of control point pairs. |
order | Order of polynomial. |
dPts | Destination control points. |
sPts | Source control points. |
dstErr | Destination 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().
WlzBasisFn* WlzBasisFnConf2DFromCPts | ( | int | nPts, |
int | order, | ||
WlzDVertex2 * | dPts, | ||
WlzDVertex2 * | sPts, | ||
WlzErrorNum * | dstErr | ||
) |
Creates a new conformal basis function.
nPts | Number of control point pairs. |
order | Order of conformal poly. |
dPts | Destination control points. |
sPts | Source control points. |
dstErr | Destination 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().
WlzBasisFn* WlzBasisFnMQ2DFromCPts | ( | int | nPts, |
WlzDVertex2 * | dPts, | ||
WlzDVertex2 * | sPts, | ||
double | delta, | ||
WlzBasisFn * | prvBasisFn, | ||
WlzCMesh2D * | mesh, | ||
WlzErrorNum * | dstErr | ||
) |
Creates a new multiquadric 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.
nPts | Number of control point pairs. |
dPts | Destination control points. |
sPts | Source control points. |
delta | Normalized delta value in range [> 0.0 , < 1.0 ]. |
prvBasisFn | Previous basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling. |
mesh | Used to compute constrained distances. If NULL Euclidean distances will be used. |
dstErr | Destination 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().
WlzBasisFn* WlzBasisFnMQ3DFromCPts | ( | int | nPts, |
WlzDVertex3 * | dPts, | ||
WlzDVertex3 * | sPts, | ||
double | delta, | ||
WlzBasisFn * | prvBasisFn, | ||
WlzCMesh3D * | mesh, | ||
WlzErrorNum * | dstErr | ||
) |
Creates a new multiquadric basis function.
nPts | Number of control point pairs. |
dPts | Destination control points. |
sPts | Source control points. |
delta | Normalized delta value in range [> 0.0 , < 1.0 ]. |
prvBasisFn | Previous basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling. |
mesh | Used to compute constrained distances. If NULL Euclidean distances will be used. |
dstErr | Destination 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().
WlzBasisFn* WlzBasisFnIMQ2DFromCPts | ( | int | nPts, |
WlzDVertex2 * | dPts, | ||
WlzDVertex2 * | sPts, | ||
double | delta, | ||
WlzBasisFn * | prvBasisFn, | ||
WlzCMesh2D * | mesh, | ||
WlzErrorNum * | dstErr | ||
) |
Creates a new inverse-multiquadric 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.
nPts | Number of control point pairs. |
dPts | Destination control points. |
sPts | Source control points. |
delta | Normalized delta value in range [> 0.0 , < 1.0 ]. |
prvBasisFn | Previous basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling. |
mesh | Used to compute constrained distances. If NULL Euclidean distances will be used. |
dstErr | Destination 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().
WlzBasisFn* WlzBasisFnIMQ3DFromCPts | ( | int | nPts, |
WlzDVertex3 * | dPts, | ||
WlzDVertex3 * | sPts, | ||
double | delta, | ||
WlzBasisFn * | prvBasisFn, | ||
WlzCMesh3D * | mesh, | ||
WlzErrorNum * | dstErr | ||
) |
Creates a new inverse-multiquadric basis function.
nPts | Number of control point pairs. |
dPts | Destination control points. |
sPts | Source control points. |
delta | Normalized delta value in range [> 0.0 , < 1.0 ]. |
prvBasisFn | Previous basis function to be recycled, may be NULL. Arrays will be used for the new basis function. Must be freed after recycling. |
mesh | Used to compute constrained distances. If NULL Euclidean distances will be used. |
dstErr | Destination 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().
WlzBasisFn* WlzBasisFnTPS2DFromCPts | ( | int | nPts, |
WlzDVertex2 * | dPts, | ||
WlzDVertex2 * | sPts, | ||
WlzBasisFn * | prvBasisFn, | ||
WlzCMesh2D * | mesh, | ||
WlzErrorNum * | dstErr | ||
) |
Creates a new thin plate spline basis function.
nPts | Number of control point pairs. |
dPts | Destination control points. |
sPts | Source control points. |
prvBasisFn | Previous basis function, which if not NULL, may be used to avoid recomputing values (eg distance map). |
mesh | Mesh 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. |
dstErr | Destination 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().
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\).
nPts | Number of control point pairs. |
dPts | Destination control points. |
sPts | Source control points. |
alpha | Regularization parameter for the control points. If NULL all regularization parameters are set to zero for exact interpolation. |
param | Smoothness parameters \(\delta\) and \(\tau\) in that order, but may be NULL in which case default parameter values will be used. |
dstErr | Destination error pointer, may be NULL. |
References WLZ_ERR_UNIMPLEMENTED.
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\).
nPts | Number of values. |
cPts | Positions of the control points. |
cVal | Values at the control points. |
alpha | Regularization parameter for the control points. If NULL all regularization parameters are set to zero for exact interpolation. |
param | Smoothness parameters \(\delta\) and \(\tau\) in that order, but may be NULL in which case default parameter values will be used. |
dstErr | Destination error pointer, may be NULL. |
References _AlgMatrix::core, WLZ_ERR_NONE, and WLZ_ERR_PARAM_DATA.