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 =========================================================================*/
37 #ifndef vtkImageSincInterpolator_h
38 #define vtkImageSincInterpolator_h
39 
40 #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 :
61 {
62 public:
65  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
66 
68 
76  virtual void SetWindowFunction(int mode);
78  this->SetWindowFunction(VTK_LANCZOS_WINDOW); }
80  this->SetWindowFunction(VTK_KAISER_WINDOW); }
82  this->SetWindowFunction(VTK_COSINE_WINDOW); }
84  this->SetWindowFunction(VTK_HANN_WINDOW); }
86  this->SetWindowFunction(VTK_HAMMING_WINDOW); }
88  this->SetWindowFunction(VTK_BLACKMAN_WINDOW); }
90  this->SetWindowFunction(VTK_BLACKMAN_HARRIS3); }
92  this->SetWindowFunction(VTK_BLACKMAN_HARRIS4); }
94  this->SetWindowFunction(VTK_NUTTALL_WINDOW); }
96  this->SetWindowFunction(VTK_BLACKMAN_NUTTALL3); }
98  this->SetWindowFunction(VTK_BLACKMAN_NUTTALL4); }
99  int GetWindowFunction() { return this->WindowFunction; }
100  virtual const char *GetWindowFunctionAsString();
102 
110  void SetWindowHalfWidth(int n);
111  int GetWindowHalfWidth() { return this->WindowHalfWidth; }
112 
117  void SetUseWindowParameter(int val);
118  void UseWindowParameterOn() { this->SetUseWindowParameter(1); }
119  void UseWindowParameterOff() { this->SetUseWindowParameter(0); }
120  int GetUseWindowParameter() { return this->UseWindowParameter; }
121 
130  void SetWindowParameter(double parm);
131  double GetWindowParameter() { return this->WindowParameter; }
132 
139  virtual void ComputeSupportSize(const double matrix[16], int support[3]);
140 
142 
150  void SetBlurFactors(double x, double y, double z);
151  void SetBlurFactors(const double f[3]) {
152  this->SetBlurFactors(f[0], f[1], f[2]); }
153  void GetBlurFactors(double f[3]) {
154  f[0] = this->BlurFactors[0];
155  f[1] = this->BlurFactors[1];
156  f[2] = this->BlurFactors[2]; }
157  double *GetBlurFactors() { return this->BlurFactors; }
159 
170  void SetAntialiasing(int antialiasing);
171  void AntialiasingOn() { this->SetAntialiasing(1); }
172  void AntialiasingOff() { this->SetAntialiasing(0); }
173  int GetAntialiasing() { return this->Antialiasing; }
174 
182  void SetRenormalization(int renormalization);
183  void RenormalizationOn() { this->SetRenormalization(1); }
184  void RenormalizationOff() { this->SetRenormalization(0); }
185  int GetRenormalization() { return this->Renormalization; }
186 
191  virtual bool IsSeparable();
192 
194 
205  const double matrix[16], const int extent[6], int newExtent[6],
206  vtkInterpolationWeights *&weights);
208  const float matrix[16], const int extent[6], int newExtent[6],
209  vtkInterpolationWeights *&weights);
211 
216 
217 protected:
220 
224  virtual void InternalUpdate();
225 
230 
232 
235  virtual void GetInterpolationFunc(
236  void (**doublefunc)(
237  vtkInterpolationInfo *, const double [3], double *));
238  virtual void GetInterpolationFunc(
239  void (**floatfunc)(
240  vtkInterpolationInfo *, const float [3], float *));
242 
244 
248  void (**doublefunc)(
249  vtkInterpolationWeights *, int, int, int, double *, int));
251  void (**floatfunc)(
252  vtkInterpolationWeights *, int, int, int, float *, int));
254 
258  virtual void BuildKernelLookupTable();
259 
263  virtual void FreeKernelLookupTable();
264 
267  float *KernelLookupTable[3];
268  int KernelSize[3];
271  double BlurFactors[3];
272  double LastBlurFactors[3];
275 
276 private:
277  vtkImageSincInterpolator(const vtkImageSincInterpolator&) VTK_DELETE_FUNCTION;
278  void operator=(const vtkImageSincInterpolator&) VTK_DELETE_FUNCTION;
279 };
280 
281 #endif
VTK_BLACKMAN_HARRIS4
#define VTK_BLACKMAN_HARRIS4
Definition: vtkImageSincInterpolator.h:50
vtkImageSincInterpolator::ComputeSupportSize
virtual void ComputeSupportSize(const double matrix[16], int support[3])
Get the support size for use in computing update extents.
vtkImageSincInterpolator::UseWindowParameterOn
void UseWindowParameterOn()
Definition: vtkImageSincInterpolator.h:118
vtkImageSincInterpolator::GetWindowHalfWidth
int GetWindowHalfWidth()
Definition: vtkImageSincInterpolator.h:111
vtkImageSincInterpolator::FreePrecomputedWeights
virtual void FreePrecomputedWeights(vtkInterpolationWeights *&weights)
Free the precomputed weights.
VTK_HANN_WINDOW
#define VTK_HANN_WINDOW
Definition: vtkImageSincInterpolator.h:46
vtkImageSincInterpolator::SetBlurFactors
void SetBlurFactors(const double f[3])
Definition: vtkImageSincInterpolator.h:151
vtkImageSincInterpolator::~vtkImageSincInterpolator
~vtkImageSincInterpolator()
vtkImageSincInterpolator::GetAntialiasing
int GetAntialiasing()
Definition: vtkImageSincInterpolator.h:173
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::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
virtual void InternalDeepCopy(vtkAbstractImageInterpolator *obj)
Copy the interpolator.
vtkImageSincInterpolator::InternalUpdate
virtual void InternalUpdate()
Update the interpolator.
vtkImageSincInterpolator::PrecomputeWeightsForExtent
virtual void PrecomputeWeightsForExtent(const float matrix[16], const int extent[6], int newExtent[6], vtkInterpolationWeights *&weights)
vtkImageSincInterpolator::Renormalization
int Renormalization
Definition: vtkImageSincInterpolator.h:270
vtkImageSincInterpolator::SetWindowFunctionToCosine
void SetWindowFunctionToCosine()
Definition: vtkImageSincInterpolator.h:81
vtkInterpolationInfo
Definition: vtkImageInterpolatorInternals.h:27
vtkImageSincInterpolator::AntialiasingOff
void AntialiasingOff()
Definition: vtkImageSincInterpolator.h:172
vtkImageSincInterpolator::SetWindowFunctionToNuttall
void SetWindowFunctionToNuttall()
Definition: vtkImageSincInterpolator.h:93
vtkImageSincInterpolator::GetInterpolationFunc
virtual void GetInterpolationFunc(void(**floatfunc)(vtkInterpolationInfo *, const float[3], float *))
vtkImageSincInterpolator::vtkImageSincInterpolator
vtkImageSincInterpolator()
VTK_BLACKMAN_NUTTALL4
#define VTK_BLACKMAN_NUTTALL4
Definition: vtkImageSincInterpolator.h:53
vtkImageSincInterpolator::SetWindowFunctionToBlackmanHarris4
void SetWindowFunctionToBlackmanHarris4()
Definition: vtkImageSincInterpolator.h:91
VTK_BLACKMAN_HARRIS3
#define VTK_BLACKMAN_HARRIS3
Definition: vtkImageSincInterpolator.h:49
vtkImageSincInterpolator::GetBlurFactors
void GetBlurFactors(double f[3])
Definition: vtkImageSincInterpolator.h:153
vtkImageSincInterpolator::SetWindowParameter
void SetWindowParameter(double parm)
Set the alpha parameter for the Kaiser window function.
vtkImageSincInterpolator::GetRenormalization
int GetRenormalization()
Definition: vtkImageSincInterpolator.h:185
VTK_COSINE_WINDOW
#define VTK_COSINE_WINDOW
Definition: vtkImageSincInterpolator.h:45
vtkImageSincInterpolator::BuildKernelLookupTable
virtual void BuildKernelLookupTable()
Build the lookup tables used for the interpolation.
vtkImageSincInterpolator::GetInterpolationFunc
virtual void GetInterpolationFunc(void(**doublefunc)(vtkInterpolationInfo *, const double[3], double *))
Get the interpolation functions.
vtkImageSincInterpolator::GetWindowFunctionAsString
virtual const char * GetWindowFunctionAsString()
VTK_BLACKMAN_NUTTALL3
#define VTK_BLACKMAN_NUTTALL3
Definition: vtkImageSincInterpolator.h:52
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:119
vtkImageSincInterpolator::GetUseWindowParameter
int GetUseWindowParameter()
Definition: vtkImageSincInterpolator.h:120
vtkImageSincInterpolator::GetWindowParameter
double GetWindowParameter()
Definition: vtkImageSincInterpolator.h:131
vtkImageSincInterpolator::SetWindowFunctionToHamming
void SetWindowFunctionToHamming()
Definition: vtkImageSincInterpolator.h:85
vtkAbstractImageInterpolator.h
vtkImageSincInterpolator::GetWindowFunction
int GetWindowFunction()
Definition: vtkImageSincInterpolator.h:99
VTK_LANCZOS_WINDOW
#define VTK_LANCZOS_WINDOW
Definition: vtkImageSincInterpolator.h:43
vtkImageSincInterpolator::IsSeparable
virtual bool IsSeparable()
Returns true if the interpolator supports weight precomputation.
vtkImageSincInterpolator::GetRowInterpolationFunc
virtual void GetRowInterpolationFunc(void(**doublefunc)(vtkInterpolationWeights *, int, int, int, double *, int))
Get the row interpolation functions.
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkImageSincInterpolator::UseWindowParameter
int UseWindowParameter
Definition: vtkImageSincInterpolator.h:274
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
VTK_KAISER_WINDOW
#define VTK_KAISER_WINDOW
Definition: vtkImageSincInterpolator.h:44
vtkImageSincInterpolator::PrecomputeWeightsForExtent
virtual void PrecomputeWeightsForExtent(const double matrix[16], const int extent[6], int newExtent[6], vtkInterpolationWeights *&weights)
If the data is going to be sampled on a regular grid, then the interpolation weights can be precomput...
VTK_HAMMING_WINDOW
#define VTK_HAMMING_WINDOW
Definition: vtkImageSincInterpolator.h:47
vtkImageSincInterpolator::SetWindowFunctionToBlackmanNuttall3
void SetWindowFunctionToBlackmanNuttall3()
Definition: vtkImageSincInterpolator.h:95
vtkImageSincInterpolator::SetWindowFunctionToBlackmanHarris3
void SetWindowFunctionToBlackmanHarris3()
Definition: vtkImageSincInterpolator.h:89
vtkImageSincInterpolator::SetWindowFunctionToBlackman
void SetWindowFunctionToBlackman()
Definition: vtkImageSincInterpolator.h:87
vtkImageSincInterpolator::SetWindowFunctionToBlackmanNuttall4
void SetWindowFunctionToBlackmanNuttall4()
Definition: vtkImageSincInterpolator.h:97
vtkImageSincInterpolator::SetWindowFunctionToKaiser
void SetWindowFunctionToKaiser()
Definition: vtkImageSincInterpolator.h:79
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()
Definition: vtkImageSincInterpolator.h:77
vtkImageSincInterpolator::AntialiasingOn
void AntialiasingOn()
Definition: vtkImageSincInterpolator.h:171
vtkInterpolationWeights
Definition: vtkImageInterpolatorInternals.h:40
vtkImageSincInterpolator::GetRowInterpolationFunc
virtual void GetRowInterpolationFunc(void(**floatfunc)(vtkInterpolationWeights *, int, int, int, float *, int))
VTK_NUTTALL_WINDOW
#define VTK_NUTTALL_WINDOW
Definition: vtkImageSincInterpolator.h:51
vtkImageSincInterpolator::RenormalizationOff
void RenormalizationOff()
Definition: vtkImageSincInterpolator.h:184
vtkImageSincInterpolator::WindowHalfWidth
int WindowHalfWidth
Definition: vtkImageSincInterpolator.h:266
vtkImageSincInterpolator::Antialiasing
int Antialiasing
Definition: vtkImageSincInterpolator.h:269
vtkImageSincInterpolator::New
static vtkImageSincInterpolator * New()
vtkX3D::mode
@ mode
Definition: vtkX3D.h:247
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
vtkImageSincInterpolator
perform sinc interpolation on images
Definition: vtkImageSincInterpolator.h:61
vtkAbstractImageInterpolator
interpolate data values from images
Definition: vtkAbstractImageInterpolator.h:50
vtkImageSincInterpolator::SetWindowFunctionToHann
void SetWindowFunctionToHann()
Definition: vtkImageSincInterpolator.h:83
vtkImageSincInterpolator::WindowParameter
double WindowParameter
Definition: vtkImageSincInterpolator.h:273
vtkImageSincInterpolator::RenormalizationOn
void RenormalizationOn()
Definition: vtkImageSincInterpolator.h:183
VTK_BLACKMAN_WINDOW
#define VTK_BLACKMAN_WINDOW
Definition: vtkImageSincInterpolator.h:48
vtkImageSincInterpolator::GetBlurFactors
double * GetBlurFactors()
Definition: vtkImageSincInterpolator.h:157
vtkImageSincInterpolator::WindowFunction
int WindowFunction
Definition: vtkImageSincInterpolator.h:265