00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00024 #ifndef __vtkImageFourierFilter_h
00025 #define __vtkImageFourierFilter_h
00026
00027
00028 #include "vtkImageDecomposeFilter.h"
00029
00030
00031
00032
00033
00034
00035
00036
00037 typedef struct{
00038 double Real;
00039 double Imag;
00040 } vtkImageComplex;
00041
00042
00043 #define vtkImageComplexEuclidSet(C, R, I) \
00044 (C).Real = (R); \
00045 (C).Imag = (I)
00046
00047 #define vtkImageComplexPolarSet(C, M, P) \
00048 (C).Real = (M)*cos(P); \
00049 (C).Imag = (M)*sin(P)
00050
00051 #define vtkImageComplexPrint(C) \
00052 printf("(%.3f, %.3f)", (C).Real, (C).Imag)
00053
00054 #define vtkImageComplexScale(cOut, S, cIn) \
00055 (cOut).Real = (cIn).Real * (S); \
00056 (cOut).Imag = (cIn).Imag * (S)
00057
00058 #define vtkImageComplexConjugate(cIn, cOut) \
00059 (cOut).Imag = (cIn).Imag * -1.0; \
00060 (cOut).Real = (cIn).Real
00061
00062 #define vtkImageComplexAdd(C1, C2, cOut) \
00063 (cOut).Real = (C1).Real + (C2).Real; \
00064 (cOut).Imag = (C1).Imag + (C2).Imag
00065
00066 #define vtkImageComplexSubtract(C1, C2, cOut) \
00067 (cOut).Real = (C1).Real - (C2).Real; \
00068 (cOut).Imag = (C1).Imag - (C2).Imag
00069
00070 #define vtkImageComplexMultiply(C1, C2, cOut) \
00071 { \
00072 vtkImageComplex _vtkImageComplexMultiplyTemp; \
00073 _vtkImageComplexMultiplyTemp.Real = (C1).Real*(C2).Real-(C1).Imag*(C2).Imag;\
00074 _vtkImageComplexMultiplyTemp.Imag = (C1).Real*(C2).Imag+(C1).Imag*(C2).Real;\
00075 cOut = _vtkImageComplexMultiplyTemp; \
00076 }
00077
00078
00079 #define vtkImageComplexExponential(cIn, cOut) \
00080 { \
00081 double tmp = exp(cIn.Real); \
00082 cOut.Real = tmp * cos(cIn.Imag); \
00083 cOut.Imag = tmp * sin(cIn.Imag); \
00084 }
00085
00086
00087
00088
00089 class VTK_IMAGING_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
00090 {
00091 public:
00092 vtkTypeMacro(vtkImageFourierFilter,vtkImageDecomposeFilter);
00093
00094
00095
00096
00097
00100 void ExecuteFft(vtkImageComplex *in, vtkImageComplex *out, int N);
00101
00102
00105 void ExecuteRfft(vtkImageComplex *in, vtkImageComplex *out, int N);
00106
00107
00108
00109 protected:
00110 vtkImageFourierFilter() {};
00111 ~vtkImageFourierFilter() {};
00112
00113
00114 void ExecuteFftStep2(vtkImageComplex *p_in, vtkImageComplex *p_out,
00115 int N, int bsize, int fb);
00116 void ExecuteFftStepN(vtkImageComplex *p_in, vtkImageComplex *p_out,
00117 int N, int bsize, int n, int fb);
00118 void ExecuteFftForwardBackward(vtkImageComplex *in, vtkImageComplex *out,
00119 int N, int fb);
00120
00121 private:
00122 vtkImageFourierFilter(const vtkImageFourierFilter&);
00123 void operator=(const vtkImageFourierFilter&);
00124 };
00125
00126
00127
00128 #endif
00129
00130