VTK
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 
28 
29 #include "vtkImagingFourierModule.h" // For export macro
31 
32 /*******************************************************************
33  COMPLEX number stuff
34 *******************************************************************/
35 
36 
37 typedef struct{
38  double Real;
39  double Imag;
41 
42 
43 #define vtkImageComplexEuclidSet(C, R, I) \
44  (C).Real = (R); \
45  (C).Imag = (I)
46 
47 #define vtkImageComplexPolarSet(C, M, P) \
48  (C).Real = (M)*cos(P); \
49  (C).Imag = (M)*sin(P)
50 
51 #define vtkImageComplexPrint(C) \
52  printf("(%.3f, %.3f)", (C).Real, (C).Imag)
53 
54 #define vtkImageComplexScale(cOut, S, cIn) \
55  (cOut).Real = (cIn).Real * (S); \
56  (cOut).Imag = (cIn).Imag * (S)
57 
58 #define vtkImageComplexConjugate(cIn, cOut) \
59  (cOut).Imag = (cIn).Imag * -1.0; \
60  (cOut).Real = (cIn).Real
61 
62 #define vtkImageComplexAdd(C1, C2, cOut) \
63  (cOut).Real = (C1).Real + (C2).Real; \
64  (cOut).Imag = (C1).Imag + (C2).Imag
65 
66 #define vtkImageComplexSubtract(C1, C2, cOut) \
67  (cOut).Real = (C1).Real - (C2).Real; \
68  (cOut).Imag = (C1).Imag - (C2).Imag
69 
70 #define vtkImageComplexMultiply(C1, C2, cOut) \
71 { \
72  vtkImageComplex _vtkImageComplexMultiplyTemp; \
73  _vtkImageComplexMultiplyTemp.Real = (C1).Real*(C2).Real-(C1).Imag*(C2).Imag;\
74  _vtkImageComplexMultiplyTemp.Imag = (C1).Real*(C2).Imag+(C1).Imag*(C2).Real;\
75  cOut = _vtkImageComplexMultiplyTemp; \
76 }
77 
78 // This macro calculates exp(cIn) and puts the result in cOut
79 #define vtkImageComplexExponential(cIn, cOut) \
80 { \
81  double tmp = exp(cIn.Real); \
82  cOut.Real = tmp * cos(cIn.Imag); \
83  cOut.Imag = tmp * sin(cIn.Imag); \
84 }
85 
86 /******************* End of COMPLEX number stuff ********************/
87 
88 class VTKIMAGINGFOURIER_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
89 {
90 public:
92 
93 
94  // public for templated functions of this object
95 
101  void ExecuteFft(vtkImageComplex *in, vtkImageComplex *out, int N);
102 
103 
109  void ExecuteRfft(vtkImageComplex *in, vtkImageComplex *out, int N);
110 
111 protected:
114 
115  void ExecuteFftStep2(vtkImageComplex *p_in, vtkImageComplex *p_out,
116  int N, int bsize, int fb);
117  void ExecuteFftStepN(vtkImageComplex *p_in, vtkImageComplex *p_out,
118  int N, int bsize, int n, int fb);
119  void ExecuteFftForwardBackward(vtkImageComplex *in, vtkImageComplex *out,
120  int N, int fb);
121 
125  int RequestData(vtkInformation* request,
126  vtkInformationVector** inputVector,
127  vtkInformationVector* outputVector);
128 
129 private:
130  vtkImageFourierFilter(const vtkImageFourierFilter&) VTK_DELETE_FUNCTION;
131  void operator=(const vtkImageFourierFilter&) VTK_DELETE_FUNCTION;
132 };
133 
134 
135 
136 #endif
137 
138 
139 // VTK-HeaderTest-Exclude: vtkImageFourierFilter.h
Store vtkAlgorithm input/output information.
virtual 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.