VTK  9.7.1
vtkImageFourierFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
13 #ifndef vtkImageFourierFilter_h
14 #define vtkImageFourierFilter_h
15 
17 #include "vtkImagingFourierModule.h" // For export macro
18 #include "vtkStringFormatter.h" // For vtk::print
19 
20 /*******************************************************************
21  COMPLEX number stuff
22 *******************************************************************/
23 
24 VTK_ABI_NAMESPACE_BEGIN
26 {
27  double Real;
28  double Imag;
29 };
31 
32 #define vtkImageComplexEuclidSet(C, R, I) \
33  do \
34  { \
35  (C).Real = (R); \
36  (C).Imag = (I); \
37  } while (false)
38 
39 #define vtkImageComplexPolarSet(C, M, P) \
40  do \
41  { \
42  (C).Real = (M) * cos(P); \
43  (C).Imag = (M) * sin(P); \
44  } while (false)
45 
46 #define vtkImageComplexPrint(C) \
47  do \
48  { \
49  vtk::print("({:.3f}, {:.3f})", (C).Real, (C).Imag); \
50  } while (false)
51 
52 #define vtkImageComplexScale(cOut, S, cIn) \
53  do \
54  { \
55  (cOut).Real = (cIn).Real * (S); \
56  (cOut).Imag = (cIn).Imag * (S); \
57  } while (false)
58 
59 #define vtkImageComplexConjugate(cIn, cOut) \
60  do \
61  { \
62  (cOut).Imag = (cIn).Imag * -1.0; \
63  (cOut).Real = (cIn).Real; \
64  } while (false)
65 
66 #define vtkImageComplexAdd(C1, C2, cOut) \
67  do \
68  { \
69  (cOut).Real = (C1).Real + (C2).Real; \
70  (cOut).Imag = (C1).Imag + (C2).Imag; \
71  } while (false)
72 
73 #define vtkImageComplexSubtract(C1, C2, cOut) \
74  do \
75  { \
76  (cOut).Real = (C1).Real - (C2).Real; \
77  (cOut).Imag = (C1).Imag - (C2).Imag; \
78  } while (false)
79 
80 #define vtkImageComplexMultiply(C1, C2, cOut) \
81  do \
82  { \
83  vtkImageComplex vtkImageComplex_tMultiplyTemp; \
84  vtkImageComplex_tMultiplyTemp.Real = (C1).Real * (C2).Real - (C1).Imag * (C2).Imag; \
85  vtkImageComplex_tMultiplyTemp.Imag = (C1).Real * (C2).Imag + (C1).Imag * (C2).Real; \
86  cOut = vtkImageComplex_tMultiplyTemp; \
87  } while (false)
88 
89 // This macro calculates exp(cIn) and puts the result in cOut
90 #define vtkImageComplexExponential(cIn, cOut) \
91  do \
92  { \
93  double tmp = exp(cIn.Real); \
94  cOut.Real = tmp * cos(cIn.Imag); \
95  cOut.Imag = tmp * sin(cIn.Imag); \
96  } while (false)
97 
98 /******************* End of COMPLEX number stuff ********************/
99 
100 class VTKIMAGINGFOURIER_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
101 {
102 public:
104  void PrintSelf(ostream& os, vtkIndent indent) override;
105 
106  // public for templated functions of this object
107 
113  void ExecuteFft(vtkImageComplex* in, vtkImageComplex* out, int N);
114 
120  void ExecuteRfft(vtkImageComplex* in, vtkImageComplex* out, int N);
121 
122 protected:
123  vtkImageFourierFilter() = default;
124  ~vtkImageFourierFilter() override = default;
125 
126  void ExecuteFftStep2(vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int fb);
127  void ExecuteFftStepN(
128  vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int n, int fb);
129  void ExecuteFftForwardBackward(vtkImageComplex* in, vtkImageComplex* out, int N, int fb);
130 
134  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
135  vtkInformationVector* outputVector) override;
136 
137 private:
139  void operator=(const vtkImageFourierFilter&) = delete;
140 };
141 
142 VTK_ABI_NAMESPACE_END
143 #endif
Store vtkAlgorithm input/output information.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void PrintSelf(ostream &os, vtkIndent indent) override
Construct an instance of vtkImageDecomposeFilter filter with default dimensionality 3...
a simple class to control print indentation
Definition: vtkIndent.h:28
Store zero or more vtkInformation instances.
Superclass that implements complex numbers.
Optimized C++ utilities for formatting values to strings and files.
Filters that execute axes in series.