VTK
dox/Filtering/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 "vtkAbstractImageInterpolator.h"
00037 
00038 #define VTK_LANCZOS_WINDOW 0
00039 #define VTK_KAISER_WINDOW  1
00040 #define VTK_COSINE_WINDOW  2
00041 #define VTK_HANN_WINDOW    3
00042 #define VTK_HAMMING_WINDOW 4
00043 #define VTK_BLACKMAN_WINDOW 5
00044 #define VTK_BLACKMAN_HARRIS3 6
00045 #define VTK_BLACKMAN_HARRIS4 7
00046 #define VTK_NUTTALL_WINDOW 8
00047 #define VTK_BLACKMAN_NUTTALL3 9
00048 #define VTK_BLACKMAN_NUTTALL4 10
00049 #define VTK_SINC_KERNEL_SIZE_MAX 32
00050 
00051 class vtkImageData;
00052 struct vtkInterpolationInfo;
00053 
00054 class VTK_FILTERING_EXPORT vtkImageSincInterpolator :
00055   public vtkAbstractImageInterpolator
00056 {
00057 public:
00058   static vtkImageSincInterpolator *New();
00059   vtkTypeMacro(vtkImageSincInterpolator, vtkAbstractImageInterpolator);
00060   virtual void PrintSelf(ostream& os, vtkIndent indent);
00061 
00063 
00069   virtual void SetWindowFunction(int mode);
00070   void SetWindowFunctionToLanczos() {
00071     this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
00072   void SetWindowFunctionToKaiser() {
00073     this->SetWindowFunction(VTK_KAISER_WINDOW); }
00074   void SetWindowFunctionToCosine() {
00075     this->SetWindowFunction(VTK_COSINE_WINDOW); }
00076   void SetWindowFunctionToHann() {
00077     this->SetWindowFunction(VTK_HANN_WINDOW); }
00078   void SetWindowFunctionToHamming() {
00079     this->SetWindowFunction(VTK_HAMMING_WINDOW); }
00080   void SetWindowFunctionToBlackman() {
00081     this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
00082   void SetWindowFunctionToBlackmanHarris3() {
00083     this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
00084   void SetWindowFunctionToBlackmanHarris4() {
00085     this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
00086   void SetWindowFunctionToNuttall() {
00087     this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
00088   void SetWindowFunctionToBlackmanNuttall3() {
00089     this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
00090   void SetWindowFunctionToBlackmanNuttall4() {
00091     this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
00092   int GetWindowFunction() { return this->WindowFunction; }
00093   virtual const char *GetWindowFunctionAsString();
00095 
00097 
00102   void SetWindowHalfWidth(int n);
00103   int GetWindowHalfWidth() { return this->WindowHalfWidth; }
00105 
00107 
00109   void SetUseWindowParameter(int val);
00110   void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
00111   void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
00112   int GetUseWindowParameter() { return this->UseWindowParameter; }
00114 
00116 
00121   void SetWindowParameter(double parm);
00122   double GetWindowParameter() { return this->WindowParameter; }
00124 
00130   virtual void ComputeSupportSize(const double matrix[16], int support[3]);
00131 
00133 
00139   void SetBlurFactors(double x, double y, double z);
00140   void SetBlurFactors(const double f[3]) {
00141     this->SetBlurFactors(f[0], f[1], f[2]); }
00142   void GetBlurFactors(double f[3]) {
00143     f[0] = this->BlurFactors[0];
00144     f[1] = this->BlurFactors[1];
00145     f[2] = this->BlurFactors[2]; }
00146   double *GetBlurFactors() { return this->BlurFactors; }
00148 
00150 
00158   void SetAntialiasing(int antialiasing);
00159   void AntialiasingOn() { this->SetAntialiasing(1); }
00160   void AntialiasingOff() { this->SetAntialiasing(0); }
00161   int GetAntialiasing() { return this->Antialiasing; }
00163 
00165 
00171   void SetRenormalization(int antialiasing);
00172   void RenormalizationOn() { this->SetRenormalization(1); }
00173   void RenormalizationOff() { this->SetRenormalization(0); }
00174   int GetRenormalization() { return this->Renormalization; }
00176 
00179   virtual bool IsSeparable();
00180 
00182 
00189   virtual void PrecomputeWeightsForExtent(
00190     const double matrix[16], const int extent[6], int newExtent[6],
00191     vtkInterpolationWeights *&weights);
00192   virtual void PrecomputeWeightsForExtent(
00193     const float matrix[16], const int extent[6], int newExtent[6],
00194     vtkInterpolationWeights *&weights);
00196 
00198   virtual void FreePrecomputedWeights(vtkInterpolationWeights *&weights);
00199 
00200 protected:
00201   vtkImageSincInterpolator();
00202   ~vtkImageSincInterpolator();
00203 
00205   virtual void InternalUpdate();
00206 
00208   virtual void InternalDeepCopy(vtkAbstractImageInterpolator *obj);
00209 
00211 
00212   virtual void GetInterpolationFunc(
00213     void (**doublefunc)(
00214       vtkInterpolationInfo *, const double [3], double *));
00215   virtual void GetInterpolationFunc(
00216     void (**floatfunc)(
00217       vtkInterpolationInfo *, const float [3], float *));
00219 
00221 
00222   virtual void GetRowInterpolationFunc(
00223     void (**doublefunc)(
00224       vtkInterpolationWeights *, int, int, int, double *, int));
00225   virtual void GetRowInterpolationFunc(
00226     void (**floatfunc)(
00227       vtkInterpolationWeights *, int, int, int, float *, int));
00229 
00231   virtual void BuildKernelLookupTable();
00232 
00234   virtual void FreeKernelLookupTable();
00235 
00236   int WindowFunction;
00237   int WindowHalfWidth;
00238   float *KernelLookupTable[3];
00239   int KernelSize[3];
00240   int Antialiasing;
00241   int Renormalization;
00242   double BlurFactors[3];
00243   double LastBlurFactors[3];
00244   double WindowParameter;
00245   int UseWindowParameter;
00246 
00247 private:
00248   vtkImageSincInterpolator(const vtkImageSincInterpolator&);  // Not implemented.
00249   void operator=(const vtkImageSincInterpolator&);  // Not implemented.
00250 };
00251 
00252 #endif