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 =========================================================================*/
37 #ifndef vtkImageSincInterpolator_h
38 #define vtkImageSincInterpolator_h
39 
41 #include "vtkImagingCoreModule.h" // For export macro
42 
43 #define VTK_LANCZOS_WINDOW 0
44 #define VTK_KAISER_WINDOW 1
45 #define VTK_COSINE_WINDOW 2
46 #define VTK_HANN_WINDOW 3
47 #define VTK_HAMMING_WINDOW 4
48 #define VTK_BLACKMAN_WINDOW 5
49 #define VTK_BLACKMAN_HARRIS3 6
50 #define VTK_BLACKMAN_HARRIS4 7
51 #define VTK_NUTTALL_WINDOW 8
52 #define VTK_BLACKMAN_NUTTALL3 9
53 #define VTK_BLACKMAN_NUTTALL4 10
54 #define VTK_SINC_KERNEL_SIZE_MAX 32
55 
56 class vtkImageData;
58 
59 class VTKIMAGINGCORE_EXPORT vtkImageSincInterpolator : public vtkAbstractImageInterpolator
60 {
61 public:
62  static vtkImageSincInterpolator* New();
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
75  virtual void SetWindowFunction(int mode);
76  void SetWindowFunctionToLanczos() { this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
77  void SetWindowFunctionToKaiser() { this->SetWindowFunction(VTK_KAISER_WINDOW); }
78  void SetWindowFunctionToCosine() { this->SetWindowFunction(VTK_COSINE_WINDOW); }
79  void SetWindowFunctionToHann() { this->SetWindowFunction(VTK_HANN_WINDOW); }
80  void SetWindowFunctionToHamming() { this->SetWindowFunction(VTK_HAMMING_WINDOW); }
81  void SetWindowFunctionToBlackman() { this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
82  void SetWindowFunctionToBlackmanHarris3() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
83  void SetWindowFunctionToBlackmanHarris4() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
84  void SetWindowFunctionToNuttall() { this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
85  void SetWindowFunctionToBlackmanNuttall3() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
86  void SetWindowFunctionToBlackmanNuttall4() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
87  int GetWindowFunction() { return this->WindowFunction; }
88  virtual const char* GetWindowFunctionAsString();
90 
98  void SetWindowHalfWidth(int n);
99  int GetWindowHalfWidth() { return this->WindowHalfWidth; }
100 
105  void SetUseWindowParameter(int val);
106  void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
107  void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
108  int GetUseWindowParameter() { return this->UseWindowParameter; }
109 
118  void SetWindowParameter(double parm);
119  double GetWindowParameter() { return this->WindowParameter; }
120 
127  void ComputeSupportSize(const double matrix[16], int support[3]) override;
128 
130 
138  void SetBlurFactors(double x, double y, double z);
139  void SetBlurFactors(const double f[3]) { this->SetBlurFactors(f[0], f[1], f[2]); }
140  void GetBlurFactors(double f[3])
141  {
142  f[0] = this->BlurFactors[0];
143  f[1] = this->BlurFactors[1];
144  f[2] = this->BlurFactors[2];
145  }
146  double* GetBlurFactors() VTK_SIZEHINT(3) { return this->BlurFactors; }
148 
159  void SetAntialiasing(int antialiasing);
160  void AntialiasingOn() { this->SetAntialiasing(1); }
161  void AntialiasingOff() { this->SetAntialiasing(0); }
162  int GetAntialiasing() { return this->Antialiasing; }
163 
171  void SetRenormalization(int renormalization);
172  void RenormalizationOn() { this->SetRenormalization(1); }
173  void RenormalizationOff() { this->SetRenormalization(0); }
174  int GetRenormalization() { return this->Renormalization; }
175 
180  bool IsSeparable() override;
181 
183 
193  void PrecomputeWeightsForExtent(const double matrix[16], const int extent[6], int newExtent[6],
194  vtkInterpolationWeights*& weights) override;
195  void PrecomputeWeightsForExtent(const float matrix[16], const int extent[6], int newExtent[6],
196  vtkInterpolationWeights*& weights) override;
198 
202  void FreePrecomputedWeights(vtkInterpolationWeights*& weights) override;
203 
204 protected:
206  ~vtkImageSincInterpolator() override;
207 
211  void InternalUpdate() override;
212 
217 
219 
223  void (**doublefunc)(vtkInterpolationInfo*, const double[3], double*)) override;
225  void (**floatfunc)(vtkInterpolationInfo*, const float[3], float*)) override;
227 
229 
233  void (**doublefunc)(vtkInterpolationWeights*, int, int, int, double*, int)) override;
235  void (**floatfunc)(vtkInterpolationWeights*, int, int, int, float*, int)) override;
237 
241  virtual void BuildKernelLookupTable();
242 
246  virtual void FreeKernelLookupTable();
247 
250  float* KernelLookupTable[3];
251  int KernelSize[3];
254  double BlurFactors[3];
255  double LastBlurFactors[3];
258 
259 private:
261  void operator=(const vtkImageSincInterpolator&) = delete;
262 };
263 
264 #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:39
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:53
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