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-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 =========================================================================*/
00057 #ifndef __vtkGridTransform_h
00058 #define __vtkGridTransform_h
00059 
00060 #include "vtkWarpTransform.h"
00061 #include "vtkImageData.h"
00062 
00063 #define VTK_GRID_NEAREST 0
00064 #define VTK_GRID_LINEAR 1
00065 #define VTK_GRID_CUBIC 3
00066 
00067 class VTK_HYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
00068 {
00069 public:
00070   static vtkGridTransform *New();
00071   vtkTypeMacro(vtkGridTransform,vtkWarpTransform);
00072   virtual void PrintSelf(ostream& os, vtkIndent indent);
00073 
00075 
00078   vtkSetObjectMacro(DisplacementGrid,vtkImageData);
00079   vtkGetObjectMacro(DisplacementGrid,vtkImageData);
00081 
00083 
00085   vtkSetMacro(DisplacementScale,float);
00086   vtkGetMacro(DisplacementScale,float);
00088 
00090 
00092   vtkSetMacro(DisplacementShift,float);
00093   vtkGetMacro(DisplacementShift,float);
00095 
00097 
00099   void SetInterpolationMode(int mode);
00100   vtkGetMacro(InterpolationMode,int);
00101   void SetInterpolationModeToNearestNeighbor()
00102     { this->SetInterpolationMode(VTK_GRID_NEAREST); };
00103   void SetInterpolationModeToLinear()
00104     { this->SetInterpolationMode(VTK_GRID_LINEAR); };
00105   void SetInterpolationModeToCubic()
00106     { this->SetInterpolationMode(VTK_GRID_CUBIC); };
00107   const char *GetInterpolationModeAsString();
00109 
00111   vtkAbstractTransform *MakeTransform();
00112 
00114   unsigned long GetMTime();
00115 
00116 protected:
00117   vtkGridTransform();
00118   ~vtkGridTransform();
00119 
00121   void InternalUpdate();
00122 
00124   void InternalDeepCopy(vtkAbstractTransform *transform);
00125 
00127 
00128   void ForwardTransformPoint(const float in[3], float out[3]);
00129   void ForwardTransformPoint(const double in[3], double out[3]);
00131 
00132   void ForwardTransformDerivative(const float in[3], float out[3],
00133               float derivative[3][3]);
00134   void ForwardTransformDerivative(const double in[3], double out[3],
00135               double derivative[3][3]);
00136 
00137   void InverseTransformPoint(const float in[3], float out[3]);
00138   void InverseTransformPoint(const double in[3], double out[3]);
00139 
00140   void InverseTransformDerivative(const float in[3], float out[3],
00141               float derivative[3][3]);
00142   void InverseTransformDerivative(const double in[3], double out[3],
00143               double derivative[3][3]);
00144 
00145 //BTX
00146   void (*InterpolationFunction)(float point[3], float displacement[3],
00147             float derivatives[3][3],
00148             void *gridPtr, int gridType,
00149             int inExt[6], int inInc[3]);
00150 //ETX
00151   int InterpolationMode;
00152   vtkImageData *DisplacementGrid;
00153   float DisplacementScale;
00154   float DisplacementShift;
00155 private:
00156   vtkGridTransform(const vtkGridTransform&);  // Not implemented.
00157   void operator=(const vtkGridTransform&);  // Not implemented.
00158 };
00159 
00160 //BTX
00161 
00162 //----------------------------------------------------------------------------
00163 inline const char *vtkGridTransform::GetInterpolationModeAsString()
00164 {
00165   switch (this->InterpolationMode)
00166     {
00167     case VTK_GRID_NEAREST:
00168       return "NearestNeighbor";
00169     case VTK_GRID_LINEAR:
00170       return "Linear";
00171     case VTK_GRID_CUBIC:
00172       return "Cubic";
00173     default:
00174       return "";
00175     }
00176 }  
00177 //ETX
00178 
00179 #endif
00180 
00181 
00182 
00183 
00184 

Generated on Thu Mar 28 14:19:23 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001