VTK
dox/Imaging/Fourier/vtkImageFourierFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkImageFourierFilter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00024 #ifndef __vtkImageFourierFilter_h
00025 #define __vtkImageFourierFilter_h
00026 
00027 
00028 #include "vtkImagingFourierModule.h" // For export macro
00029 #include "vtkImageDecomposeFilter.h"
00030 
00031 
00032 //BTX
00033 /*******************************************************************
00034                         COMPLEX number stuff
00035 *******************************************************************/
00036 
00037 
00038 typedef struct{
00039     double Real;
00040     double Imag;
00041   } vtkImageComplex;
00042 
00043 
00044 #define vtkImageComplexEuclidSet(C, R, I) \
00045   (C).Real = (R); \
00046   (C).Imag = (I)
00047 
00048 #define vtkImageComplexPolarSet(C, M, P) \
00049   (C).Real = (M)*cos(P); \
00050   (C).Imag = (M)*sin(P)
00051 
00052 #define vtkImageComplexPrint(C) \
00053   printf("(%.3f, %.3f)", (C).Real, (C).Imag)
00054 
00055 #define vtkImageComplexScale(cOut, S, cIn) \
00056   (cOut).Real = (cIn).Real * (S); \
00057   (cOut).Imag = (cIn).Imag * (S)
00058 
00059 #define vtkImageComplexConjugate(cIn, cOut) \
00060   (cOut).Imag = (cIn).Imag * -1.0;    \
00061   (cOut).Real = (cIn).Real
00062 
00063 #define vtkImageComplexAdd(C1, C2, cOut) \
00064   (cOut).Real = (C1).Real + (C2).Real; \
00065   (cOut).Imag = (C1).Imag + (C2).Imag
00066 
00067 #define vtkImageComplexSubtract(C1, C2, cOut) \
00068   (cOut).Real = (C1).Real - (C2).Real; \
00069   (cOut).Imag = (C1).Imag - (C2).Imag
00070 
00071 #define vtkImageComplexMultiply(C1, C2, cOut) \
00072 { \
00073   vtkImageComplex _vtkImageComplexMultiplyTemp; \
00074   _vtkImageComplexMultiplyTemp.Real = (C1).Real*(C2).Real-(C1).Imag*(C2).Imag;\
00075   _vtkImageComplexMultiplyTemp.Imag = (C1).Real*(C2).Imag+(C1).Imag*(C2).Real;\
00076   cOut = _vtkImageComplexMultiplyTemp; \
00077 }
00078 
00079 // This macro calculates exp(cIn) and puts the result in cOut
00080 #define vtkImageComplexExponential(cIn, cOut) \
00081 { \
00082   double tmp = exp(cIn.Real); \
00083   cOut.Real = tmp * cos(cIn.Imag); \
00084   cOut.Imag = tmp * sin(cIn.Imag); \
00085 }
00086 
00087 /******************* End of COMPLEX number stuff ********************/
00088 //ETX
00089 
00090 class VTKIMAGINGFOURIER_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
00091 {
00092 public:
00093   vtkTypeMacro(vtkImageFourierFilter,vtkImageDecomposeFilter);
00094 
00095 
00096   // public for templated functions of this object
00097   //BTX
00098 
00101   void ExecuteFft(vtkImageComplex *in, vtkImageComplex *out, int N);
00102 
00103 
00106   void ExecuteRfft(vtkImageComplex *in, vtkImageComplex *out, int N);
00107 
00108   //ETX
00109 
00110 protected:
00111   vtkImageFourierFilter() {};
00112   ~vtkImageFourierFilter() {};
00113 
00114   //BTX
00115   void ExecuteFftStep2(vtkImageComplex *p_in, vtkImageComplex *p_out,
00116                        int N, int bsize, int fb);
00117   void ExecuteFftStepN(vtkImageComplex *p_in, vtkImageComplex *p_out,
00118                        int N, int bsize, int n, int fb);
00119   void ExecuteFftForwardBackward(vtkImageComplex *in, vtkImageComplex *out,
00120                                  int N, int fb);
00121   //ETX
00122 private:
00123   vtkImageFourierFilter(const vtkImageFourierFilter&);  // Not implemented.
00124   void operator=(const vtkImageFourierFilter&);  // Not implemented.
00125 };
00126 
00127 
00128 
00129 #endif
00130 
00131 
00132 // VTK-HeaderTest-Exclude: vtkImageFourierFilter.h