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
00057 #ifndef __vtkGridTransform_h
00058 #define __vtkGridTransform_h
00059
00060 #include "vtkWarpTransform.h"
00061 #include "vtkImageData.h"
00062
00063 #define VTK_GRID_NEAREST 0
00064 #define VTK_GRID_LINEAR 1
00065 #define VTK_GRID_CUBIC 3
00066
00067 class VTK_HYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
00068 {
00069 public:
00070 static vtkGridTransform *New();
00071 vtkTypeMacro(vtkGridTransform,vtkWarpTransform);
00072 virtual void PrintSelf(ostream& os, vtkIndent indent);
00073
00075
00078 vtkSetObjectMacro(DisplacementGrid,vtkImageData);
00079 vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00081
00083
00085 vtkSetMacro(DisplacementScale,float);
00086 vtkGetMacro(DisplacementScale,float);
00088
00090
00092 vtkSetMacro(DisplacementShift,float);
00093 vtkGetMacro(DisplacementShift,float);
00095
00097
00099 void SetInterpolationMode(int mode);
00100 vtkGetMacro(InterpolationMode,int);
00101 void SetInterpolationModeToNearestNeighbor()
00102 { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00103 void SetInterpolationModeToLinear()
00104 { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00105 void SetInterpolationModeToCubic()
00106 { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00107 const char *GetInterpolationModeAsString();
00109
00111 vtkAbstractTransform *MakeTransform();
00112
00114 unsigned long GetMTime();
00115
00116 protected:
00117 vtkGridTransform();
00118 ~vtkGridTransform();
00119
00121 void InternalUpdate();
00122
00124 void InternalDeepCopy(vtkAbstractTransform *transform);
00125
00127
00128 void ForwardTransformPoint(const float in[3], float out[3]);
00129 void ForwardTransformPoint(const double in[3], double out[3]);
00131
00132 void ForwardTransformDerivative(const float in[3], float out[3],
00133 float derivative[3][3]);
00134 void ForwardTransformDerivative(const double in[3], double out[3],
00135 double derivative[3][3]);
00136
00137 void InverseTransformPoint(const float in[3], float out[3]);
00138 void InverseTransformPoint(const double in[3], double out[3]);
00139
00140 void InverseTransformDerivative(const float in[3], float out[3],
00141 float derivative[3][3]);
00142 void InverseTransformDerivative(const double in[3], double out[3],
00143 double derivative[3][3]);
00144
00145
00146 void (*InterpolationFunction)(float point[3], float displacement[3],
00147 float derivatives[3][3],
00148 void *gridPtr, int gridType,
00149 int inExt[6], int inInc[3]);
00150
00151 int InterpolationMode;
00152 vtkImageData *DisplacementGrid;
00153 float DisplacementScale;
00154 float DisplacementShift;
00155 private:
00156 vtkGridTransform(const vtkGridTransform&);
00157 void operator=(const vtkGridTransform&);
00158 };
00159
00160
00161
00162
00163 inline const char *vtkGridTransform::GetInterpolationModeAsString()
00164 {
00165 switch (this->InterpolationMode)
00166 {
00167 case VTK_GRID_NEAREST:
00168 return "NearestNeighbor";
00169 case VTK_GRID_LINEAR:
00170 return "Linear";
00171 case VTK_GRID_CUBIC:
00172 return "Cubic";
00173 default:
00174 return "";
00175 }
00176 }
00177
00178
00179 #endif
00180
00181
00182
00183
00184