Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkGridTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkGridTransform.h,v $
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 =========================================================================*/
00041 #ifndef __vtkGridTransform_h
00042 #define __vtkGridTransform_h
00043 
00044 #include "vtkWarpTransform.h"
00045 
00046 class vtkImageData;
00047 
00048 #define VTK_GRID_NEAREST 0
00049 #define VTK_GRID_LINEAR 1
00050 #define VTK_GRID_CUBIC 3
00051 
00052 class VTK_HYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
00053 {
00054 public:
00055   static vtkGridTransform *New();
00056   vtkTypeRevisionMacro(vtkGridTransform,vtkWarpTransform);
00057   virtual void PrintSelf(ostream& os, vtkIndent indent);
00058 
00060 
00063   virtual void SetDisplacementGrid(vtkImageData*);
00064   vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00066 
00068 
00070   vtkSetMacro(DisplacementScale,double);
00071   vtkGetMacro(DisplacementScale,double);
00073 
00075 
00077   vtkSetMacro(DisplacementShift,double);
00078   vtkGetMacro(DisplacementShift,double);
00080 
00082 
00084   void SetInterpolationMode(int mode);
00085   vtkGetMacro(InterpolationMode,int);
00086   void SetInterpolationModeToNearestNeighbor()
00087     { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00088   void SetInterpolationModeToLinear()
00089     { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00090   void SetInterpolationModeToCubic()
00091     { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00092   const char *GetInterpolationModeAsString();
00094 
00096   vtkAbstractTransform *MakeTransform();
00097 
00099   unsigned long GetMTime();
00100 
00101 protected:
00102   vtkGridTransform();
00103   ~vtkGridTransform();
00104 
00106   void InternalUpdate();
00107 
00109   void InternalDeepCopy(vtkAbstractTransform *transform);
00110 
00112 
00113   void ForwardTransformPoint(const float in[3], float out[3]);
00114   void ForwardTransformPoint(const double in[3], double out[3]);
00116 
00117   void ForwardTransformDerivative(const float in[3], float out[3],
00118                                   float derivative[3][3]);
00119   void ForwardTransformDerivative(const double in[3], double out[3],
00120                                   double derivative[3][3]);
00121 
00122   void InverseTransformPoint(const float in[3], float out[3]);
00123   void InverseTransformPoint(const double in[3], double out[3]);
00124 
00125   void InverseTransformDerivative(const float in[3], float out[3],
00126                                   float derivative[3][3]);
00127   void InverseTransformDerivative(const double in[3], double out[3],
00128                                   double derivative[3][3]);
00129 
00130 //BTX
00131   void (*InterpolationFunction)(double point[3], double displacement[3],
00132                                 double derivatives[3][3],
00133                                 void *gridPtr, int gridType,
00134                                 int inExt[6], int inInc[3]);
00135 //ETX
00136   int InterpolationMode;
00137   vtkImageData *DisplacementGrid;
00138   double DisplacementScale;
00139   double DisplacementShift;
00140   
00141   void *GridPointer;
00142   int GridScalarType;
00143   double GridSpacing[3];
00144   double GridOrigin[3];
00145   int GridExtent[6];
00146   int GridIncrements[3];
00147 
00148 private:
00149   vtkGridTransform(const vtkGridTransform&);  // Not implemented.
00150   void operator=(const vtkGridTransform&);  // Not implemented.
00151 };
00152 
00153 //BTX
00154 
00155 //----------------------------------------------------------------------------
00156 inline const char *vtkGridTransform::GetInterpolationModeAsString()
00157 {
00158   switch (this->InterpolationMode)
00159     {
00160     case VTK_GRID_NEAREST:
00161       return "NearestNeighbor";
00162     case VTK_GRID_LINEAR:
00163       return "Linear";
00164     case VTK_GRID_CUBIC:
00165       return "Cubic";
00166     default:
00167       return "";
00168     }
00169 }  
00170 //ETX
00171 
00172 #endif
00173 
00174 
00175 
00176 
00177