VTK  9.3.20240329
vtkImageSincInterpolator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
54 #ifndef vtkImageSincInterpolator_h
55 #define vtkImageSincInterpolator_h
56 
58 #include "vtkImagingCoreModule.h" // For export macro
59 
60 #define VTK_LANCZOS_WINDOW 0
61 #define VTK_KAISER_WINDOW 1
62 #define VTK_COSINE_WINDOW 2
63 #define VTK_HANN_WINDOW 3
64 #define VTK_HAMMING_WINDOW 4
65 #define VTK_BLACKMAN_WINDOW 5
66 #define VTK_BLACKMAN_HARRIS3 6
67 #define VTK_BLACKMAN_HARRIS4 7
68 #define VTK_NUTTALL_WINDOW 8
69 #define VTK_BLACKMAN_NUTTALL3 9
70 #define VTK_BLACKMAN_NUTTALL4 10
71 #define VTK_SINC_KERNEL_SIZE_MAX 32
72 
73 VTK_ABI_NAMESPACE_BEGIN
74 class vtkImageData;
76 
77 class VTKIMAGINGCORE_EXPORT vtkImageSincInterpolator : public vtkAbstractImageInterpolator
78 {
79 public:
82  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
85 
93  virtual void SetWindowFunction(int mode);
94  void SetWindowFunctionToLanczos() { this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
95  void SetWindowFunctionToKaiser() { this->SetWindowFunction(VTK_KAISER_WINDOW); }
96  void SetWindowFunctionToCosine() { this->SetWindowFunction(VTK_COSINE_WINDOW); }
97  void SetWindowFunctionToHann() { this->SetWindowFunction(VTK_HANN_WINDOW); }
98  void SetWindowFunctionToHamming() { this->SetWindowFunction(VTK_HAMMING_WINDOW); }
99  void SetWindowFunctionToBlackman() { this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
100  void SetWindowFunctionToBlackmanHarris3() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
101  void SetWindowFunctionToBlackmanHarris4() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
102  void SetWindowFunctionToNuttall() { this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
103  void SetWindowFunctionToBlackmanNuttall3() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
104  void SetWindowFunctionToBlackmanNuttall4() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
105  int GetWindowFunction() { return this->WindowFunction; }
106  virtual const char* GetWindowFunctionAsString();
108 
116  void SetWindowHalfWidth(int n);
117  int GetWindowHalfWidth() { return this->WindowHalfWidth; }
118 
123  void SetUseWindowParameter(int val);
124  void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
125  void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
126  int GetUseWindowParameter() { return this->UseWindowParameter; }
127 
136  void SetWindowParameter(double param);
137  double GetWindowParameter() { return this->WindowParameter; }
138 
145  void ComputeSupportSize(const double matrix[16], int support[3]) override;
146 
148 
156  void SetBlurFactors(double x, double y, double z);
157  void SetBlurFactors(const double f[3]) { this->SetBlurFactors(f[0], f[1], f[2]); }
158  void GetBlurFactors(double f[3])
159  {
160  f[0] = this->BlurFactors[0];
161  f[1] = this->BlurFactors[1];
162  f[2] = this->BlurFactors[2];
163  }
164  double* GetBlurFactors() VTK_SIZEHINT(3) { return this->BlurFactors; }
166 
177  void SetAntialiasing(int antialiasing);
178  void AntialiasingOn() { this->SetAntialiasing(1); }
179  void AntialiasingOff() { this->SetAntialiasing(0); }
180  int GetAntialiasing() { return this->Antialiasing; }
181 
189  void SetRenormalization(int renormalization);
190  void RenormalizationOn() { this->SetRenormalization(1); }
191  void RenormalizationOff() { this->SetRenormalization(0); }
192  int GetRenormalization() { return this->Renormalization; }
193 
198  bool IsSeparable() override;
199 
201 
211  void PrecomputeWeightsForExtent(const double matrix[16], const int extent[6], int newExtent[6],
212  vtkInterpolationWeights*& weights) override;
213  void PrecomputeWeightsForExtent(const float matrix[16], const int extent[6], int newExtent[6],
214  vtkInterpolationWeights*& weights) override;
216 
221 
222 protected:
225 
229  void InternalUpdate() override;
230 
235 
237 
241  void (**doublefunc)(vtkInterpolationInfo*, const double[3], double*)) override;
243  void (**floatfunc)(vtkInterpolationInfo*, const float[3], float*)) override;
245 
247 
251  void (**doublefunc)(vtkInterpolationWeights*, int, int, int, double*, int)) override;
253  void (**floatfunc)(vtkInterpolationWeights*, int, int, int, float*, int)) override;
255 
259  virtual void BuildKernelLookupTable();
260 
264  virtual void FreeKernelLookupTable();
265 
268  float* KernelLookupTable[3];
269  int KernelSize[3];
272  double BlurFactors[3];
273  double LastBlurFactors[3];
276 
277 private:
279  void operator=(const vtkImageSincInterpolator&) = delete;
280 };
281 
282 VTK_ABI_NAMESPACE_END
283 #endif
interpolate data values from images
topologically and geometrically regular array of data
Definition: vtkImageData.h:156
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 SetWindowFunctionToBlackmanHarris4()
The window function to use.
void SetWindowFunctionToHamming()
The window function to use.
void SetWindowParameter(double param)
Set the alpha parameter for the Kaiser window function.
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:108
@ mode
Definition: vtkX3D.h:247
@ extent
Definition: vtkX3D.h:345
#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(...)