00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00053 #ifndef __vtkImageFourierFilter_h
00054 #define __vtkImageFourierFilter_h
00055
00056
00057 #include "vtkImageDecomposeFilter.h"
00058
00059
00060
00061
00062
00063
00064
00065
00066 typedef struct{
00067 double Real;
00068 double Imag;
00069 } vtkImageComplex;
00070
00071
00072 #define vtkImageComplexEuclidSet(C, R, I) \
00073 (C).Real = (R); \
00074 (C).Imag = (I)
00075
00076 #define vtkImageComplexPolarSet(C, M, P) \
00077 (C).Real = (M)*cos(P); \
00078 (C).Imag = (M)*sin(P)
00079
00080 #define vtkImageComplexPrint(C) \
00081 printf("(%.3f, %.3f)", (C).Real, (C).Imag)
00082
00083 #define vtkImageComplexScale(cOut, S, cIn) \
00084 (cOut).Real = (cIn).Real * (S); \
00085 (cOut).Imag = (cIn).Imag * (S)
00086
00087 #define vtkImageComplexConjugate(cIn, cOut) \
00088 (cOut).Imag = (cIn).Imag * -1.0; \
00089 (cOut).Real = (cIn).Real
00090
00091 #define vtkImageComplexAdd(C1, C2, cOut) \
00092 (cOut).Real = (C1).Real + (C2).Real; \
00093 (cOut).Imag = (C1).Imag + (C2).Imag
00094
00095 #define vtkImageComplexSubtract(C1, C2, cOut) \
00096 (cOut).Real = (C1).Real - (C2).Real; \
00097 (cOut).Imag = (C1).Imag - (C2).Imag
00098
00099 #define vtkImageComplexMultiply(C1, C2, cOut) \
00100 { \
00101 vtkImageComplex _vtkImageComplexMultiplyTemp; \
00102 _vtkImageComplexMultiplyTemp.Real = (C1).Real*(C2).Real-(C1).Imag*(C2).Imag;\
00103 _vtkImageComplexMultiplyTemp.Imag = (C1).Real*(C2).Imag+(C1).Imag*(C2).Real;\
00104 cOut = _vtkImageComplexMultiplyTemp; \
00105 }
00106
00107
00108 #define vtkImageComplexExponential(cIn, cOut) \
00109 { \
00110 float tmp = exp(cIn.Real); \
00111 cOut.Real = tmp * cos(cIn.Imag); \
00112 cOut.Imag = tmp * sin(cIn.Imag); \
00113 }
00114
00115
00116
00117
00118 class VTK_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
00119 {
00120 public:
00121 static vtkImageFourierFilter *New();
00122 vtkTypeMacro(vtkImageFourierFilter,vtkImageDecomposeFilter);
00123
00124
00125
00126
00129 void ExecuteFft(vtkImageComplex *in, vtkImageComplex *out, int N);
00130
00131
00134 void ExecuteRfft(vtkImageComplex *in, vtkImageComplex *out, int N);
00135
00136
00137
00138 protected:
00139 vtkImageFourierFilter() {};
00140 ~vtkImageFourierFilter() {};
00141 vtkImageFourierFilter(const vtkImageFourierFilter&) {};
00142 void operator=(const vtkImageFourierFilter&) {};
00143
00144
00145 void ExecuteFftStep2(vtkImageComplex *p_in, vtkImageComplex *p_out,
00146 int N, int bsize, int fb);
00147 void ExecuteFftStepN(vtkImageComplex *p_in, vtkImageComplex *p_out,
00148 int N, int bsize, int n, int fb);
00149 void ExecuteFftForwardBackward(vtkImageComplex *in, vtkImageComplex *out,
00150 int N, int fb);
00151
00152 };
00153
00154
00155
00156 #endif
00157
00158