Woolz Image Processing Version 1.4.0
WlzKrig.c File Reference

Functions for interpolation based on kriging. More...

Functions

void WlzKrigSetModelFn (WlzKrigModelFn *fn, WlzKrigModelFnType type, double c0, double c1, double a)
 Sets a kriging function data stuctures parameters and function pointer. See the kriging model function types and their implementation for the meaning of the parameters.

Detailed Description

Functions for interpolation based on kriging.

Author:
Bill Hill
Date:
October 2012
Version:
Id:
29ed6a67d2e5182a267a071ae86b0d5ba852c0c6
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. Kriging is an interpolation method from geo-statistics (hence some terms such as nugget), which aims to find the Best Linear Unbiased Estimate (BLUE) of a value at some point in space based on the semi-variograms of the values within some local region. The procedure is first to choose a model for the semi-variogram behavior which when plotted against the lag (distance) is assumed to have a nugget (constant or intercept variance), sill (variance at an infinite lag) and range (lag for which values have little correlation). This should be set using WlzKrigSetModelFn(). The model semi-variogram should then be computed using WlzKrigOSetModelSV2D() and then for each position to be interpolated with this model (ie all positions where the model is valid) WlzKrigOSetPosSV2D() should be called followed by WlzKrigOWeightsSolve().

For a simple system in which there are $N$ known values $\{v_i\}$ at positions $\{p_i\}$ ( $i \in [1-N]$) then we want to estimate a system of weights $\{w_i\}$ such that the value $v_x$ at some position $p_x$ can be computed by a simple linear system of weights

\[ v_x = \sum_i w_i v_i \]

with the weights computed such that $ \sum_i w_i = 1$. Setting $h_{ij} = \|p_i - p_j\|$ and having choosen a variance model $\gamma$ then

\[ \mathbf{M} \mathbf{w} = \mathbf{p} \]

where $\mathbf{M} = \gamma(h_{ij})$, $\mathbf{w} = w_j$ and $\mathbf{p} = h_{i}$. In practice a slack variable $\lambda$ is added to the weights column vector and both the model matrix and position vector are padded using to 1. This equation is then solved for the weights.