VTK  9.0.1
vtkImageFourierFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageFourierFilter.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 =========================================================================*/
25 #ifndef vtkImageFourierFilter_h
26 #define vtkImageFourierFilter_h
27 
29 #include "vtkImagingFourierModule.h" // For export macro
30 
31 /*******************************************************************
32  COMPLEX number stuff
33 *******************************************************************/
34 
35 typedef struct
36 {
37  double Real;
38  double Imag;
40 
41 #define vtkImageComplexEuclidSet(C, R, I) \
42  (C).Real = (R); \
43  (C).Imag = (I)
44 
45 #define vtkImageComplexPolarSet(C, M, P) \
46  (C).Real = (M)*cos(P); \
47  (C).Imag = (M)*sin(P)
48 
49 #define vtkImageComplexPrint(C) printf("(%.3f, %.3f)", (C).Real, (C).Imag)
50 
51 #define vtkImageComplexScale(cOut, S, cIn) \
52  (cOut).Real = (cIn).Real * (S); \
53  (cOut).Imag = (cIn).Imag * (S)
54 
55 #define vtkImageComplexConjugate(cIn, cOut) \
56  (cOut).Imag = (cIn).Imag * -1.0; \
57  (cOut).Real = (cIn).Real
58 
59 #define vtkImageComplexAdd(C1, C2, cOut) \
60  (cOut).Real = (C1).Real + (C2).Real; \
61  (cOut).Imag = (C1).Imag + (C2).Imag
62 
63 #define vtkImageComplexSubtract(C1, C2, cOut) \
64  (cOut).Real = (C1).Real - (C2).Real; \
65  (cOut).Imag = (C1).Imag - (C2).Imag
66 
67 #define vtkImageComplexMultiply(C1, C2, cOut) \
68  { \
69  vtkImageComplex _vtkImageComplexMultiplyTemp; \
70  _vtkImageComplexMultiplyTemp.Real = (C1).Real * (C2).Real - (C1).Imag * (C2).Imag; \
71  _vtkImageComplexMultiplyTemp.Imag = (C1).Real * (C2).Imag + (C1).Imag * (C2).Real; \
72  cOut = _vtkImageComplexMultiplyTemp; \
73  }
74 
75 // This macro calculates exp(cIn) and puts the result in cOut
76 #define vtkImageComplexExponential(cIn, cOut) \
77  { \
78  double tmp = exp(cIn.Real); \
79  cOut.Real = tmp * cos(cIn.Imag); \
80  cOut.Imag = tmp * sin(cIn.Imag); \
81  }
82 
83 /******************* End of COMPLEX number stuff ********************/
84 
85 class VTKIMAGINGFOURIER_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
86 {
87 public:
89 
90  // public for templated functions of this object
91 
97  void ExecuteFft(vtkImageComplex* in, vtkImageComplex* out, int N);
98 
104  void ExecuteRfft(vtkImageComplex* in, vtkImageComplex* out, int N);
105 
106 protected:
109 
110  void ExecuteFftStep2(vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int fb);
111  void ExecuteFftStepN(
112  vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int n, int fb);
113  void ExecuteFftForwardBackward(vtkImageComplex* in, vtkImageComplex* out, int N, int fb);
114 
118  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
119  vtkInformationVector* outputVector) override;
120 
121 private:
123  void operator=(const vtkImageFourierFilter&) = delete;
124 };
125 
126 #endif
127 
128 // VTK-HeaderTest-Exclude: vtkImageFourierFilter.h
Store vtkAlgorithm input/output information.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
Store zero or more vtkInformation instances.
Superclass that implements complex numbers.
Filters that execute axes in series.