00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00030 #ifndef __vtkGridTransform_h
00031 #define __vtkGridTransform_h
00032
00033 #include "vtkWarpTransform.h"
00034
00035 class vtkImageData;
00036
00037 #define VTK_GRID_NEAREST 0
00038 #define VTK_GRID_LINEAR 1
00039 #define VTK_GRID_CUBIC 3
00040
00041 class VTK_HYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
00042 {
00043 public:
00044 static vtkGridTransform *New();
00045 vtkTypeRevisionMacro(vtkGridTransform,vtkWarpTransform);
00046 virtual void PrintSelf(ostream& os, vtkIndent indent);
00047
00049
00052 virtual void SetDisplacementGrid(vtkImageData*);
00053 vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00055
00057
00059 vtkSetMacro(DisplacementScale,double);
00060 vtkGetMacro(DisplacementScale,double);
00062
00064
00066 vtkSetMacro(DisplacementShift,double);
00067 vtkGetMacro(DisplacementShift,double);
00069
00071
00073 void SetInterpolationMode(int mode);
00074 vtkGetMacro(InterpolationMode,int);
00075 void SetInterpolationModeToNearestNeighbor()
00076 { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00077 void SetInterpolationModeToLinear()
00078 { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00079 void SetInterpolationModeToCubic()
00080 { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00081 const char *GetInterpolationModeAsString();
00083
00085 vtkAbstractTransform *MakeTransform();
00086
00088 unsigned long GetMTime();
00089
00090 protected:
00091 vtkGridTransform();
00092 ~vtkGridTransform();
00093
00095 void InternalUpdate();
00096
00098 void InternalDeepCopy(vtkAbstractTransform *transform);
00099
00101
00102 void ForwardTransformPoint(const float in[3], float out[3]);
00103 void ForwardTransformPoint(const double in[3], double out[3]);
00105
00106 void ForwardTransformDerivative(const float in[3], float out[3],
00107 float derivative[3][3]);
00108 void ForwardTransformDerivative(const double in[3], double out[3],
00109 double derivative[3][3]);
00110
00111 void InverseTransformPoint(const float in[3], float out[3]);
00112 void InverseTransformPoint(const double in[3], double out[3]);
00113
00114 void InverseTransformDerivative(const float in[3], float out[3],
00115 float derivative[3][3]);
00116 void InverseTransformDerivative(const double in[3], double out[3],
00117 double derivative[3][3]);
00118
00119
00120 void (*InterpolationFunction)(double point[3], double displacement[3],
00121 double derivatives[3][3],
00122 void *gridPtr, int gridType,
00123 int inExt[6], vtkIdType inInc[3]);
00124
00125 int InterpolationMode;
00126 vtkImageData *DisplacementGrid;
00127 double DisplacementScale;
00128 double DisplacementShift;
00129
00130 void *GridPointer;
00131 int GridScalarType;
00132 double GridSpacing[3];
00133 double GridOrigin[3];
00134 int GridExtent[6];
00135 vtkIdType GridIncrements[3];
00136
00137 private:
00138 vtkGridTransform(const vtkGridTransform&);
00139 void operator=(const vtkGridTransform&);
00140 };
00141
00142
00143
00144
00145 inline const char *vtkGridTransform::GetInterpolationModeAsString()
00146 {
00147 switch (this->InterpolationMode)
00148 {
00149 case VTK_GRID_NEAREST:
00150 return "NearestNeighbor";
00151 case VTK_GRID_LINEAR:
00152 return "Linear";
00153 case VTK_GRID_CUBIC:
00154 return "Cubic";
00155 default:
00156 return "";
00157 }
00158 }
00159
00160
00161 #endif
00162
00163
00164
00165
00166