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 =========================================================================*/
24 #ifndef vtkImageFourierFilter_h
25 #define vtkImageFourierFilter_h
26 
27 
28 #include "vtkImagingFourierModule.h" // For export macro
30 
31 
32 //BTX
33 /*******************************************************************
34  COMPLEX number stuff
35 *******************************************************************/
36 
37 
38 typedef struct{
39  double Real;
40  double Imag;
42 
43 
44 #define vtkImageComplexEuclidSet(C, R, I) \
45  (C).Real = (R); \
46  (C).Imag = (I)
47 
48 #define vtkImageComplexPolarSet(C, M, P) \
49  (C).Real = (M)*cos(P); \
50  (C).Imag = (M)*sin(P)
51 
52 #define vtkImageComplexPrint(C) \
53  printf("(%.3f, %.3f)", (C).Real, (C).Imag)
54 
55 #define vtkImageComplexScale(cOut, S, cIn) \
56  (cOut).Real = (cIn).Real * (S); \
57  (cOut).Imag = (cIn).Imag * (S)
58 
59 #define vtkImageComplexConjugate(cIn, cOut) \
60  (cOut).Imag = (cIn).Imag * -1.0; \
61  (cOut).Real = (cIn).Real
62 
63 #define vtkImageComplexAdd(C1, C2, cOut) \
64  (cOut).Real = (C1).Real + (C2).Real; \
65  (cOut).Imag = (C1).Imag + (C2).Imag
66 
67 #define vtkImageComplexSubtract(C1, C2, cOut) \
68  (cOut).Real = (C1).Real - (C2).Real; \
69  (cOut).Imag = (C1).Imag - (C2).Imag
70 
71 #define vtkImageComplexMultiply(C1, C2, cOut) \
72 { \
73  vtkImageComplex _vtkImageComplexMultiplyTemp; \
74  _vtkImageComplexMultiplyTemp.Real = (C1).Real*(C2).Real-(C1).Imag*(C2).Imag;\
75  _vtkImageComplexMultiplyTemp.Imag = (C1).Real*(C2).Imag+(C1).Imag*(C2).Real;\
76  cOut = _vtkImageComplexMultiplyTemp; \
77 }
78 
79 // This macro calculates exp(cIn) and puts the result in cOut
80 #define vtkImageComplexExponential(cIn, cOut) \
81 { \
82  double tmp = exp(cIn.Real); \
83  cOut.Real = tmp * cos(cIn.Imag); \
84  cOut.Imag = tmp * sin(cIn.Imag); \
85 }
86 
87 /******************* End of COMPLEX number stuff ********************/
88 //ETX
89 
91 {
92 public:
94 
95 
96  // public for templated functions of this object
97  //BTX
98 
101  void ExecuteFft(vtkImageComplex *in, vtkImageComplex *out, int N);
102 
103 
106  void ExecuteRfft(vtkImageComplex *in, vtkImageComplex *out, int N);
107 
108  //ETX
109 
110 protected:
113 
114  //BTX
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  //ETX
122 private:
123  vtkImageFourierFilter(const vtkImageFourierFilter&); // Not implemented.
124  void operator=(const vtkImageFourierFilter&); // Not implemented.
125 };
126 
127 
128 
129 #endif
130 
131 
132 // VTK-HeaderTest-Exclude: vtkImageFourierFilter.h
#define VTKIMAGINGFOURIER_EXPORT
Superclass that implements complex numbers.
Filters that execute axes in series.