Woolz Image Processing
Version 1.7.5
|
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 WlzBasisFnConf2DFromCPts(), WlzBasisFnFreeTransform(), WlzBasisFnGauss2DFromCPts(), WlzBasisFnIMQ2DFromCPts(), WlzBasisFnIMQ3DFromCPts(), WlzBasisFnMQ2DFromCPts(), WlzBasisFnMQ3DFromCPts(), WlzBasisFnPoly2DFromCPts(), WlzBasisFnScalarMOS3DFromCPts(), WlzBasisFnTPS2DChangeCPtsParam(), WlzBasisFnTPS2DFromCPts(), and WlzContourFromPoints().
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::poly, _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::poly, _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::poly, _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::poly, _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::poly, _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::poly, _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::poly, _WlzBasisFn::vertices, _WlzDVertex3::vtX, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_VTX_3_ADD, 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, _WlzBasisFn::poly, _WlzVertexP::v, _WlzBasisFn::vertices, WLZ_VTX_3_LENGTH, and WLZ_VTX_3_SUB.
Referenced by WlzContourFromPoints().
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 AlcVectorItemGet(), ALG_M_PI, _WlzVertexP::d2, _WlzVertex::d2, _WlzVertexP::d3, _WlzVertex::d3, _WlzBasisFn::distMap, _WlzCMeshElm2D::edu, _WlzCMeshRes::elm, _WlzBasisFnMapData3D::elmIdx, _WlzCMeshNod3D::idx, _WlzBasisFnMapData3D::lambda, _WlzCMeshP::m2, _WlzCMeshP::m3, _WlzBasisFn::mesh, _WlzBasisFnMapData3D::nod, _WlzCMeshEdgU2D::nod, _WlzCMesh2D::res, _WlzCMesh3D::res, _WlzCMeshEntRes::vec, _WlzBasisFn::vertices, _WlzDVertex2::vtX, _WlzDVertex3::vtX, _WlzDVertex2::vtY, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_CMESH_ELM3D_GET_NODE_0, WLZ_CMESH_ELM3D_GET_NODE_1, WLZ_CMESH_ELM3D_GET_NODE_2, WLZ_CMESH_ELM3D_GET_NODE_3, WLZ_VTX_2_SQRLEN, WLZ_VTX_2_SUB, WLZ_VTX_3_SQRLEN, WLZ_VTX_3_SUB, WlzCMeshElmEnclosingPos2D(), WlzCMeshElmEnclosingPos3D(), WlzGeomBaryCoordsTet3D(), WlzGeomInterpolateTet3D(), and WlzGeomInterpolateTri2D().
Referenced by WlzBasisFnScalarMOS3DFromCPts().
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, AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d2, _WlzVertex::d2, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m2, _WlzCMeshEntRes::maxEnt, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nBasis, _WlzCMeshRes::nod, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _AlgMatrix::rect, _WlzCMesh2D::res, _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_ERR_PARAM_DATA, WLZ_FN_BASIS_2DGAUSS, WlzBasisFnFree(), WlzCMeshFMarNodes2D(), WlzErrorFromAlg(), WlzGeomCmpVtx2D(), WlzValueCopyDVertexToDVertex(), _WlzDBox2::xMax, _WlzDBox2::xMin, _WlzDBox2::yMax, and _WlzDBox2::yMin.
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(), AlcFree(), AlcMalloc(), AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _AlgMatrix::core, _WlzVertexP::d2, _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, WlzBasisFnFree(), 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(), AlcFree(), AlcMalloc(), AlgCMult(), AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _AlgMatrix::core, _WlzVertexP::d2, _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, WlzBasisFnFree(), 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, AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d2, _WlzVertex::d2, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m2, _WlzCMeshEntRes::maxEnt, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nBasis, _WlzCMeshRes::nod, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _AlgMatrix::rect, _WlzCMesh2D::res, _WlzBasisFn::sVertices, _WlzCMesh2D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, _WlzDVertex2::vtX, _WlzDVertex2::vtY, WLZ_CMESH_2D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_FN_BASIS_2DMQ, WlzBasisFnFree(), WlzCMeshFMarNodes2D(), WlzErrorFromAlg(), WlzGeomCmpVtx2D(), WlzValueCopyDVertexToDVertex(), _WlzDBox2::xMax, _WlzDBox2::xMin, _WlzDBox2::yMax, and _WlzDBox2::yMin.
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, AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d3, _WlzVertex::d3, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m3, _WlzCMeshEntRes::maxEnt, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nBasis, _WlzCMeshRes::nod, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _AlgMatrix::rect, _WlzCMesh3D::res, _WlzBasisFn::sVertices, _WlzCMesh3D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, _WlzDVertex3::vtX, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_CMESH_3D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_FN_BASIS_3DMQ, WlzBasisFnFree(), WlzCMeshFMarNodes3D(), WlzErrorFromAlg(), WlzGeomCmpVtx3D(), WlzValueCopyDVertexToDVertex3(), _WlzDBox3::xMax, _WlzDBox3::xMin, _WlzDBox3::yMax, _WlzDBox3::yMin, _WlzDBox3::zMax, and _WlzDBox3::zMin.
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, AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d2, _WlzVertex::d2, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m2, _WlzCMeshEntRes::maxEnt, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nBasis, _WlzCMeshRes::nod, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _AlgMatrix::rect, _WlzCMesh2D::res, _WlzBasisFn::sVertices, _WlzCMesh2D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, _WlzDVertex2::vtX, _WlzDVertex2::vtY, WLZ_CMESH_2D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_FN_BASIS_2DIMQ, WlzBasisFnFree(), WlzCMeshFMarNodes2D(), WlzErrorFromAlg(), WlzGeomCmpVtx2D(), WlzValueCopyDVertexToDVertex(), _WlzDBox2::xMax, _WlzDBox2::xMin, _WlzDBox2::yMax, and _WlzDBox2::yMin.
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, AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d3, _WlzVertex::d3, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m3, _WlzCMeshEntRes::maxEnt, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nBasis, _WlzCMeshRes::nod, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _AlgMatrix::rect, _WlzCMesh3D::res, _WlzBasisFn::sVertices, _WlzCMesh3D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, _WlzDVertex3::vtX, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_CMESH_3D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_FN_BASIS_3DIMQ, WlzBasisFnFree(), WlzCMeshFMarNodes3D(), WlzErrorFromAlg(), WlzGeomCmpVtx3D(), WlzValueCopyDVertexToDVertex3(), _WlzDBox3::xMax, _WlzDBox3::xMin, _WlzDBox3::yMax, _WlzDBox3::yMin, _WlzDBox3::zMax, and _WlzDBox3::zMin.
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, AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), _AlgMatrixRect::array, _WlzBasisFn::basis, _AlgMatrix::core, _WlzVertexP::d2, _WlzVertex::d2, _WlzBasisFn::distFn, _WlzBasisFn::distMap, _WlzCMeshP::m2, _WlzCMeshEntRes::maxEnt, _WlzBasisFn::maxVx, _WlzBasisFn::mesh, _WlzBasisFn::nBasis, _WlzCMeshRes::nod, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzBasisFn::param, _WlzBasisFn::poly, _AlgMatrix::rect, _WlzCMesh2D::res, _WlzBasisFn::sVertices, _WlzCMesh2D::type, _WlzBasisFn::type, _WlzVertexP::v, _WlzCMeshP::v, _WlzBasisFn::vertices, _WlzDVertex2::vtX, _WlzDVertex2::vtY, WLZ_CMESH_2D, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_FN_BASIS_2DTPS, WlzBasisFnFree(), WlzCMeshFMarNodes2D(), WlzErrorFromAlg(), WlzGeomCmpVtx2D(), WlzValueCopyDVertexToDVertex(), _WlzDBox2::xMax, _WlzDBox2::xMin, _WlzDBox2::yMax, and _WlzDBox2::yMin.
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 AlcCalloc(), AlcDouble1WriteAsci(), AlcFree(), AlcMalloc(), ALG_M_PI, AlgMatrixCGSolve(), AlgMatrixFree(), AlgMatrixRectNew(), AlgMatrixSVBackSub(), AlgMatrixSVDecomp(), AlgMatrixWriteAscii(), _AlgMatrixRect::array, _WlzBasisFn::basis, _WlzHistogramDomain::binSize, _WlzHistogramDomain::binValues, _AlgMatrix::core, _WlzVertexP::d2, _WlzVertexP::d3, _WlzGreyP::dbp, _WlzBasisFn::evalData, _WlzBasisFn::evalFn, _WlzBasisFn::nBasis, _WlzHistogramDomain::nBins, _WlzBasisFn::nPoly, _WlzBasisFn::nVtx, _WlzHistogramDomain::origin, _WlzBasisFn::param, _WlzBasisFn::poly, _AlgMatrix::rect, _WlzBasisFn::type, _WlzVertexP::v, _WlzBasisFn::vertices, _WlzDVertex2::vtX, _WlzDVertex3::vtX, _WlzDVertex2::vtY, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_FN_BASIS_SCALAR_3DMOS, WLZ_HISTOGRAMDOMAIN_FLOAT, WLZ_VTX_3_LENGTH, WLZ_VTX_3_SUB, WlzBasisFnFree(), WlzBasisFnValueMOSPhi(), WlzBoundingBoxVtx3D(), WlzErrorFromAlg(), WlzMakeHistogramDomain(), WlzValueCopyDVertexToDVertex3(), _WlzDBox2::xMax, _WlzDBox3::xMax, _WlzDBox2::xMin, _WlzDBox3::xMin, _WlzDBox2::yMax, _WlzDBox3::yMax, _WlzDBox2::yMin, _WlzDBox3::yMin, _WlzDBox3::zMax, and _WlzDBox3::zMin.
Referenced by WlzContourFromPoints().