00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00056 #ifndef __vtkGridTransform_h
00057 #define __vtkGridTransform_h
00058
00059 #include "vtkWarpTransform.h"
00060 #include "vtkImageData.h"
00061
00062 #define VTK_GRID_NEAREST 0
00063 #define VTK_GRID_LINEAR 1
00064 #define VTK_GRID_CUBIC 3
00065
00066 class VTK_EXPORT vtkGridTransform : public vtkWarpTransform
00067 {
00068 public:
00069 static vtkGridTransform *New();
00070 vtkTypeMacro(vtkGridTransform,vtkWarpTransform);
00071 virtual void PrintSelf(ostream& os, vtkIndent indent);
00072
00076 vtkSetObjectMacro(DisplacementGrid,vtkImageData);
00077 vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00078
00081 vtkSetMacro(DisplacementScale,float);
00082 vtkGetMacro(DisplacementScale,float);
00083
00086 vtkSetMacro(DisplacementShift,float);
00087 vtkGetMacro(DisplacementShift,float);
00088
00091 void SetInterpolationMode(int mode);
00092 vtkGetMacro(InterpolationMode,int);
00093 void SetInterpolationModeToNearestNeighbor()
00094 { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00095 void SetInterpolationModeToLinear()
00096 { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00097 void SetInterpolationModeToCubic()
00098 { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00099 const char *GetInterpolationModeAsString();
00100
00102 vtkAbstractTransform *MakeTransform();
00103
00105 unsigned long GetMTime();
00106
00107 protected:
00108 vtkGridTransform();
00109 ~vtkGridTransform();
00110 vtkGridTransform(const vtkGridTransform&) {};
00111 void operator=(const vtkGridTransform&) {};
00112
00114 void InternalUpdate();
00115
00117 void InternalDeepCopy(vtkAbstractTransform *transform);
00118
00120 void ForwardTransformPoint(const float in[3], float out[3]);
00121 void ForwardTransformPoint(const double in[3], double out[3]);
00122
00123 void ForwardTransformDerivative(const float in[3], float out[3],
00124 float derivative[3][3]);
00125 void ForwardTransformDerivative(const double in[3], double out[3],
00126 double derivative[3][3]);
00127
00128 void InverseTransformPoint(const float in[3], float out[3]);
00129 void InverseTransformPoint(const double in[3], double out[3]);
00130
00131 void InverseTransformDerivative(const float in[3], float out[3],
00132 float derivative[3][3]);
00133 void InverseTransformDerivative(const double in[3], double out[3],
00134 double derivative[3][3]);
00135
00136
00137 void (*InterpolationFunction)(float point[3], float displacement[3],
00138 float derivatives[3][3],
00139 void *gridPtr, int gridType,
00140 int inExt[6], int inInc[3]);
00141
00142 int InterpolationMode;
00143 vtkImageData *DisplacementGrid;
00144 float DisplacementScale;
00145 float DisplacementShift;
00146 };
00147
00148
00149
00150
00151 inline const char *vtkGridTransform::GetInterpolationModeAsString()
00152 {
00153 switch (this->InterpolationMode)
00154 {
00155 case VTK_GRID_NEAREST:
00156 return "NearestNeighbor";
00157 case VTK_GRID_LINEAR:
00158 return "Linear";
00159 case VTK_GRID_CUBIC:
00160 return "Cubic";
00161 default:
00162 return "";
00163 }
00164 }
00165
00166
00167 #endif
00168
00169
00170
00171
00172