Fits a thin plate spline function to a set of points. Useful for interpolation of scattered points.
This class implements a generalization of the 2D thin plate spline to arbitrary dimensionality. The
constructor builds the thin plate spline function, and the
Evaluate method evaluates this function
at a given point.
Constructors, destructors, assignment and conversion operators
ThinPlateSpline(dip::FloatCoordinateArray coordinate, dip::FloatCoordinateArray const& value, dip::dfloat lambda = 0)
Creates a function that maps
coordinate gives the spatial location of samples, and
value their values. The thin
plate spline function therefore maps
value[ ii ] corresponds to
coordinate[ ii ], both arrays must have the same number of elements.
This function also expects
value to have the same dimensionality. That is,
they both represent spatial coordinates in the same image. Internally, the function maps
value - coordinate,
Evaluate( pt ) adds
pt to the interpolated
pt, and thus it looks externally as if the function maps to
value rather than
value-coordinate. This improves extrapolation.
To use this class for warping, set
coordinate to control points in the fixed image, and
to corresponding points in the floating image. Then, for each point in the fixed image,
Evaluate will return the corresponding coordinates in the floating image, which can be
used to sample it.
lambda is larger than 0, the mapping is not exact, leading to a smoother function.
When applied with a large coordinates array, this constructor can take quite a long time. It is worth while to split up such a problem into blocks.
The first input argument,
coordinate, is taken by value and stored inside the object. Use
std::move to pass this argument if you no longer use it later.