VTK  9.2.6
vtkImageSincInterpolator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageSincInterpolator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
46 #ifndef vtkImageSincInterpolator_h
47 #define vtkImageSincInterpolator_h
48 
50 #include "vtkImagingCoreModule.h" // For export macro
51 
52 #define VTK_LANCZOS_WINDOW 0
53 #define VTK_KAISER_WINDOW 1
54 #define VTK_COSINE_WINDOW 2
55 #define VTK_HANN_WINDOW 3
56 #define VTK_HAMMING_WINDOW 4
57 #define VTK_BLACKMAN_WINDOW 5
58 #define VTK_BLACKMAN_HARRIS3 6
59 #define VTK_BLACKMAN_HARRIS4 7
60 #define VTK_NUTTALL_WINDOW 8
61 #define VTK_BLACKMAN_NUTTALL3 9
62 #define VTK_BLACKMAN_NUTTALL4 10
63 #define VTK_SINC_KERNEL_SIZE_MAX 32
64 
65 class vtkImageData;
67 
68 class VTKIMAGINGCORE_EXPORT vtkImageSincInterpolator : public vtkAbstractImageInterpolator
69 {
70 public:
73  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
76 
84  virtual void SetWindowFunction(int mode);
85  void SetWindowFunctionToLanczos() { this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
86  void SetWindowFunctionToKaiser() { this->SetWindowFunction(VTK_KAISER_WINDOW); }
87  void SetWindowFunctionToCosine() { this->SetWindowFunction(VTK_COSINE_WINDOW); }
88  void SetWindowFunctionToHann() { this->SetWindowFunction(VTK_HANN_WINDOW); }
89  void SetWindowFunctionToHamming() { this->SetWindowFunction(VTK_HAMMING_WINDOW); }
90  void SetWindowFunctionToBlackman() { this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
91  void SetWindowFunctionToBlackmanHarris3() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
92  void SetWindowFunctionToBlackmanHarris4() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
93  void SetWindowFunctionToNuttall() { this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
94  void SetWindowFunctionToBlackmanNuttall3() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
95  void SetWindowFunctionToBlackmanNuttall4() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
96  int GetWindowFunction() { return this->WindowFunction; }
97  virtual const char* GetWindowFunctionAsString();
99 
107  void SetWindowHalfWidth(int n);
108  int GetWindowHalfWidth() { return this->WindowHalfWidth; }
109 
114  void SetUseWindowParameter(int val);
115  void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
116  void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
117  int GetUseWindowParameter() { return this->UseWindowParameter; }
118 
127  void SetWindowParameter(double parm);
128  double GetWindowParameter() { return this->WindowParameter; }
129 
136  void ComputeSupportSize(const double matrix[16], int support[3]) override;
137 
139 
147  void SetBlurFactors(double x, double y, double z);
148  void SetBlurFactors(const double f[3]) { this->SetBlurFactors(f[0], f[1], f[2]); }
149  void GetBlurFactors(double f[3])
150  {
151  f[0] = this->BlurFactors[0];
152  f[1] = this->BlurFactors[1];
153  f[2] = this->BlurFactors[2];
154  }
155  double* GetBlurFactors() VTK_SIZEHINT(3) { return this->BlurFactors; }
157 
168  void SetAntialiasing(int antialiasing);
169  void AntialiasingOn() { this->SetAntialiasing(1); }
170  void AntialiasingOff() { this->SetAntialiasing(0); }
171  int GetAntialiasing() { return this->Antialiasing; }
172 
180  void SetRenormalization(int renormalization);
181  void RenormalizationOn() { this->SetRenormalization(1); }
182  void RenormalizationOff() { this->SetRenormalization(0); }
183  int GetRenormalization() { return this->Renormalization; }
184 
189  bool IsSeparable() override;
190 
192 
202  void PrecomputeWeightsForExtent(const double matrix[16], const int extent[6], int newExtent[6],
203  vtkInterpolationWeights*& weights) override;
204  void PrecomputeWeightsForExtent(const float matrix[16], const int extent[6], int newExtent[6],
205  vtkInterpolationWeights*& weights) override;
207 
212 
213 protected:
216 
220  void InternalUpdate() override;
221 
226 
228 
232  void (**doublefunc)(vtkInterpolationInfo*, const double[3], double*)) override;
234  void (**floatfunc)(vtkInterpolationInfo*, const float[3], float*)) override;
236 
238 
242  void (**doublefunc)(vtkInterpolationWeights*, int, int, int, double*, int)) override;
244  void (**floatfunc)(vtkInterpolationWeights*, int, int, int, float*, int)) override;
246 
250  virtual void BuildKernelLookupTable();
251 
255  virtual void FreeKernelLookupTable();
256 
259  float* KernelLookupTable[3];
260  int KernelSize[3];
263  double BlurFactors[3];
264  double LastBlurFactors[3];
267 
268 private:
270  void operator=(const vtkImageSincInterpolator&) = delete;
271 };
272 
273 #endif
interpolate data values from images
topologically and geometrically regular array of data
Definition: vtkImageData.h:63
perform sinc interpolation on images
void SetWindowFunctionToKaiser()
The window function to use.
virtual void SetWindowFunction(int mode)
The window function to use.
void InternalDeepCopy(vtkAbstractImageInterpolator *obj) override
Copy the interpolator.
double * GetBlurFactors()
Blur the image by widening the windowed sinc kernel by the specified factors for the x,...
virtual const char * GetWindowFunctionAsString()
The window function to use.
void SetWindowFunctionToCosine()
The window function to use.
virtual void BuildKernelLookupTable()
Build the lookup tables used for the interpolation.
void SetWindowFunctionToLanczos()
The window function to use.
void GetBlurFactors(double f[3])
Blur the image by widening the windowed sinc kernel by the specified factors for the x,...
void SetWindowFunctionToBlackmanNuttall3()
The window function to use.
void GetInterpolationFunc(void(**doublefunc)(vtkInterpolationInfo *, const double[3], double *)) override
Get the interpolation functions.
void SetRenormalization(int renormalization)
Turn off renormalization.
void SetWindowFunctionToBlackmanHarris3()
The window function to use.
void SetUseWindowParameter(int val)
Turn this on in order to use SetWindowParameter.
void SetWindowFunctionToBlackmanNuttall4()
The window function to use.
void SetWindowFunctionToNuttall()
The window function to use.
void InternalUpdate() override
Update the interpolator.
void SetAntialiasing(int antialiasing)
Turn on antialiasing.
void FreePrecomputedWeights(vtkInterpolationWeights *&weights) override
Free the precomputed weights.
~vtkImageSincInterpolator() override
void GetInterpolationFunc(void(**floatfunc)(vtkInterpolationInfo *, const float[3], float *)) override
Get the interpolation functions.
void SetWindowHalfWidth(int n)
Set the window half-width, this must be an integer between 1 and 16, with a default value of 3.
void GetRowInterpolationFunc(void(**doublefunc)(vtkInterpolationWeights *, int, int, int, double *, int)) override
Get the row interpolation functions.
void SetBlurFactors(const double f[3])
Blur the image by widening the windowed sinc kernel by the specified factors for the x,...
void PrecomputeWeightsForExtent(const float matrix[16], const int extent[6], int newExtent[6], vtkInterpolationWeights *&weights) override
If the data is going to be sampled on a regular grid, then the interpolation weights can be precomput...
void SetWindowFunctionToHann()
The window function to use.
int GetWindowFunction()
The window function to use.
virtual void FreeKernelLookupTable()
Free the kernel lookup tables.
void ComputeSupportSize(const double matrix[16], int support[3]) override
Get the support size for use in computing update extents.
void SetWindowFunctionToBlackman()
The window function to use.
static vtkImageSincInterpolator * New()
bool IsSeparable() override
Returns true if the interpolator supports weight precomputation.
void SetWindowParameter(double parm)
Set the alpha parameter for the Kaiser window function.
void SetWindowFunctionToBlackmanHarris4()
The window function to use.
void SetWindowFunctionToHamming()
The window function to use.
void PrecomputeWeightsForExtent(const double matrix[16], const int extent[6], int newExtent[6], vtkInterpolationWeights *&weights) override
If the data is going to be sampled on a regular grid, then the interpolation weights can be precomput...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void GetRowInterpolationFunc(void(**floatfunc)(vtkInterpolationWeights *, int, int, int, float *, int)) override
Get the row interpolation functions.
void SetBlurFactors(double x, double y, double z)
Blur the image by widening the windowed sinc kernel by the specified factors for the x,...
a simple class to control print indentation
Definition: vtkIndent.h:49
@ mode
Definition: vtkX3D.h:253
@ extent
Definition: vtkX3D.h:351
#define VTK_HAMMING_WINDOW
#define VTK_KAISER_WINDOW
#define VTK_BLACKMAN_HARRIS4
#define VTK_HANN_WINDOW
#define VTK_NUTTALL_WINDOW
#define VTK_BLACKMAN_WINDOW
#define VTK_BLACKMAN_NUTTALL4
#define VTK_LANCZOS_WINDOW
#define VTK_COSINE_WINDOW
#define VTK_BLACKMAN_HARRIS3
#define VTK_BLACKMAN_NUTTALL3
#define VTK_SIZEHINT(...)