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 =========================================================================*/
00034 #ifndef __vtkGridTransform_h
00035 #define __vtkGridTransform_h
00036 
00037 #include "vtkWarpTransform.h"
00038 
00039 class vtkImageData;
00040 
00041 #define VTK_GRID_NEAREST 0
00042 #define VTK_GRID_LINEAR 1
00043 #define VTK_GRID_CUBIC 3
00044 
00045 class VTK_HYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
00046 {
00047 public:
00048   static vtkGridTransform *New();
00049   vtkTypeRevisionMacro(vtkGridTransform,vtkWarpTransform);
00050   virtual void PrintSelf(ostream& os, vtkIndent indent);
00051 
00053 
00056   virtual void SetDisplacementGrid(vtkImageData*);
00057   vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00059 
00061 
00063   vtkSetMacro(DisplacementScale,float);
00064   vtkGetMacro(DisplacementScale,float);
00066 
00068 
00070   vtkSetMacro(DisplacementShift,float);
00071   vtkGetMacro(DisplacementShift,float);
00073 
00075 
00077   void SetInterpolationMode(int mode);
00078   vtkGetMacro(InterpolationMode,int);
00079   void SetInterpolationModeToNearestNeighbor()
00080     { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00081   void SetInterpolationModeToLinear()
00082     { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00083   void SetInterpolationModeToCubic()
00084     { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00085   const char *GetInterpolationModeAsString();
00087 
00089   vtkAbstractTransform *MakeTransform();
00090 
00092   unsigned long GetMTime();
00093 
00094 protected:
00095   vtkGridTransform();
00096   ~vtkGridTransform();
00097 
00099   void InternalUpdate();
00100 
00102   void InternalDeepCopy(vtkAbstractTransform *transform);
00103 
00105 
00106   void ForwardTransformPoint(const float in[3], float out[3]);
00107   void ForwardTransformPoint(const double in[3], double out[3]);
00109 
00110   void ForwardTransformDerivative(const float in[3], float out[3],
00111                                   float derivative[3][3]);
00112   void ForwardTransformDerivative(const double in[3], double out[3],
00113                                   double derivative[3][3]);
00114 
00115   void InverseTransformPoint(const float in[3], float out[3]);
00116   void InverseTransformPoint(const double in[3], double out[3]);
00117 
00118   void InverseTransformDerivative(const float in[3], float out[3],
00119                                   float derivative[3][3]);
00120   void InverseTransformDerivative(const double in[3], double out[3],
00121                                   double derivative[3][3]);
00122 
00123 //BTX
00124   void (*InterpolationFunction)(float point[3], float displacement[3],
00125                                 float derivatives[3][3],
00126                                 void *gridPtr, int gridType,
00127                                 int inExt[6], int inInc[3]);
00128 //ETX
00129   int InterpolationMode;
00130   vtkImageData *DisplacementGrid;
00131   float DisplacementScale;
00132   float DisplacementShift;
00133 private:
00134   vtkGridTransform(const vtkGridTransform&);  // Not implemented.
00135   void operator=(const vtkGridTransform&);  // Not implemented.
00136 };
00137 
00138 //BTX
00139 
00140 //----------------------------------------------------------------------------
00141 inline const char *vtkGridTransform::GetInterpolationModeAsString()
00142 {
00143   switch (this->InterpolationMode)
00144     {
00145     case VTK_GRID_NEAREST:
00146       return "NearestNeighbor";
00147     case VTK_GRID_LINEAR:
00148       return "Linear";
00149     case VTK_GRID_CUBIC:
00150       return "Cubic";
00151     default:
00152       return "";
00153     }
00154 }  
00155 //ETX
00156 
00157 #endif
00158 
00159 
00160 
00161 
00162