VTK
|
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 00122 void SetWindowParameter(double parm); 00123 double GetWindowParameter() { return this->WindowParameter; } 00125 00131 virtual void ComputeSupportSize(const double matrix[16], int support[3]); 00132 00134 00140 void SetBlurFactors(double x, double y, double z); 00141 void SetBlurFactors(const double f[3]) { 00142 this->SetBlurFactors(f[0], f[1], f[2]); } 00143 void GetBlurFactors(double f[3]) { 00144 f[0] = this->BlurFactors[0]; 00145 f[1] = this->BlurFactors[1]; 00146 f[2] = this->BlurFactors[2]; } 00147 double *GetBlurFactors() { return this->BlurFactors; } 00149 00151 00159 void SetAntialiasing(int antialiasing); 00160 void AntialiasingOn() { this->SetAntialiasing(1); } 00161 void AntialiasingOff() { this->SetAntialiasing(0); } 00162 int GetAntialiasing() { return this->Antialiasing; } 00164 00166 00172 void SetRenormalization(int antialiasing); 00173 void RenormalizationOn() { this->SetRenormalization(1); } 00174 void RenormalizationOff() { this->SetRenormalization(0); } 00175 int GetRenormalization() { return this->Renormalization; } 00177 00180 virtual bool IsSeparable(); 00181 00183 00190 virtual void PrecomputeWeightsForExtent( 00191 const double matrix[16], const int extent[6], int newExtent[6], 00192 vtkInterpolationWeights *&weights); 00193 virtual void PrecomputeWeightsForExtent( 00194 const float matrix[16], const int extent[6], int newExtent[6], 00195 vtkInterpolationWeights *&weights); 00197 00199 virtual void FreePrecomputedWeights(vtkInterpolationWeights *&weights); 00200 00201 protected: 00202 vtkImageSincInterpolator(); 00203 ~vtkImageSincInterpolator(); 00204 00206 virtual void InternalUpdate(); 00207 00209 virtual void InternalDeepCopy(vtkAbstractImageInterpolator *obj); 00210 00212 00213 virtual void GetInterpolationFunc( 00214 void (**doublefunc)( 00215 vtkInterpolationInfo *, const double [3], double *)); 00216 virtual void GetInterpolationFunc( 00217 void (**floatfunc)( 00218 vtkInterpolationInfo *, const float [3], float *)); 00220 00222 00223 virtual void GetRowInterpolationFunc( 00224 void (**doublefunc)( 00225 vtkInterpolationWeights *, int, int, int, double *, int)); 00226 virtual void GetRowInterpolationFunc( 00227 void (**floatfunc)( 00228 vtkInterpolationWeights *, int, int, int, float *, int)); 00230 00232 virtual void BuildKernelLookupTable(); 00233 00235 virtual void FreeKernelLookupTable(); 00236 00237 int WindowFunction; 00238 int WindowHalfWidth; 00239 float *KernelLookupTable[3]; 00240 int KernelSize[3]; 00241 int Antialiasing; 00242 int Renormalization; 00243 double BlurFactors[3]; 00244 double LastBlurFactors[3]; 00245 double WindowParameter; 00246 int UseWindowParameter; 00247 00248 private: 00249 vtkImageSincInterpolator(const vtkImageSincInterpolator&); // Not implemented. 00250 void operator=(const vtkImageSincInterpolator&); // Not implemented. 00251 }; 00252 00253 #endif