VTK  9.3.20240418
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 
19 /*******************************************************************
20  COMPLEX number stuff
21 *******************************************************************/
22 
23 VTK_ABI_NAMESPACE_BEGIN
25 {
26  double Real;
27  double Imag;
28 };
30 
31 #define vtkImageComplexEuclidSet(C, R, I) \
32  do \
33  { \
34  (C).Real = (R); \
35  (C).Imag = (I); \
36  } while (false)
37 
38 #define vtkImageComplexPolarSet(C, M, P) \
39  do \
40  { \
41  (C).Real = (M)*cos(P); \
42  (C).Imag = (M)*sin(P); \
43  } while (false)
44 
45 #define vtkImageComplexPrint(C) \
46  do \
47  { \
48  printf("(%.3f, %.3f)", (C).Real, (C).Imag); \
49  } while (false)
50 
51 #define vtkImageComplexScale(cOut, S, cIn) \
52  do \
53  { \
54  (cOut).Real = (cIn).Real * (S); \
55  (cOut).Imag = (cIn).Imag * (S); \
56  } while (false)
57 
58 #define vtkImageComplexConjugate(cIn, cOut) \
59  do \
60  { \
61  (cOut).Imag = (cIn).Imag * -1.0; \
62  (cOut).Real = (cIn).Real; \
63  } while (false)
64 
65 #define vtkImageComplexAdd(C1, C2, cOut) \
66  do \
67  { \
68  (cOut).Real = (C1).Real + (C2).Real; \
69  (cOut).Imag = (C1).Imag + (C2).Imag; \
70  } while (false)
71 
72 #define vtkImageComplexSubtract(C1, C2, cOut) \
73  do \
74  { \
75  (cOut).Real = (C1).Real - (C2).Real; \
76  (cOut).Imag = (C1).Imag - (C2).Imag; \
77  } while (false)
78 
79 #define vtkImageComplexMultiply(C1, C2, cOut) \
80  { \
81  vtkImageComplex vtkImageComplex_tMultiplyTemp; \
82  vtkImageComplex_tMultiplyTemp.Real = (C1).Real * (C2).Real - (C1).Imag * (C2).Imag; \
83  vtkImageComplex_tMultiplyTemp.Imag = (C1).Real * (C2).Imag + (C1).Imag * (C2).Real; \
84  cOut = vtkImageComplex_tMultiplyTemp; \
85  }
86 
87 // This macro calculates exp(cIn) and puts the result in cOut
88 #define vtkImageComplexExponential(cIn, cOut) \
89  { \
90  double tmp = exp(cIn.Real); \
91  cOut.Real = tmp * cos(cIn.Imag); \
92  cOut.Imag = tmp * sin(cIn.Imag); \
93  }
94 
95 /******************* End of COMPLEX number stuff ********************/
96 
97 class VTKIMAGINGFOURIER_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
98 {
99 public:
101  void PrintSelf(ostream& os, vtkIndent indent) override;
102 
103  // public for templated functions of this object
104 
111 
118 
119 protected:
121  ~vtkImageFourierFilter() override = default;
122 
123  void ExecuteFftStep2(vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int fb);
125  vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int n, int fb);
127 
131  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
132  vtkInformationVector* outputVector) override;
133 
134 private:
136  void operator=(const vtkImageFourierFilter&) = delete;
137 };
138 
139 VTK_ABI_NAMESPACE_END
140 #endif
Filters that execute axes in series.
Superclass that implements complex numbers.
void ExecuteRfft(vtkImageComplex *in, vtkImageComplex *out, int N)
This function calculates the whole fft of an array.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Override to change extent splitting rules.
~vtkImageFourierFilter() override=default
void ExecuteFft(vtkImageComplex *in, vtkImageComplex *out, int N)
This function calculates the whole fft of an array.
void ExecuteFftStepN(vtkImageComplex *p_in, vtkImageComplex *p_out, int N, int bsize, int n, int fb)
void ExecuteFftStep2(vtkImageComplex *p_in, vtkImageComplex *p_out, int N, int bsize, int fb)
vtkImageFourierFilter()=default
void PrintSelf(ostream &os, vtkIndent indent) override
Construct an instance of vtkImageDecomposeFilter filter with default dimensionality 3.
void ExecuteFftForwardBackward(vtkImageComplex *in, vtkImageComplex *out, int N, int fb)
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.