VTK
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 =========================================================================*/
31 #ifndef vtkImageSincInterpolator_h
32 #define vtkImageSincInterpolator_h
33 
34 #include "vtkImagingCoreModule.h" // For export macro
36 
37 #define VTK_LANCZOS_WINDOW 0
38 #define VTK_KAISER_WINDOW 1
39 #define VTK_COSINE_WINDOW 2
40 #define VTK_HANN_WINDOW 3
41 #define VTK_HAMMING_WINDOW 4
42 #define VTK_BLACKMAN_WINDOW 5
43 #define VTK_BLACKMAN_HARRIS3 6
44 #define VTK_BLACKMAN_HARRIS4 7
45 #define VTK_NUTTALL_WINDOW 8
46 #define VTK_BLACKMAN_NUTTALL3 9
47 #define VTK_BLACKMAN_NUTTALL4 10
48 #define VTK_SINC_KERNEL_SIZE_MAX 32
49 
50 class vtkImageData;
52 
53 class VTKIMAGINGCORE_EXPORT vtkImageSincInterpolator :
55 {
56 public:
57  static vtkImageSincInterpolator *New();
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
62 
70  virtual void SetWindowFunction(int mode);
72  this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
74  this->SetWindowFunction(VTK_KAISER_WINDOW); }
76  this->SetWindowFunction(VTK_COSINE_WINDOW); }
78  this->SetWindowFunction(VTK_HANN_WINDOW); }
80  this->SetWindowFunction(VTK_HAMMING_WINDOW); }
82  this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
84  this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
86  this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
88  this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
90  this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
92  this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
93  int GetWindowFunction() { return this->WindowFunction; }
94  virtual const char *GetWindowFunctionAsString();
96 
104  void SetWindowHalfWidth(int n);
105  int GetWindowHalfWidth() { return this->WindowHalfWidth; }
106 
111  void SetUseWindowParameter(int val);
112  void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
113  void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
114  int GetUseWindowParameter() { return this->UseWindowParameter; }
115 
124  void SetWindowParameter(double parm);
125  double GetWindowParameter() { return this->WindowParameter; }
126 
133  void ComputeSupportSize(const double matrix[16], int support[3]) override;
134 
136 
144  void SetBlurFactors(double x, double y, double z);
145  void SetBlurFactors(const double f[3]) {
146  this->SetBlurFactors(f[0], f[1], f[2]); }
147  void GetBlurFactors(double f[3]) {
148  f[0] = this->BlurFactors[0];
149  f[1] = this->BlurFactors[1];
150  f[2] = this->BlurFactors[2]; }
151  double *GetBlurFactors() VTK_SIZEHINT(3) { return this->BlurFactors; }
153 
164  void SetAntialiasing(int antialiasing);
165  void AntialiasingOn() { this->SetAntialiasing(1); }
166  void AntialiasingOff() { this->SetAntialiasing(0); }
167  int GetAntialiasing() { return this->Antialiasing; }
168 
176  void SetRenormalization(int renormalization);
177  void RenormalizationOn() { this->SetRenormalization(1); }
178  void RenormalizationOff() { this->SetRenormalization(0); }
179  int GetRenormalization() { return this->Renormalization; }
180 
185  bool IsSeparable() override;
186 
188 
199  const double matrix[16], const int extent[6], int newExtent[6],
200  vtkInterpolationWeights *&weights) override;
202  const float matrix[16], const int extent[6], int newExtent[6],
203  vtkInterpolationWeights *&weights) override;
205 
209  void FreePrecomputedWeights(vtkInterpolationWeights *&weights) override;
210 
211 protected:
213  ~vtkImageSincInterpolator() override;
214 
218  void InternalUpdate() override;
219 
224 
226 
230  void (**doublefunc)(
231  vtkInterpolationInfo *, const double [3], double *)) override;
233  void (**floatfunc)(
234  vtkInterpolationInfo *, const float [3], float *)) override;
236 
238 
242  void (**doublefunc)(
243  vtkInterpolationWeights *, int, int, int, double *, int)) override;
245  void (**floatfunc)(
246  vtkInterpolationWeights *, int, int, int, float *, int)) override;
248 
252  virtual void BuildKernelLookupTable();
253 
257  virtual void FreeKernelLookupTable();
258 
261  float *KernelLookupTable[3];
262  int KernelSize[3];
265  double BlurFactors[3];
266  double LastBlurFactors[3];
269 
270 private:
272  void operator=(const vtkImageSincInterpolator&) = delete;
273 };
274 
275 #endif
VTK_BLACKMAN_HARRIS4
#define VTK_BLACKMAN_HARRIS4
Definition: vtkImageSincInterpolator.h:44
vtkImageSincInterpolator::UseWindowParameterOn
void UseWindowParameterOn()
Definition: vtkImageSincInterpolator.h:112
vtkImageSincInterpolator::GetWindowHalfWidth
int GetWindowHalfWidth()
Definition: vtkImageSincInterpolator.h:105
VTK_HANN_WINDOW
#define VTK_HANN_WINDOW
Definition: vtkImageSincInterpolator.h:40
vtkImageSincInterpolator::SetBlurFactors
void SetBlurFactors(const double f[3])
Definition: vtkImageSincInterpolator.h:145
vtkAbstractImageInterpolator::FreePrecomputedWeights
virtual void FreePrecomputedWeights(vtkInterpolationWeights *&weights)
Free the weights that were provided by PrecomputeWeightsForExtent.
vtkImageSincInterpolator::GetAntialiasing
int GetAntialiasing()
Definition: vtkImageSincInterpolator.h:167
vtkAbstractImageInterpolator::GetRowInterpolationFunc
virtual void GetRowInterpolationFunc(void(**doublefunc)(vtkInterpolationWeights *, int, int, int, double *, int))
Get the row interpolation functions.
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkImageSincInterpolator::Renormalization
int Renormalization
Definition: vtkImageSincInterpolator.h:264
vtkImageSincInterpolator::SetWindowFunctionToCosine
void SetWindowFunctionToCosine()
Definition: vtkImageSincInterpolator.h:75
vtkInterpolationInfo
Definition: vtkImageInterpolatorInternals.h:26
vtkImageSincInterpolator::AntialiasingOff
void AntialiasingOff()
Definition: vtkImageSincInterpolator.h:166
vtkImageSincInterpolator::SetWindowFunctionToNuttall
void SetWindowFunctionToNuttall()
Definition: vtkImageSincInterpolator.h:87
VTK_BLACKMAN_NUTTALL4
#define VTK_BLACKMAN_NUTTALL4
Definition: vtkImageSincInterpolator.h:47
vtkAbstractImageInterpolator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageSincInterpolator::SetWindowFunctionToBlackmanHarris4
void SetWindowFunctionToBlackmanHarris4()
Definition: vtkImageSincInterpolator.h:85
VTK_BLACKMAN_HARRIS3
#define VTK_BLACKMAN_HARRIS3
Definition: vtkImageSincInterpolator.h:43
vtkImageSincInterpolator::GetBlurFactors
void GetBlurFactors(double f[3])
Definition: vtkImageSincInterpolator.h:147
vtkImageSincInterpolator::GetRenormalization
int GetRenormalization()
Definition: vtkImageSincInterpolator.h:179
vtkAbstractImageInterpolator::InternalDeepCopy
virtual void InternalDeepCopy(vtkAbstractImageInterpolator *obj)=0
Subclass-specific copy.
VTK_COSINE_WINDOW
#define VTK_COSINE_WINDOW
Definition: vtkImageSincInterpolator.h:39
VTK_BLACKMAN_NUTTALL3
#define VTK_BLACKMAN_NUTTALL3
Definition: vtkImageSincInterpolator.h:46
vtkImageSincInterpolator::UseWindowParameterOff
void UseWindowParameterOff()
Definition: vtkImageSincInterpolator.h:113
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkImageSincInterpolator::GetUseWindowParameter
int GetUseWindowParameter()
Definition: vtkImageSincInterpolator.h:114
vtkImageSincInterpolator::GetWindowParameter
double GetWindowParameter()
Definition: vtkImageSincInterpolator.h:125
vtkImageSincInterpolator::SetWindowFunctionToHamming
void SetWindowFunctionToHamming()
Definition: vtkImageSincInterpolator.h:79
vtkAbstractImageInterpolator.h
vtkImageSincInterpolator::GetWindowFunction
int GetWindowFunction()
Definition: vtkImageSincInterpolator.h:93
vtkAbstractImageInterpolator::ComputeSupportSize
virtual void ComputeSupportSize(const double matrix[16], int support[3])=0
Get the support size for use in computing update extents.
VTK_LANCZOS_WINDOW
#define VTK_LANCZOS_WINDOW
Definition: vtkImageSincInterpolator.h:37
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkImageSincInterpolator::UseWindowParameter
int UseWindowParameter
Definition: vtkImageSincInterpolator.h:268
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
VTK_KAISER_WINDOW
#define VTK_KAISER_WINDOW
Definition: vtkImageSincInterpolator.h:38
VTK_HAMMING_WINDOW
#define VTK_HAMMING_WINDOW
Definition: vtkImageSincInterpolator.h:41
vtkAbstractImageInterpolator::InternalUpdate
virtual void InternalUpdate()=0
Subclass-specific updates.
vtkImageSincInterpolator::SetWindowFunctionToBlackmanNuttall3
void SetWindowFunctionToBlackmanNuttall3()
Definition: vtkImageSincInterpolator.h:89
vtkImageSincInterpolator::SetWindowFunctionToBlackmanHarris3
void SetWindowFunctionToBlackmanHarris3()
Definition: vtkImageSincInterpolator.h:83
vtkImageSincInterpolator::SetWindowFunctionToBlackman
void SetWindowFunctionToBlackman()
Definition: vtkImageSincInterpolator.h:81
vtkImageSincInterpolator::SetWindowFunctionToBlackmanNuttall4
void SetWindowFunctionToBlackmanNuttall4()
Definition: vtkImageSincInterpolator.h:91
vtkImageSincInterpolator::SetWindowFunctionToKaiser
void SetWindowFunctionToKaiser()
Definition: vtkImageSincInterpolator.h:73
vtkImageSincInterpolator::SetWindowFunctionToLanczos
void SetWindowFunctionToLanczos()
Definition: vtkImageSincInterpolator.h:71
vtkImageSincInterpolator::AntialiasingOn
void AntialiasingOn()
Definition: vtkImageSincInterpolator.h:165
vtkInterpolationWeights
Definition: vtkImageInterpolatorInternals.h:39
vtkAbstractImageInterpolator::IsSeparable
virtual bool IsSeparable()=0
True if the interpolation is separable, which means that the weights can be precomputed in order to a...
vtkAbstractImageInterpolator::GetInterpolationFunc
virtual void GetInterpolationFunc(void(**doublefunc)(vtkInterpolationInfo *, const double[3], double *))
Get the interpolation functions.
VTK_NUTTALL_WINDOW
#define VTK_NUTTALL_WINDOW
Definition: vtkImageSincInterpolator.h:45
vtkImageSincInterpolator::RenormalizationOff
void RenormalizationOff()
Definition: vtkImageSincInterpolator.h:178
vtkImageSincInterpolator::WindowHalfWidth
int WindowHalfWidth
Definition: vtkImageSincInterpolator.h:260
vtkImageSincInterpolator::Antialiasing
int Antialiasing
Definition: vtkImageSincInterpolator.h:263
vtkX3D::mode
Definition: vtkX3D.h:247
vtkX3D::extent
Definition: vtkX3D.h:345
vtkImageSincInterpolator
perform sinc interpolation on images
Definition: vtkImageSincInterpolator.h:53
vtkAbstractImageInterpolator
interpolate data values from images
Definition: vtkAbstractImageInterpolator.h:46
vtkAbstractImageInterpolator::PrecomputeWeightsForExtent
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...
vtkImageSincInterpolator::SetWindowFunctionToHann
void SetWindowFunctionToHann()
Definition: vtkImageSincInterpolator.h:77
vtkImageSincInterpolator::WindowParameter
double WindowParameter
Definition: vtkImageSincInterpolator.h:267
vtkImageSincInterpolator::RenormalizationOn
void RenormalizationOn()
Definition: vtkImageSincInterpolator.h:177
VTK_BLACKMAN_WINDOW
#define VTK_BLACKMAN_WINDOW
Definition: vtkImageSincInterpolator.h:42
vtkImageSincInterpolator::GetBlurFactors
double * GetBlurFactors()
Definition: vtkImageSincInterpolator.h:151
vtkImageSincInterpolator::WindowFunction
int WindowFunction
Definition: vtkImageSincInterpolator.h:259