Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 =========================================================================*/
00045 #ifndef __vtkGridTransform_h
00046 #define __vtkGridTransform_h
00047 
00048 #include "vtkWarpTransform.h"
00049 
00050 class vtkImageData;
00051 
00052 #define VTK_GRID_NEAREST 0
00053 #define VTK_GRID_LINEAR 1
00054 #define VTK_GRID_CUBIC 3
00055 
00056 class VTK_HYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
00057 {
00058 public:
00059   static vtkGridTransform *New();
00060   vtkTypeRevisionMacro(vtkGridTransform,vtkWarpTransform);
00061   virtual void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064 
00067   virtual void SetDisplacementGrid(vtkImageData*);
00068   vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00070 
00072 
00074   vtkSetMacro(DisplacementScale,float);
00075   vtkGetMacro(DisplacementScale,float);
00077 
00079 
00081   vtkSetMacro(DisplacementShift,float);
00082   vtkGetMacro(DisplacementShift,float);
00084 
00086 
00088   void SetInterpolationMode(int mode);
00089   vtkGetMacro(InterpolationMode,int);
00090   void SetInterpolationModeToNearestNeighbor()
00091     { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00092   void SetInterpolationModeToLinear()
00093     { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00094   void SetInterpolationModeToCubic()
00095     { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00096   const char *GetInterpolationModeAsString();
00098 
00100   vtkAbstractTransform *MakeTransform();
00101 
00103   unsigned long GetMTime();
00104 
00105 protected:
00106   vtkGridTransform();
00107   ~vtkGridTransform();
00108 
00110   void InternalUpdate();
00111 
00113   void InternalDeepCopy(vtkAbstractTransform *transform);
00114 
00116 
00117   void ForwardTransformPoint(const float in[3], float out[3]);
00118   void ForwardTransformPoint(const double in[3], double out[3]);
00120 
00121   void ForwardTransformDerivative(const float in[3], float out[3],
00122                                   float derivative[3][3]);
00123   void ForwardTransformDerivative(const double in[3], double out[3],
00124                                   double derivative[3][3]);
00125 
00126   void InverseTransformPoint(const float in[3], float out[3]);
00127   void InverseTransformPoint(const double in[3], double out[3]);
00128 
00129   void InverseTransformDerivative(const float in[3], float out[3],
00130                                   float derivative[3][3]);
00131   void InverseTransformDerivative(const double in[3], double out[3],
00132                                   double derivative[3][3]);
00133 
00134 //BTX
00135   void (*InterpolationFunction)(float point[3], float displacement[3],
00136                                 float derivatives[3][3],
00137                                 void *gridPtr, int gridType,
00138                                 int inExt[6], int inInc[3]);
00139 //ETX
00140   int InterpolationMode;
00141   vtkImageData *DisplacementGrid;
00142   float DisplacementScale;
00143   float DisplacementShift;
00144 private:
00145   vtkGridTransform(const vtkGridTransform&);  // Not implemented.
00146   void operator=(const vtkGridTransform&);  // Not implemented.
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