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

contrib/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-2001 Ken Martin, Will Schroeder, Bill Lorensen.
00008 
00009 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
00010 The following terms apply to all files associated with the software unless
00011 explicitly disclaimed in individual files. This copyright specifically does
00012 not apply to the related textbook "The Visualization Toolkit" ISBN
00013 013199837-4 published by Prentice Hall which is covered by its own copyright.
00014 
00015 The authors hereby grant permission to use, copy, and distribute this
00016 software and its documentation for any purpose, provided that existing
00017 copyright notices are retained in all copies and that this notice is included
00018 verbatim in any distributions. Additionally, the authors grant permission to
00019 modify this software and its documentation for any purpose, provided that
00020 such modifications are not distributed without the explicit consent of the
00021 authors and that existing copyright notices are retained in all copies. Some
00022 of the algorithms implemented by this software are patented, observe all
00023 applicable patent law.
00024 
00025 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
00026 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
00027 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
00028 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 
00030 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
00031 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
00032 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
00033 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
00034 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
00035 
00036 =========================================================================*/
00056 #ifndef __vtkGridTransform_h
00057 #define __vtkGridTransform_h
00058 
00059 #include "vtkWarpTransform.h"
00060 #include "vtkImageData.h"
00061 
00062 #define VTK_GRID_NEAREST 0
00063 #define VTK_GRID_LINEAR 1
00064 #define VTK_GRID_CUBIC 3
00065 
00066 class VTK_EXPORT vtkGridTransform : public vtkWarpTransform
00067 {
00068 public:
00069   static vtkGridTransform *New();
00070   vtkTypeMacro(vtkGridTransform,vtkWarpTransform);
00071   virtual void PrintSelf(ostream& os, vtkIndent indent);
00072 
00076   vtkSetObjectMacro(DisplacementGrid,vtkImageData);
00077   vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00078 
00081   vtkSetMacro(DisplacementScale,float);
00082   vtkGetMacro(DisplacementScale,float);
00083 
00086   vtkSetMacro(DisplacementShift,float);
00087   vtkGetMacro(DisplacementShift,float);
00088 
00091   void SetInterpolationMode(int mode);
00092   vtkGetMacro(InterpolationMode,int);
00093   void SetInterpolationModeToNearestNeighbor()
00094     { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00095   void SetInterpolationModeToLinear()
00096     { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00097   void SetInterpolationModeToCubic()
00098     { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00099   const char *GetInterpolationModeAsString();
00100 
00102   vtkAbstractTransform *MakeTransform();
00103 
00105   unsigned long GetMTime();
00106 
00107 protected:
00108   vtkGridTransform();
00109   ~vtkGridTransform();
00110   vtkGridTransform(const vtkGridTransform&) {};
00111   void operator=(const vtkGridTransform&) {};
00112 
00114   void InternalUpdate();
00115 
00117   void InternalDeepCopy(vtkAbstractTransform *transform);
00118 
00120   void ForwardTransformPoint(const float in[3], float out[3]);
00121   void ForwardTransformPoint(const double in[3], double out[3]);
00122 
00123   void ForwardTransformDerivative(const float in[3], float out[3],
00124               float derivative[3][3]);
00125   void ForwardTransformDerivative(const double in[3], double out[3],
00126               double derivative[3][3]);
00127 
00128   void InverseTransformPoint(const float in[3], float out[3]);
00129   void InverseTransformPoint(const double in[3], double out[3]);
00130 
00131   void InverseTransformDerivative(const float in[3], float out[3],
00132               float derivative[3][3]);
00133   void InverseTransformDerivative(const double in[3], double out[3],
00134               double derivative[3][3]);
00135 
00136 //BTX
00137   void (*InterpolationFunction)(float point[3], float displacement[3],
00138             float derivatives[3][3],
00139             void *gridPtr, int gridType,
00140             int inExt[6], int inInc[3]);
00141 //ETX
00142   int InterpolationMode;
00143   vtkImageData *DisplacementGrid;
00144   float DisplacementScale;
00145   float DisplacementShift;
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 

Generated on Wed Nov 21 12:26:55 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001