VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Imaging/Core/vtkImageSincInterpolator.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkImageSincInterpolator.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00033 #ifndef vtkImageSincInterpolator_h
00034 #define vtkImageSincInterpolator_h
00035 
00036 #include "vtkImagingCoreModule.h" // For export macro
00037 #include "vtkAbstractImageInterpolator.h"
00038 
00039 #define VTK_LANCZOS_WINDOW 0
00040 #define VTK_KAISER_WINDOW  1
00041 #define VTK_COSINE_WINDOW  2
00042 #define VTK_HANN_WINDOW    3
00043 #define VTK_HAMMING_WINDOW 4
00044 #define VTK_BLACKMAN_WINDOW 5
00045 #define VTK_BLACKMAN_HARRIS3 6
00046 #define VTK_BLACKMAN_HARRIS4 7
00047 #define VTK_NUTTALL_WINDOW 8
00048 #define VTK_BLACKMAN_NUTTALL3 9
00049 #define VTK_BLACKMAN_NUTTALL4 10
00050 #define VTK_SINC_KERNEL_SIZE_MAX 32
00051 
00052 class vtkImageData;
00053 struct vtkInterpolationInfo;
00054 
00055 class VTKIMAGINGCORE_EXPORT vtkImageSincInterpolator :
00056   public vtkAbstractImageInterpolator
00057 {
00058 public:
00059   static vtkImageSincInterpolator *New();
00060   vtkTypeMacro(vtkImageSincInterpolator, vtkAbstractImageInterpolator);
00061   virtual void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064 
00070   virtual void SetWindowFunction(int mode);
00071   void SetWindowFunctionToLanczos() {
00072     this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
00073   void SetWindowFunctionToKaiser() {
00074     this->SetWindowFunction(VTK_KAISER_WINDOW); }
00075   void SetWindowFunctionToCosine() {
00076     this->SetWindowFunction(VTK_COSINE_WINDOW); }
00077   void SetWindowFunctionToHann() {
00078     this->SetWindowFunction(VTK_HANN_WINDOW); }
00079   void SetWindowFunctionToHamming() {
00080     this->SetWindowFunction(VTK_HAMMING_WINDOW); }
00081   void SetWindowFunctionToBlackman() {
00082     this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
00083   void SetWindowFunctionToBlackmanHarris3() {
00084     this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
00085   void SetWindowFunctionToBlackmanHarris4() {
00086     this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
00087   void SetWindowFunctionToNuttall() {
00088     this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
00089   void SetWindowFunctionToBlackmanNuttall3() {
00090     this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
00091   void SetWindowFunctionToBlackmanNuttall4() {
00092     this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
00093   int GetWindowFunction() { return this->WindowFunction; }
00094   virtual const char *GetWindowFunctionAsString();
00096 
00098 
00103   void SetWindowHalfWidth(int n);
00104   int GetWindowHalfWidth() { return this->WindowHalfWidth; }
00106 
00108 
00110   void SetUseWindowParameter(int val);
00111   void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
00112   void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
00113   int GetUseWindowParameter() { return this->UseWindowParameter; }
00115 
00117 
00123   void SetWindowParameter(double parm);
00124   double GetWindowParameter() { return this->WindowParameter; }
00126 
00132   virtual void ComputeSupportSize(const double matrix[16], int support[3]);
00133 
00135 
00141   void SetBlurFactors(double x, double y, double z);
00142   void SetBlurFactors(const double f[3]) {
00143     this->SetBlurFactors(f[0], f[1], f[2]); }
00144   void GetBlurFactors(double f[3]) {
00145     f[0] = this->BlurFactors[0];
00146     f[1] = this->BlurFactors[1];
00147     f[2] = this->BlurFactors[2]; }
00148   double *GetBlurFactors() { return this->BlurFactors; }
00150 
00152 
00160   void SetAntialiasing(int antialiasing);
00161   void AntialiasingOn() { this->SetAntialiasing(1); }
00162   void AntialiasingOff() { this->SetAntialiasing(0); }
00163   int GetAntialiasing() { return this->Antialiasing; }
00165 
00167 
00173   void SetRenormalization(int renormalization);
00174   void RenormalizationOn() { this->SetRenormalization(1); }
00175   void RenormalizationOff() { this->SetRenormalization(0); }
00176   int GetRenormalization() { return this->Renormalization; }
00178 
00181   virtual bool IsSeparable();
00182 
00184 
00191   virtual void PrecomputeWeightsForExtent(
00192     const double matrix[16], const int extent[6], int newExtent[6],
00193     vtkInterpolationWeights *&weights);
00194   virtual void PrecomputeWeightsForExtent(
00195     const float matrix[16], const int extent[6], int newExtent[6],
00196     vtkInterpolationWeights *&weights);
00198 
00200   virtual void FreePrecomputedWeights(vtkInterpolationWeights *&weights);
00201 
00202 protected:
00203   vtkImageSincInterpolator();
00204   ~vtkImageSincInterpolator();
00205 
00207   virtual void InternalUpdate();
00208 
00210   virtual void InternalDeepCopy(vtkAbstractImageInterpolator *obj);
00211 
00213 
00214   virtual void GetInterpolationFunc(
00215     void (**doublefunc)(
00216       vtkInterpolationInfo *, const double [3], double *));
00217   virtual void GetInterpolationFunc(
00218     void (**floatfunc)(
00219       vtkInterpolationInfo *, const float [3], float *));
00221 
00223 
00224   virtual void GetRowInterpolationFunc(
00225     void (**doublefunc)(
00226       vtkInterpolationWeights *, int, int, int, double *, int));
00227   virtual void GetRowInterpolationFunc(
00228     void (**floatfunc)(
00229       vtkInterpolationWeights *, int, int, int, float *, int));
00231 
00233   virtual void BuildKernelLookupTable();
00234 
00236   virtual void FreeKernelLookupTable();
00237 
00238   int WindowFunction;
00239   int WindowHalfWidth;
00240   float *KernelLookupTable[3];
00241   int KernelSize[3];
00242   int Antialiasing;
00243   int Renormalization;
00244   double BlurFactors[3];
00245   double LastBlurFactors[3];
00246   double WindowParameter;
00247   int UseWindowParameter;
00248 
00249 private:
00250   vtkImageSincInterpolator(const vtkImageSincInterpolator&);  // Not implemented.
00251   void operator=(const vtkImageSincInterpolator&);  // Not implemented.
00252 };
00253 
00254 #endif