VTK  9.2.6
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 
36 {
37  double Real;
38  double Imag;
39 };
41 
42 #define vtkImageComplexEuclidSet(C, R, I) \
43  (C).Real = (R); \
44  (C).Imag = (I)
45 
46 #define vtkImageComplexPolarSet(C, M, P) \
47  (C).Real = (M)*cos(P); \
48  (C).Imag = (M)*sin(P)
49 
50 #define vtkImageComplexPrint(C) printf("(%.3f, %.3f)", (C).Real, (C).Imag)
51 
52 #define vtkImageComplexScale(cOut, S, cIn) \
53  (cOut).Real = (cIn).Real * (S); \
54  (cOut).Imag = (cIn).Imag * (S)
55 
56 #define vtkImageComplexConjugate(cIn, cOut) \
57  (cOut).Imag = (cIn).Imag * -1.0; \
58  (cOut).Real = (cIn).Real
59 
60 #define vtkImageComplexAdd(C1, C2, cOut) \
61  (cOut).Real = (C1).Real + (C2).Real; \
62  (cOut).Imag = (C1).Imag + (C2).Imag
63 
64 #define vtkImageComplexSubtract(C1, C2, cOut) \
65  (cOut).Real = (C1).Real - (C2).Real; \
66  (cOut).Imag = (C1).Imag - (C2).Imag
67 
68 #define vtkImageComplexMultiply(C1, C2, cOut) \
69  { \
70  vtkImageComplex vtkImageComplex_tMultiplyTemp; \
71  vtkImageComplex_tMultiplyTemp.Real = (C1).Real * (C2).Real - (C1).Imag * (C2).Imag; \
72  vtkImageComplex_tMultiplyTemp.Imag = (C1).Real * (C2).Imag + (C1).Imag * (C2).Real; \
73  cOut = vtkImageComplex_tMultiplyTemp; \
74  }
75 
76 // This macro calculates exp(cIn) and puts the result in cOut
77 #define vtkImageComplexExponential(cIn, cOut) \
78  { \
79  double tmp = exp(cIn.Real); \
80  cOut.Real = tmp * cos(cIn.Imag); \
81  cOut.Imag = tmp * sin(cIn.Imag); \
82  }
83 
84 /******************* End of COMPLEX number stuff ********************/
85 
86 class VTKIMAGINGFOURIER_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
87 {
88 public:
90  void PrintSelf(ostream& os, vtkIndent indent) override;
91 
92  // public for templated functions of this object
93 
99  void ExecuteFft(vtkImageComplex* in, vtkImageComplex* out, int N);
100 
106  void ExecuteRfft(vtkImageComplex* in, vtkImageComplex* out, int N);
107 
108 protected:
109  vtkImageFourierFilter() = default;
110  ~vtkImageFourierFilter() override = default;
111 
112  void ExecuteFftStep2(vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int fb);
113  void ExecuteFftStepN(
114  vtkImageComplex* p_in, vtkImageComplex* p_out, int N, int bsize, int n, int fb);
115  void ExecuteFftForwardBackward(vtkImageComplex* in, vtkImageComplex* out, int N, int fb);
116 
120  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
121  vtkInformationVector* outputVector) override;
122 
123 private:
125  void operator=(const vtkImageFourierFilter&) = delete;
126 };
127 
128 #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:39
Store zero or more vtkInformation instances.
Superclass that implements complex numbers.
Filters that execute axes in series.