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 "vtkFiltersHybridModule.h" // For export macro
34 #include "vtkWarpTransform.h"
35 
36 class vtkAlgorithmOutput;
37 class vtkGridTransformConnectionHolder;
38 class vtkImageData;
39 
40 #define VTK_GRID_NEAREST VTK_NEAREST_INTERPOLATION
41 #define VTK_GRID_LINEAR VTK_LINEAR_INTERPOLATION
42 #define VTK_GRID_CUBIC VTK_CUBIC_INTERPOLATION
43 
45 {
46 public:
47  static vtkGridTransform *New();
49  virtual void PrintSelf(ostream& os, vtkIndent indent);
50 
52 
57  virtual void SetDisplacementGridConnection(vtkAlgorithmOutput*);
58  virtual void SetDisplacementGridData(vtkImageData*);
59  virtual vtkImageData* GetDisplacementGrid();
61 
63 
65  vtkSetMacro(DisplacementScale,double);
66  vtkGetMacro(DisplacementScale,double);
68 
70 
72  vtkSetMacro(DisplacementShift,double);
73  vtkGetMacro(DisplacementShift,double);
75 
77 
79  void SetInterpolationMode(int mode);
80  vtkGetMacro(InterpolationMode,int);
82  { this->SetInterpolationMode(VTK_NEAREST_INTERPOLATION); };
84  { this->SetInterpolationMode(VTK_LINEAR_INTERPOLATION); };
86  { this->SetInterpolationMode(VTK_CUBIC_INTERPOLATION); };
87  const char *GetInterpolationModeAsString();
89 
92 
94  unsigned long GetMTime();
95 
96 protected:
99 
101  void InternalUpdate();
102 
104  void InternalDeepCopy(vtkAbstractTransform *transform);
105 
107 
108  void ForwardTransformPoint(const float in[3], float out[3]);
109  void ForwardTransformPoint(const double in[3], double out[3]);
111 
112  void ForwardTransformDerivative(const float in[3], float out[3],
113  float derivative[3][3]);
114  void ForwardTransformDerivative(const double in[3], double out[3],
115  double derivative[3][3]);
116 
117  void InverseTransformPoint(const float in[3], float out[3]);
118  void InverseTransformPoint(const double in[3], double out[3]);
119 
120  void InverseTransformDerivative(const float in[3], float out[3],
121  float derivative[3][3]);
122  void InverseTransformDerivative(const double in[3], double out[3],
123  double derivative[3][3]);
124 
125 //BTX
126  void (*InterpolationFunction)(double point[3], double displacement[3],
127  double derivatives[3][3],
128  void *gridPtr, int gridType,
129  int inExt[6], vtkIdType inInc[3]);
130 //ETX
134 
135  void *GridPointer;
137  double GridSpacing[3];
138  double GridOrigin[3];
139  int GridExtent[6];
140  vtkIdType GridIncrements[3];
141 
142 private:
143  vtkGridTransform(const vtkGridTransform&); // Not implemented.
144  void operator=(const vtkGridTransform&); // Not implemented.
145 
146  vtkGridTransformConnectionHolder* ConnectionHolder;
147 };
148 
149 //BTX
150 
151 //----------------------------------------------------------------------------
153 {
154  switch (this->InterpolationMode)
155  {
156  case VTK_GRID_NEAREST:
157  return "NearestNeighbor";
158  case VTK_GRID_LINEAR:
159  return "Linear";
160  case VTK_GRID_CUBIC:
161  return "Cubic";
162  default:
163  return "";
164  }
165 }
166 //ETX
167 
168 #endif
169 
170 
171 
172 
173 
virtual void ForwardTransformPoint(const float in[3], float out[3])=0
virtual void InverseTransformPoint(const float in[3], float out[3])
void PrintSelf(ostream &os, vtkIndent indent)
unsigned long GetMTime()
#define VTK_LINEAR_INTERPOLATION
virtual void InverseTransformDerivative(const float in[3], float out[3], float derivative[3][3])
virtual vtkAbstractTransform * MakeTransform()=0
#define VTK_GRID_LINEAR
int vtkIdType
Definition: vtkType.h:247
#define VTK_CUBIC_INTERPOLATION
Proxy object to connect input/output ports.
void SetInterpolationModeToLinear()
virtual void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3])=0
virtual void InternalDeepCopy(vtkAbstractTransform *)
void SetInterpolationModeToNearestNeighbor()
const char * GetInterpolationModeAsString()
#define VTK_GRID_CUBIC
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKFILTERSHYBRID_EXPORT
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
superclass for all geometric transformations
superclass for nonlinear geometric transformations
#define VTK_GRID_NEAREST
void SetInterpolationModeToCubic()
static vtkObject * New()
#define VTK_NEAREST_INTERPOLATION
a nonlinear warp transformation