VTK  9.3.1
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
25 #ifndef vtkImageSincInterpolator_h
26 #define vtkImageSincInterpolator_h
27 
29 #include "vtkImagingCoreModule.h" // For export macro
30 
31 #define VTK_LANCZOS_WINDOW 0
32 #define VTK_KAISER_WINDOW 1
33 #define VTK_COSINE_WINDOW 2
34 #define VTK_HANN_WINDOW 3
35 #define VTK_HAMMING_WINDOW 4
36 #define VTK_BLACKMAN_WINDOW 5
37 #define VTK_BLACKMAN_HARRIS3 6
38 #define VTK_BLACKMAN_HARRIS4 7
39 #define VTK_NUTTALL_WINDOW 8
40 #define VTK_BLACKMAN_NUTTALL3 9
41 #define VTK_BLACKMAN_NUTTALL4 10
42 #define VTK_SINC_KERNEL_SIZE_MAX 32
43 
44 VTK_ABI_NAMESPACE_BEGIN
45 class vtkImageData;
47 
48 class VTKIMAGINGCORE_EXPORT vtkImageSincInterpolator : public vtkAbstractImageInterpolator
49 {
50 public:
51  static vtkImageSincInterpolator* New();
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
56 
64  virtual void SetWindowFunction(int mode);
65  void SetWindowFunctionToLanczos() { this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
66  void SetWindowFunctionToKaiser() { this->SetWindowFunction(VTK_KAISER_WINDOW); }
67  void SetWindowFunctionToCosine() { this->SetWindowFunction(VTK_COSINE_WINDOW); }
68  void SetWindowFunctionToHann() { this->SetWindowFunction(VTK_HANN_WINDOW); }
69  void SetWindowFunctionToHamming() { this->SetWindowFunction(VTK_HAMMING_WINDOW); }
70  void SetWindowFunctionToBlackman() { this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
71  void SetWindowFunctionToBlackmanHarris3() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
72  void SetWindowFunctionToBlackmanHarris4() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
73  void SetWindowFunctionToNuttall() { this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
74  void SetWindowFunctionToBlackmanNuttall3() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
75  void SetWindowFunctionToBlackmanNuttall4() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
76  int GetWindowFunction() { return this->WindowFunction; }
77  virtual const char* GetWindowFunctionAsString();
79 
87  void SetWindowHalfWidth(int n);
88  int GetWindowHalfWidth() { return this->WindowHalfWidth; }
89 
94  void SetUseWindowParameter(int val);
95  void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
96  void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
97  int GetUseWindowParameter() { return this->UseWindowParameter; }
98 
107  void SetWindowParameter(double parm);
108  double GetWindowParameter() { return this->WindowParameter; }
109 
116  void ComputeSupportSize(const double matrix[16], int support[3]) override;
117 
119 
127  void SetBlurFactors(double x, double y, double z);
128  void SetBlurFactors(const double f[3]) { this->SetBlurFactors(f[0], f[1], f[2]); }
129  void GetBlurFactors(double f[3])
130  {
131  f[0] = this->BlurFactors[0];
132  f[1] = this->BlurFactors[1];
133  f[2] = this->BlurFactors[2];
134  }
135  double* GetBlurFactors() VTK_SIZEHINT(3) { return this->BlurFactors; }
137 
148  void SetAntialiasing(int antialiasing);
149  void AntialiasingOn() { this->SetAntialiasing(1); }
150  void AntialiasingOff() { this->SetAntialiasing(0); }
151  int GetAntialiasing() { return this->Antialiasing; }
152 
160  void SetRenormalization(int renormalization);
161  void RenormalizationOn() { this->SetRenormalization(1); }
162  void RenormalizationOff() { this->SetRenormalization(0); }
163  int GetRenormalization() { return this->Renormalization; }
164 
169  bool IsSeparable() override;
170 
172 
182  void PrecomputeWeightsForExtent(const double matrix[16], const int extent[6], int newExtent[6],
183  vtkInterpolationWeights*& weights) override;
184  void PrecomputeWeightsForExtent(const float matrix[16], const int extent[6], int newExtent[6],
185  vtkInterpolationWeights*& weights) override;
187 
191  void FreePrecomputedWeights(vtkInterpolationWeights*& weights) override;
192 
193 protected:
195  ~vtkImageSincInterpolator() override;
196 
200  void InternalUpdate() override;
201 
206 
208 
212  void (**doublefunc)(vtkInterpolationInfo*, const double[3], double*)) override;
214  void (**floatfunc)(vtkInterpolationInfo*, const float[3], float*)) override;
216 
218 
222  void (**doublefunc)(vtkInterpolationWeights*, int, int, int, double*, int)) override;
224  void (**floatfunc)(vtkInterpolationWeights*, int, int, int, float*, int)) override;
226 
230  virtual void BuildKernelLookupTable();
231 
235  virtual void FreeKernelLookupTable();
236 
239  float* KernelLookupTable[3];
240  int KernelSize[3];
243  double BlurFactors[3];
244  double LastBlurFactors[3];
247 
248 private:
250  void operator=(const vtkImageSincInterpolator&) = delete;
251 };
252 
253 VTK_ABI_NAMESPACE_END
254 #endif
interpolate data values from images
void SetWindowFunctionToBlackmanHarris4()
The window function to use.
#define VTK_KAISER_WINDOW
double * GetBlurFactors()
Blur the image by widening the windowed sinc kernel by the specified factors for the x...
void SetWindowFunctionToKaiser()
The window function to use.
#define VTK_LANCZOS_WINDOW
int GetWindowFunction()
The window function to use.
virtual void InternalDeepCopy(vtkAbstractImageInterpolator *obj)=0
Subclass-specific copy.
virtual void InternalUpdate()=0
Subclass-specific updates.
#define VTK_NUTTALL_WINDOW
#define VTK_BLACKMAN_NUTTALL4
void SetWindowFunctionToBlackmanNuttall3()
The window function to use.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void PrecomputeWeightsForExtent(const double matrix[16], const int extent[6], int checkExtent[6], vtkInterpolationWeights *&weights)
If the data is going to be sampled on a regular grid, then the interpolation weights can be precomput...
void SetWindowFunctionToBlackmanHarris3()
The window function to use.
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
void GetBlurFactors(double f[3])
Blur the image by widening the windowed sinc kernel by the specified factors for the x...
void SetWindowFunctionToBlackman()
The window function to use.
virtual void GetRowInterpolationFunc(void(**doublefunc)(vtkInterpolationWeights *, int, int, int, double *, int))
Get the row interpolation functions.
virtual void GetInterpolationFunc(void(**doublefunc)(vtkInterpolationInfo *, const double[3], double *))
Get the interpolation functions.
virtual bool IsSeparable()=0
True if the interpolation is separable, which means that the weights can be precomputed in order to a...
void SetWindowFunctionToHamming()
The window function to use.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_SIZEHINT(...)
void SetWindowFunctionToCosine()
The window function to use.
#define VTK_BLACKMAN_HARRIS4
void SetWindowFunctionToNuttall()
The window function to use.
#define VTK_HANN_WINDOW
void SetWindowFunctionToLanczos()
The window function to use.
virtual void FreePrecomputedWeights(vtkInterpolationWeights *&weights)
Free the weights that were provided by PrecomputeWeightsForExtent.
#define VTK_BLACKMAN_WINDOW
#define VTK_BLACKMAN_HARRIS3
void SetWindowFunctionToBlackmanNuttall4()
The window function to use.
#define VTK_HAMMING_WINDOW
void SetWindowFunctionToHann()
The window function to use.
#define VTK_BLACKMAN_NUTTALL3
perform sinc interpolation on images
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void ComputeSupportSize(const double matrix[16], int support[3])=0
Get the support size for use in computing update extents.
void SetBlurFactors(const double f[3])
Blur the image by widening the windowed sinc kernel by the specified factors for the x...
#define VTK_COSINE_WINDOW