/usr/include/vtk-6.2/vtkThinPlateSplineTransform.h is in libvtk6-dev 6.2.0+dfsg1-10build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkThinPlateSplineTransform.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkThinPlateSplineTransform - a nonlinear warp transformation
// .SECTION Description
// vtkThinPlateSplineTransform describes a nonlinear warp transform defined
// by a set of source and target landmarks. Any point on the mesh close to a
// source landmark will be moved to a place close to the corresponding target
// landmark. The points in between are interpolated smoothly using
// Bookstein's Thin Plate Spline algorithm.
//
// To obtain a correct TPS warp, use the R2LogR kernel if your data is 2D, and
// the R kernel if your data is 3D. Or you can specify your own RBF. (Hence this
// class is more general than a pure TPS transform.)
// .SECTION Caveats
// 1) The inverse transform is calculated using an iterative method,
// and is several times more expensive than the forward transform.
// 2) Whenever you add, subtract, or set points you must call Modified()
// on the vtkPoints object, or the transformation might not update.
// 3) Collinear point configurations (except those that lie in the XY plane)
// result in an unstable transformation.
// .SECTION see also
// vtkGridTransform vtkGeneralTransform
#ifndef vtkThinPlateSplineTransform_h
#define vtkThinPlateSplineTransform_h
#include "vtkCommonTransformsModule.h" // For export macro
#include "vtkWarpTransform.h"
#define VTK_RBF_CUSTOM 0
#define VTK_RBF_R 1
#define VTK_RBF_R2LOGR 2
class VTKCOMMONTRANSFORMS_EXPORT vtkThinPlateSplineTransform : public vtkWarpTransform
{
public:
vtkTypeMacro(vtkThinPlateSplineTransform,vtkWarpTransform);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkThinPlateSplineTransform *New();
// Description:
// Specify the 'stiffness' of the spline. The default is 1.0.
vtkGetMacro(Sigma,double);
vtkSetMacro(Sigma,double);
// Description:
// Specify the radial basis function to use. The default is
// R2LogR which is appropriate for 2D. Use |R| (SetBasisToR)
// if your data is 3D. Alternatively specify your own basis function,
// however this will mean that the transform will no longer be a true
// thin-plate spline.
void SetBasis(int basis);
vtkGetMacro(Basis,int);
void SetBasisToR() { this->SetBasis(VTK_RBF_R); };
void SetBasisToR2LogR() { this->SetBasis(VTK_RBF_R2LOGR); };
const char *GetBasisAsString();
//BTX
// Description:
// Set the radial basis function to a custom function. You must
// supply both the function and its derivative with respect to r.
void SetBasisFunction(double (*U)(double r)) {
if (this->BasisFunction == U) { return; }
this->SetBasis(VTK_RBF_CUSTOM);
this->BasisFunction = U;
this->Modified(); };
void SetBasisDerivative(double (*dUdr)(double r, double &dU)) {
this->BasisDerivative = dUdr;
this->Modified(); };
//ETX
// Description:
// Set the source landmarks for the warp. If you add or change the
// vtkPoints object, you must call Modified() on it or the transformation
// might not update.
void SetSourceLandmarks(vtkPoints *source);
vtkGetObjectMacro(SourceLandmarks,vtkPoints);
// Description:
// Set the target landmarks for the warp. If you add or change the
// vtkPoints object, you must call Modified() on it or the transformation
// might not update.
void SetTargetLandmarks(vtkPoints *target);
vtkGetObjectMacro(TargetLandmarks,vtkPoints);
// Description:
// Get the MTime.
unsigned long GetMTime();
// Description:
// Make another transform of the same type.
vtkAbstractTransform *MakeTransform();
protected:
vtkThinPlateSplineTransform();
~vtkThinPlateSplineTransform();
// Description:
// Prepare the transformation for application.
void InternalUpdate();
// Description:
// This method does no type checking, use DeepCopy instead.
void InternalDeepCopy(vtkAbstractTransform *transform);
void ForwardTransformPoint(const float in[3], float out[3]);
void ForwardTransformPoint(const double in[3], double out[3]);
void ForwardTransformDerivative(const float in[3], float out[3],
float derivative[3][3]);
void ForwardTransformDerivative(const double in[3], double out[3],
double derivative[3][3]);
double Sigma;
vtkPoints *SourceLandmarks;
vtkPoints *TargetLandmarks;
//BTX
// the radial basis function to use
double (*BasisFunction)(double r);
double (*BasisDerivative)(double r, double& dUdr);
//ETX
int Basis;
int NumberOfPoints;
double **MatrixW;
private:
vtkThinPlateSplineTransform(const vtkThinPlateSplineTransform&); // Not implemented.
void operator=(const vtkThinPlateSplineTransform&); // Not implemented.
};
#endif
|