VTK
vtkGridTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGridTransform.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef __vtkGridTransform_h
31 #define __vtkGridTransform_h
32 
33 #include "vtkWarpTransform.h"
34 
35 class vtkImageData;
36 
37 #define VTK_GRID_NEAREST 0
38 #define VTK_GRID_LINEAR 1
39 #define VTK_GRID_CUBIC 3
40 
42 {
43 public:
44  static vtkGridTransform *New();
46  virtual void PrintSelf(ostream& os, vtkIndent indent);
47 
49 
52  virtual void SetDisplacementGrid(vtkImageData*);
53  vtkGetObjectMacro(DisplacementGrid,vtkImageData);
55 
57 
59  vtkSetMacro(DisplacementScale,double);
60  vtkGetMacro(DisplacementScale,double);
62 
64 
66  vtkSetMacro(DisplacementShift,double);
67  vtkGetMacro(DisplacementShift,double);
69 
71 
73  void SetInterpolationMode(int mode);
74  vtkGetMacro(InterpolationMode,int);
75  void SetInterpolationModeToNearestNeighbor()
76  { this->SetInterpolationMode(VTK_GRID_NEAREST); };
77  void SetInterpolationModeToLinear()
78  { this->SetInterpolationMode(VTK_GRID_LINEAR); };
79  void SetInterpolationModeToCubic()
80  { this->SetInterpolationMode(VTK_GRID_CUBIC); };
81  const char *GetInterpolationModeAsString();
83 
86 
88  unsigned long GetMTime();
89 
90 protected:
93 
95  void InternalUpdate();
96 
98  void InternalDeepCopy(vtkAbstractTransform *transform);
99 
101 
102  void ForwardTransformPoint(const float in[3], float out[3]);
103  void ForwardTransformPoint(const double in[3], double out[3]);
105 
106  void ForwardTransformDerivative(const float in[3], float out[3],
107  float derivative[3][3]);
108  void ForwardTransformDerivative(const double in[3], double out[3],
109  double derivative[3][3]);
110 
111  void InverseTransformPoint(const float in[3], float out[3]);
112  void InverseTransformPoint(const double in[3], double out[3]);
113 
114  void InverseTransformDerivative(const float in[3], float out[3],
115  float derivative[3][3]);
116  void InverseTransformDerivative(const double in[3], double out[3],
117  double derivative[3][3]);
118 
119 //BTX
120  void (*InterpolationFunction)(double point[3], double displacement[3],
121  double derivatives[3][3],
122  void *gridPtr, int gridType,
123  int inExt[6], vtkIdType inInc[3]);
124 //ETX
129 
130  void *GridPointer;
132  double GridSpacing[3];
133  double GridOrigin[3];
134  int GridExtent[6];
135  vtkIdType GridIncrements[3];
136 
137 private:
138  vtkGridTransform(const vtkGridTransform&); // Not implemented.
139  void operator=(const vtkGridTransform&); // Not implemented.
140 };
141 
142 //BTX
143 
144 //----------------------------------------------------------------------------
146 {
147  switch (this->InterpolationMode)
148  {
149  case VTK_GRID_NEAREST:
150  return "NearestNeighbor";
151  case VTK_GRID_LINEAR:
152  return "Linear";
153  case VTK_GRID_CUBIC:
154  return "Cubic";
155  default:
156  return "";
157  }
158 }
159 //ETX
160 
161 #endif
162 
163 
164 
165 
166