VTK  9.1.0
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 =========================================================================*/
60 #ifndef vtkImageSincInterpolator_h
61 #define vtkImageSincInterpolator_h
62 
64 #include "vtkImagingCoreModule.h" // For export macro
65 
66 #define VTK_LANCZOS_WINDOW 0
67 #define VTK_KAISER_WINDOW 1
68 #define VTK_COSINE_WINDOW 2
69 #define VTK_HANN_WINDOW 3
70 #define VTK_HAMMING_WINDOW 4
71 #define VTK_BLACKMAN_WINDOW 5
72 #define VTK_BLACKMAN_HARRIS3 6
73 #define VTK_BLACKMAN_HARRIS4 7
74 #define VTK_NUTTALL_WINDOW 8
75 #define VTK_BLACKMAN_NUTTALL3 9
76 #define VTK_BLACKMAN_NUTTALL4 10
77 #define VTK_SINC_KERNEL_SIZE_MAX 32
78 
79 class vtkImageData;
81 
82 class VTKIMAGINGCORE_EXPORT vtkImageSincInterpolator : public vtkAbstractImageInterpolator
83 {
84 public:
87  void PrintSelf(ostream& os, vtkIndent indent) override;
88 
90 
98  virtual void SetWindowFunction(int mode);
99  void SetWindowFunctionToLanczos() { this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
100  void SetWindowFunctionToKaiser() { this->SetWindowFunction(VTK_KAISER_WINDOW); }
101  void SetWindowFunctionToCosine() { this->SetWindowFunction(VTK_COSINE_WINDOW); }
102  void SetWindowFunctionToHann() { this->SetWindowFunction(VTK_HANN_WINDOW); }
103  void SetWindowFunctionToHamming() { this->SetWindowFunction(VTK_HAMMING_WINDOW); }
104  void SetWindowFunctionToBlackman() { this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
105  void SetWindowFunctionToBlackmanHarris3() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
106  void SetWindowFunctionToBlackmanHarris4() { this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
107  void SetWindowFunctionToNuttall() { this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
108  void SetWindowFunctionToBlackmanNuttall3() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
109  void SetWindowFunctionToBlackmanNuttall4() { this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
110  int GetWindowFunction() { return this->WindowFunction; }
111  virtual const char* GetWindowFunctionAsString();
113 
121  void SetWindowHalfWidth(int n);
122  int GetWindowHalfWidth() { return this->WindowHalfWidth; }
123 
128  void SetUseWindowParameter(int val);
129  void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
130  void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
131  int GetUseWindowParameter() { return this->UseWindowParameter; }
132 
141  void SetWindowParameter(double parm);
142  double GetWindowParameter() { return this->WindowParameter; }
143 
150  void ComputeSupportSize(const double matrix[16], int support[3]) override;
151 
153 
161  void SetBlurFactors(double x, double y, double z);
162  void SetBlurFactors(const double f[3]) { this->SetBlurFactors(f[0], f[1], f[2]); }
163  void GetBlurFactors(double f[3])
164  {
165  f[0] = this->BlurFactors[0];
166  f[1] = this->BlurFactors[1];
167  f[2] = this->BlurFactors[2];
168  }
169  double* GetBlurFactors() VTK_SIZEHINT(3) { return this->BlurFactors; }
171 
182  void SetAntialiasing(int antialiasing);
183  void AntialiasingOn() { this->SetAntialiasing(1); }
184  void AntialiasingOff() { this->SetAntialiasing(0); }
185  int GetAntialiasing() { return this->Antialiasing; }
186 
194  void SetRenormalization(int renormalization);
195  void RenormalizationOn() { this->SetRenormalization(1); }
196  void RenormalizationOff() { this->SetRenormalization(0); }
197  int GetRenormalization() { return this->Renormalization; }
198 
203  bool IsSeparable() override;
204 
206 
216  void PrecomputeWeightsForExtent(const double matrix[16], const int extent[6], int newExtent[6],
217  vtkInterpolationWeights*& weights) override;
218  void PrecomputeWeightsForExtent(const float matrix[16], const int extent[6], int newExtent[6],
219  vtkInterpolationWeights*& weights) override;
221 
226 
227 protected:
230 
234  void InternalUpdate() override;
235 
240 
242 
246  void (**doublefunc)(vtkInterpolationInfo*, const double[3], double*)) override;
248  void (**floatfunc)(vtkInterpolationInfo*, const float[3], float*)) override;
250 
252 
256  void (**doublefunc)(vtkInterpolationWeights*, int, int, int, double*, int)) override;
258  void (**floatfunc)(vtkInterpolationWeights*, int, int, int, float*, int)) override;
260 
264  virtual void BuildKernelLookupTable();
265 
269  virtual void FreeKernelLookupTable();
270 
273  float* KernelLookupTable[3];
274  int KernelSize[3];
277  double BlurFactors[3];
278  double LastBlurFactors[3];
281 
282 private:
284  void operator=(const vtkImageSincInterpolator&) = delete;
285 };
286 
287 #endif
VTK_BLACKMAN_HARRIS4
#define VTK_BLACKMAN_HARRIS4
Definition: vtkImageSincInterpolator.h:73
vtkImageSincInterpolator::UseWindowParameterOn
void UseWindowParameterOn()
Definition: vtkImageSincInterpolator.h:129
vtkImageSincInterpolator::GetWindowHalfWidth
int GetWindowHalfWidth()
Definition: vtkImageSincInterpolator.h:122
VTK_HANN_WINDOW
#define VTK_HANN_WINDOW
Definition: vtkImageSincInterpolator.h:69
vtkImageSincInterpolator::SetBlurFactors
void SetBlurFactors(const double f[3])
Blur the image by widening the windowed sinc kernel by the specified factors for the x,...
Definition: vtkImageSincInterpolator.h:162
vtkImageSincInterpolator::GetAntialiasing
int GetAntialiasing()
Definition: vtkImageSincInterpolator.h:185
vtkImageSincInterpolator::FreeKernelLookupTable
virtual void FreeKernelLookupTable()
Free the kernel lookup tables.
vtkImageSincInterpolator::SetUseWindowParameter
void SetUseWindowParameter(int val)
Turn this on in order to use SetWindowParameter.
vtkImageSincInterpolator::IsSeparable
bool IsSeparable() override
Returns true if the interpolator supports weight precomputation.
vtkImageSincInterpolator::SetAntialiasing
void SetAntialiasing(int antialiasing)
Turn on antialiasing.
vtkImageSincInterpolator::SetBlurFactors
void SetBlurFactors(double x, double y, double z)
Blur the image by widening the windowed sinc kernel by the specified factors for the x,...
vtkImageSincInterpolator::InternalDeepCopy
void InternalDeepCopy(vtkAbstractImageInterpolator *obj) override
Copy the interpolator.
vtkImageSincInterpolator::~vtkImageSincInterpolator
~vtkImageSincInterpolator() override
vtkImageSincInterpolator::Renormalization
int Renormalization
Definition: vtkImageSincInterpolator.h:276
vtkImageSincInterpolator::SetWindowFunctionToCosine
void SetWindowFunctionToCosine()
The window function to use.
Definition: vtkImageSincInterpolator.h:101
vtkInterpolationInfo
Definition: vtkImageInterpolatorInternals.h:28
vtkImageSincInterpolator::AntialiasingOff
void AntialiasingOff()
Definition: vtkImageSincInterpolator.h:184
vtkImageSincInterpolator::SetWindowFunctionToNuttall
void SetWindowFunctionToNuttall()
The window function to use.
Definition: vtkImageSincInterpolator.h:107
vtkImageSincInterpolator::GetInterpolationFunc
void GetInterpolationFunc(void(**doublefunc)(vtkInterpolationInfo *, const double[3], double *)) override
Get the interpolation functions.
vtkImageSincInterpolator::vtkImageSincInterpolator
vtkImageSincInterpolator()
vtkImageSincInterpolator::FreePrecomputedWeights
void FreePrecomputedWeights(vtkInterpolationWeights *&weights) override
Free the precomputed weights.
VTK_BLACKMAN_NUTTALL4
#define VTK_BLACKMAN_NUTTALL4
Definition: vtkImageSincInterpolator.h:76
vtkImageSincInterpolator::PrecomputeWeightsForExtent
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...
vtkImageSincInterpolator::SetWindowFunctionToBlackmanHarris4
void SetWindowFunctionToBlackmanHarris4()
The window function to use.
Definition: vtkImageSincInterpolator.h:106
VTK_BLACKMAN_HARRIS3
#define VTK_BLACKMAN_HARRIS3
Definition: vtkImageSincInterpolator.h:72
vtkImageSincInterpolator::GetBlurFactors
void GetBlurFactors(double f[3])
Blur the image by widening the windowed sinc kernel by the specified factors for the x,...
Definition: vtkImageSincInterpolator.h:163
vtkImageSincInterpolator::SetWindowParameter
void SetWindowParameter(double parm)
Set the alpha parameter for the Kaiser window function.
vtkImageSincInterpolator::GetRenormalization
int GetRenormalization()
Definition: vtkImageSincInterpolator.h:197
VTK_COSINE_WINDOW
#define VTK_COSINE_WINDOW
Definition: vtkImageSincInterpolator.h:68
vtkImageSincInterpolator::BuildKernelLookupTable
virtual void BuildKernelLookupTable()
Build the lookup tables used for the interpolation.
vtkImageSincInterpolator::GetWindowFunctionAsString
virtual const char * GetWindowFunctionAsString()
The window function to use.
VTK_BLACKMAN_NUTTALL3
#define VTK_BLACKMAN_NUTTALL3
Definition: vtkImageSincInterpolator.h:75
vtkImageSincInterpolator::SetWindowHalfWidth
void SetWindowHalfWidth(int n)
Set the window half-width, this must be an integer between 1 and 16, with a default value of 3.
vtkImageSincInterpolator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageSincInterpolator::UseWindowParameterOff
void UseWindowParameterOff()
Definition: vtkImageSincInterpolator.h:130
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkImageSincInterpolator::GetUseWindowParameter
int GetUseWindowParameter()
Definition: vtkImageSincInterpolator.h:131
vtkImageSincInterpolator::GetWindowParameter
double GetWindowParameter()
Definition: vtkImageSincInterpolator.h:142
vtkImageSincInterpolator::SetWindowFunctionToHamming
void SetWindowFunctionToHamming()
The window function to use.
Definition: vtkImageSincInterpolator.h:103
vtkAbstractImageInterpolator.h
vtkImageSincInterpolator::GetWindowFunction
int GetWindowFunction()
The window function to use.
Definition: vtkImageSincInterpolator.h:110
VTK_LANCZOS_WINDOW
#define VTK_LANCZOS_WINDOW
Definition: vtkImageSincInterpolator.h:66
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkImageSincInterpolator::UseWindowParameter
int UseWindowParameter
Definition: vtkImageSincInterpolator.h:280
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
VTK_KAISER_WINDOW
#define VTK_KAISER_WINDOW
Definition: vtkImageSincInterpolator.h:67
VTK_HAMMING_WINDOW
#define VTK_HAMMING_WINDOW
Definition: vtkImageSincInterpolator.h:70
vtkImageSincInterpolator::SetWindowFunctionToBlackmanNuttall3
void SetWindowFunctionToBlackmanNuttall3()
The window function to use.
Definition: vtkImageSincInterpolator.h:108
vtkImageSincInterpolator::InternalUpdate
void InternalUpdate() override
Update the interpolator.
vtkImageSincInterpolator::SetWindowFunctionToBlackmanHarris3
void SetWindowFunctionToBlackmanHarris3()
The window function to use.
Definition: vtkImageSincInterpolator.h:105
vtkImageSincInterpolator::SetWindowFunctionToBlackman
void SetWindowFunctionToBlackman()
The window function to use.
Definition: vtkImageSincInterpolator.h:104
vtkImageSincInterpolator::SetWindowFunctionToBlackmanNuttall4
void SetWindowFunctionToBlackmanNuttall4()
The window function to use.
Definition: vtkImageSincInterpolator.h:109
vtkImageSincInterpolator::SetWindowFunctionToKaiser
void SetWindowFunctionToKaiser()
The window function to use.
Definition: vtkImageSincInterpolator.h:100
vtkImageSincInterpolator::SetRenormalization
void SetRenormalization(int renormalization)
Turn off renormalization.
vtkImageSincInterpolator::SetWindowFunction
virtual void SetWindowFunction(int mode)
The window function to use.
vtkImageSincInterpolator::SetWindowFunctionToLanczos
void SetWindowFunctionToLanczos()
The window function to use.
Definition: vtkImageSincInterpolator.h:99
vtkImageSincInterpolator::AntialiasingOn
void AntialiasingOn()
Definition: vtkImageSincInterpolator.h:183
vtkInterpolationWeights
Definition: vtkImageInterpolatorInternals.h:44
vtkImageSincInterpolator::ComputeSupportSize
void ComputeSupportSize(const double matrix[16], int support[3]) override
Get the support size for use in computing update extents.
vtkImageSincInterpolator::GetRowInterpolationFunc
void GetRowInterpolationFunc(void(**doublefunc)(vtkInterpolationWeights *, int, int, int, double *, int)) override
Get the row interpolation functions.
VTK_NUTTALL_WINDOW
#define VTK_NUTTALL_WINDOW
Definition: vtkImageSincInterpolator.h:74
vtkImageSincInterpolator::RenormalizationOff
void RenormalizationOff()
Definition: vtkImageSincInterpolator.h:196
vtkImageSincInterpolator::PrecomputeWeightsForExtent
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...
vtkImageSincInterpolator::WindowHalfWidth
int WindowHalfWidth
Definition: vtkImageSincInterpolator.h:272
vtkImageSincInterpolator::Antialiasing
int Antialiasing
Definition: vtkImageSincInterpolator.h:275
vtkImageSincInterpolator::New
static vtkImageSincInterpolator * New()
vtkX3D::mode
@ mode
Definition: vtkX3D.h:253
vtkX3D::extent
@ extent
Definition: vtkX3D.h:351
vtkImageSincInterpolator
perform sinc interpolation on images
Definition: vtkImageSincInterpolator.h:83
vtkAbstractImageInterpolator
interpolate data values from images
Definition: vtkAbstractImageInterpolator.h:47
vtkImageSincInterpolator::GetRowInterpolationFunc
void GetRowInterpolationFunc(void(**floatfunc)(vtkInterpolationWeights *, int, int, int, float *, int)) override
Get the row interpolation functions.
vtkImageSincInterpolator::SetWindowFunctionToHann
void SetWindowFunctionToHann()
The window function to use.
Definition: vtkImageSincInterpolator.h:102
vtkImageSincInterpolator::WindowParameter
double WindowParameter
Definition: vtkImageSincInterpolator.h:279
vtkImageSincInterpolator::RenormalizationOn
void RenormalizationOn()
Definition: vtkImageSincInterpolator.h:195
VTK_BLACKMAN_WINDOW
#define VTK_BLACKMAN_WINDOW
Definition: vtkImageSincInterpolator.h:71
vtkImageSincInterpolator::GetInterpolationFunc
void GetInterpolationFunc(void(**floatfunc)(vtkInterpolationInfo *, const float[3], float *)) override
Get the interpolation functions.
vtkImageSincInterpolator::GetBlurFactors
double * GetBlurFactors()
Blur the image by widening the windowed sinc kernel by the specified factors for the x,...
Definition: vtkImageSincInterpolator.h:169
vtkImageSincInterpolator::WindowFunction
int WindowFunction
Definition: vtkImageSincInterpolator.h:271