VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Filters/Hybrid/vtkGridTransform.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkGridTransform.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00030 #ifndef vtkGridTransform_h
00031 #define vtkGridTransform_h
00032 
00033 #include "vtkFiltersHybridModule.h" // For export macro
00034 #include "vtkWarpTransform.h"
00035 
00036 class vtkAlgorithmOutput;
00037 class vtkGridTransformConnectionHolder;
00038 class vtkImageData;
00039 
00040 #define VTK_GRID_NEAREST VTK_NEAREST_INTERPOLATION
00041 #define VTK_GRID_LINEAR VTK_LINEAR_INTERPOLATION
00042 #define VTK_GRID_CUBIC VTK_CUBIC_INTERPOLATION
00043 
00044 class VTKFILTERSHYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
00045 {
00046 public:
00047   static vtkGridTransform *New();
00048   vtkTypeMacro(vtkGridTransform,vtkWarpTransform);
00049   virtual void PrintSelf(ostream& os, vtkIndent indent);
00050 
00052 
00057   virtual void SetDisplacementGridConnection(vtkAlgorithmOutput*);
00058   virtual void SetDisplacementGridData(vtkImageData*);
00059   virtual vtkImageData* GetDisplacementGrid();
00061 
00063 
00065   vtkSetMacro(DisplacementScale,double);
00066   vtkGetMacro(DisplacementScale,double);
00068 
00070 
00072   vtkSetMacro(DisplacementShift,double);
00073   vtkGetMacro(DisplacementShift,double);
00075 
00077 
00079   void SetInterpolationMode(int mode);
00080   vtkGetMacro(InterpolationMode,int);
00081   void SetInterpolationModeToNearestNeighbor()
00082     { this->SetInterpolationMode(VTK_NEAREST_INTERPOLATION); };
00083   void SetInterpolationModeToLinear()
00084     { this->SetInterpolationMode(VTK_LINEAR_INTERPOLATION); };
00085   void SetInterpolationModeToCubic()
00086     { this->SetInterpolationMode(VTK_CUBIC_INTERPOLATION); };
00087   const char *GetInterpolationModeAsString();
00089 
00091   vtkAbstractTransform *MakeTransform();
00092 
00094   unsigned long GetMTime();
00095 
00096 protected:
00097   vtkGridTransform();
00098   ~vtkGridTransform();
00099 
00101   void InternalUpdate();
00102 
00104   void InternalDeepCopy(vtkAbstractTransform *transform);
00105 
00107 
00108   void ForwardTransformPoint(const float in[3], float out[3]);
00109   void ForwardTransformPoint(const double in[3], double out[3]);
00111 
00112   void ForwardTransformDerivative(const float in[3], float out[3],
00113                                   float derivative[3][3]);
00114   void ForwardTransformDerivative(const double in[3], double out[3],
00115                                   double derivative[3][3]);
00116 
00117   void InverseTransformPoint(const float in[3], float out[3]);
00118   void InverseTransformPoint(const double in[3], double out[3]);
00119 
00120   void InverseTransformDerivative(const float in[3], float out[3],
00121                                   float derivative[3][3]);
00122   void InverseTransformDerivative(const double in[3], double out[3],
00123                                   double derivative[3][3]);
00124 
00125 //BTX
00126   void (*InterpolationFunction)(double point[3], double displacement[3],
00127                                 double derivatives[3][3],
00128                                 void *gridPtr, int gridType,
00129                                 int inExt[6], vtkIdType inInc[3]);
00130 //ETX
00131   int InterpolationMode;
00132   double DisplacementScale;
00133   double DisplacementShift;
00134 
00135   void *GridPointer;
00136   int GridScalarType;
00137   double GridSpacing[3];
00138   double GridOrigin[3];
00139   int GridExtent[6];
00140   vtkIdType GridIncrements[3];
00141 
00142 private:
00143   vtkGridTransform(const vtkGridTransform&);  // Not implemented.
00144   void operator=(const vtkGridTransform&);  // Not implemented.
00145 
00146   vtkGridTransformConnectionHolder* ConnectionHolder;
00147 };
00148 
00149 //BTX
00150 
00151 //----------------------------------------------------------------------------
00152 inline const char *vtkGridTransform::GetInterpolationModeAsString()
00153 {
00154   switch (this->InterpolationMode)
00155     {
00156     case VTK_GRID_NEAREST:
00157       return "NearestNeighbor";
00158     case VTK_GRID_LINEAR:
00159       return "Linear";
00160     case VTK_GRID_CUBIC:
00161       return "Cubic";
00162     default:
00163       return "";
00164     }
00165 }
00166 //ETX
00167 
00168 #endif
00169 
00170 
00171 
00172 
00173