Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Hybrid/vtkGridTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkGridTransform.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00044 #ifndef __vtkGridTransform_h
00045 #define __vtkGridTransform_h
00046 
00047 #include "vtkWarpTransform.h"
00048 
00049 class vtkImageData;
00050 
00051 #define VTK_GRID_NEAREST 0
00052 #define VTK_GRID_LINEAR 1
00053 #define VTK_GRID_CUBIC 3
00054 
00055 class VTK_HYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
00056 {
00057 public:
00058   static vtkGridTransform *New();
00059   vtkTypeRevisionMacro(vtkGridTransform,vtkWarpTransform);
00060   virtual void PrintSelf(ostream& os, vtkIndent indent);
00061 
00063 
00066   virtual void SetDisplacementGrid(vtkImageData*);
00067   vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00069 
00071 
00073   vtkSetMacro(DisplacementScale,float);
00074   vtkGetMacro(DisplacementScale,float);
00076 
00078 
00080   vtkSetMacro(DisplacementShift,float);
00081   vtkGetMacro(DisplacementShift,float);
00083 
00085 
00087   void SetInterpolationMode(int mode);
00088   vtkGetMacro(InterpolationMode,int);
00089   void SetInterpolationModeToNearestNeighbor()
00090     { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00091   void SetInterpolationModeToLinear()
00092     { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00093   void SetInterpolationModeToCubic()
00094     { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00095   const char *GetInterpolationModeAsString();
00097 
00099   vtkAbstractTransform *MakeTransform();
00100 
00102   unsigned long GetMTime();
00103 
00104 protected:
00105   vtkGridTransform();
00106   ~vtkGridTransform();
00107 
00109   void InternalUpdate();
00110 
00112   void InternalDeepCopy(vtkAbstractTransform *transform);
00113 
00115 
00116   void ForwardTransformPoint(const float in[3], float out[3]);
00117   void ForwardTransformPoint(const double in[3], double out[3]);
00119 
00120   void ForwardTransformDerivative(const float in[3], float out[3],
00121                                   float derivative[3][3]);
00122   void ForwardTransformDerivative(const double in[3], double out[3],
00123                                   double derivative[3][3]);
00124 
00125   void InverseTransformPoint(const float in[3], float out[3]);
00126   void InverseTransformPoint(const double in[3], double out[3]);
00127 
00128   void InverseTransformDerivative(const float in[3], float out[3],
00129                                   float derivative[3][3]);
00130   void InverseTransformDerivative(const double in[3], double out[3],
00131                                   double derivative[3][3]);
00132 
00133 //BTX
00134   void (*InterpolationFunction)(float point[3], float displacement[3],
00135                                 float derivatives[3][3],
00136                                 void *gridPtr, int gridType,
00137                                 int inExt[6], int inInc[3]);
00138 //ETX
00139   int InterpolationMode;
00140   vtkImageData *DisplacementGrid;
00141   float DisplacementScale;
00142   float DisplacementShift;
00143 private:
00144   vtkGridTransform(const vtkGridTransform&);  // Not implemented.
00145   void operator=(const vtkGridTransform&);  // Not implemented.
00146 };
00147 
00148 //BTX
00149 
00150 //----------------------------------------------------------------------------
00151 inline const char *vtkGridTransform::GetInterpolationModeAsString()
00152 {
00153   switch (this->InterpolationMode)
00154     {
00155     case VTK_GRID_NEAREST:
00156       return "NearestNeighbor";
00157     case VTK_GRID_LINEAR:
00158       return "Linear";
00159     case VTK_GRID_CUBIC:
00160       return "Cubic";
00161     default:
00162       return "";
00163     }
00164 }  
00165 //ETX
00166 
00167 #endif
00168 
00169 
00170 
00171 
00172