VTK: Imaging/Fourier/vtkImageFourierFilter.h Source File

| VTK 9.3.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
16 #include "vtkImageDecomposeFilter.h"
17 #include "vtkImagingFourierModule.h" // For export macro
18
19 /*******************************************************************
20 COMPLEX number stuff
21 *******************************************************************/
22
23 VTK_ABI_NAMESPACE_BEGIN
24 struct vtkImageComplex_t
25 {
26 double Real;
27 double Imag;
28 };
29 using vtkImageComplex = struct vtkImageComplex_t;
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:
100 vtkTypeMacro(vtkImageFourierFilter, vtkImageDecomposeFilter);
101 void PrintSelf(ostream& os, vtkIndent indent) override;
102
103 // public for templated functions of this object
104
110 void ExecuteFft(vtkImageComplex* in, vtkImageComplex* out, int N);
111
117 void ExecuteRfft(vtkImageComplex* in, vtkImageComplex* out, int N);
118
119 protected:
120 vtkImageFourierFilter() = default;
121 ~vtkImageFourierFilter() override = default;
122
123 void ExecuteFftStep2(vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int fb);
124 void ExecuteFftStepN(
125 vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int n, int fb);
126 void ExecuteFftForwardBackward(vtkImageComplex* in, vtkImageComplex* out, int N, int fb);
127
131 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
132 vtkInformationVector* outputVector) override;
133
134 private:
135 vtkImageFourierFilter(const vtkImageFourierFilter&) = delete;
136 void operator=(const vtkImageFourierFilter&) = delete;
137 };
138
139 VTK_ABI_NAMESPACE_END
140 #endif
vtkImageDecomposeFilter
Filters that execute axes in series.
Definition: vtkImageDecomposeFilter.h:22
vtkImageFourierFilter
Superclass that implements complex numbers.
Definition: vtkImageFourierFilter.h:98
vtkImageFourierFilter::ExecuteRfft
void ExecuteRfft(vtkImageComplex *in, vtkImageComplex *out, int N)
This function calculates the whole fft of an array.
vtkImageFourierFilter::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Override to change extent splitting rules.
vtkImageFourierFilter::~vtkImageFourierFilter
~vtkImageFourierFilter() override=default
vtkImageFourierFilter::ExecuteFft
void ExecuteFft(vtkImageComplex *in, vtkImageComplex *out, int N)
This function calculates the whole fft of an array.
vtkImageFourierFilter::ExecuteFftStepN
void ExecuteFftStepN(vtkImageComplex *p_in, vtkImageComplex *p_out, int N, int bsize, int n, int fb)
vtkImageFourierFilter::ExecuteFftStep2
void ExecuteFftStep2(vtkImageComplex *p_in, vtkImageComplex *p_out, int N, int bsize, int fb)
vtkImageFourierFilter::vtkImageFourierFilter
vtkImageFourierFilter()=default
vtkImageFourierFilter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Construct an instance of vtkImageDecomposeFilter filter with default dimensionality 3.
vtkImageFourierFilter::ExecuteFftForwardBackward
void ExecuteFftForwardBackward(vtkImageComplex *in, vtkImageComplex *out, int N, int fb)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkImageComplex_t
Definition: vtkImageFourierFilter.h:25
vtkImageComplex_t::Imag
double Imag
Definition: vtkImageFourierFilter.h:27
vtkImageComplex_t::Real
double Real
Definition: vtkImageFourierFilter.h:26
vtkImageDecomposeFilter.h