Woolz Image Processing Version 1.4.0
WlzBasisFn.c File Reference

Functions for creating and manipulating basis functions. More...

Functions

WlzErrorNum WlzBasisFnFree (WlzBasisFn *basisFn)
 Free's the given basis function.
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.
WlzDVertex2 WlzBasisFnValueGauss2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D Gaussian basis function.
WlzDVertex2 WlzBasisFnValueMQ2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D multiquadric basis function.
WlzDVertex3 WlzBasisFnValueMQ3D (WlzBasisFn *basisFn, WlzDVertex3 srcVx)
 Calculates the displacement value for the given vertex using a 3D multiquadric basis function.
WlzDVertex2 WlzBasisFnValueIMQ2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D inverse multiquadric basis function.
WlzDVertex3 WlzBasisFnValueIMQ3D (WlzBasisFn *basisFn, WlzDVertex3 srcVx)
 Calculates the displacement value for the given vertex using a 3D inverse multiquadric basis function.
WlzDVertex2 WlzBasisFnValueTPS2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D thin plate spline basis function.
WlzDVertex2 WlzBasisFnValueConf2D (WlzBasisFn *basisFn, WlzDVertex2 srcVx)
 Calculates the value for the given vertex using a 2D conformal polynomial basis function.
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} \]

.

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} \]

.

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} \]

.

WlzBasisFnWlzBasisFnGauss2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr)
 Creates a new Gaussian basis function.
WlzBasisFnWlzBasisFnPoly2DFromCPts (int nPts, int order, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzErrorNum *dstErr)
 Creates a new polynomial basis function.
WlzBasisFnWlzBasisFnConf2DFromCPts (int nPts, int order, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzErrorNum *dstErr)
 Creates a new conformal basis function.
WlzBasisFnWlzBasisFnMQ2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr)
 Creates a new multiquadric basis function.
WlzBasisFnWlzBasisFnMQ3DFromCPts (int nPts, WlzDVertex3 *dPts, WlzDVertex3 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh3D *mesh, WlzErrorNum *dstErr)
 Creates a new multiquadric basis function.
WlzBasisFnWlzBasisFnIMQ2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr)
 Creates a new inverse-multiquadric basis function.
WlzBasisFnWlzBasisFnIMQ3DFromCPts (int nPts, WlzDVertex3 *dPts, WlzDVertex3 *sPts, double delta, WlzBasisFn *prvBasisFn, WlzCMesh3D *mesh, WlzErrorNum *dstErr)
 Creates a new inverse-multiquadric basis function.
WlzBasisFnWlzBasisFnTPS2DFromCPts (int nPts, WlzDVertex2 *dPts, WlzDVertex2 *sPts, WlzBasisFn *prvBasisFn, WlzCMesh2D *mesh, WlzErrorNum *dstErr)
 Creates a new thin plate spline basis function.
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$.

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$.

Detailed Description

Functions for creating and manipulating basis functions.

Author:
Bill Hill, Jianguo Rao
Date:
January 2003
Version:
Id:
ffac3111403930a3f9f434c34be31c0c1e81a33e
Address: MRC Human Genetics Unit, MRC Institute of Genetics and Molecular Medicine, University of Edinburgh, Western General Hospital, Edinburgh, EH4 2XU, UK.
Copyright (C), [2012], The University Court of the University of Edinburgh, Old College, Edinburgh, UK.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.