Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkImageFourierFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkImageFourierFilter.h,v $
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 =========================================================================*/
00036 #ifndef __vtkImageFourierFilter_h
00037 #define __vtkImageFourierFilter_h
00038 
00039 
00040 #include "vtkImageDecomposeFilter.h"
00041 
00042 
00043 //BTX
00044 /*******************************************************************
00045                         COMPLEX number stuff
00046 *******************************************************************/
00047 
00048 
00049 typedef struct{
00050     double Real;
00051     double Imag;
00052   } vtkImageComplex;
00053 
00054 
00055 #define vtkImageComplexEuclidSet(C, R, I) \
00056   (C).Real = (R); \
00057   (C).Imag = (I)
00058 
00059 #define vtkImageComplexPolarSet(C, M, P) \
00060   (C).Real = (M)*cos(P); \
00061   (C).Imag = (M)*sin(P)
00062 
00063 #define vtkImageComplexPrint(C) \
00064   printf("(%.3f, %.3f)", (C).Real, (C).Imag)
00065 
00066 #define vtkImageComplexScale(cOut, S, cIn) \
00067   (cOut).Real = (cIn).Real * (S); \
00068   (cOut).Imag = (cIn).Imag * (S)
00069 
00070 #define vtkImageComplexConjugate(cIn, cOut) \
00071   (cOut).Imag = (cIn).Imag * -1.0;    \
00072   (cOut).Real = (cIn).Real
00073 
00074 #define vtkImageComplexAdd(C1, C2, cOut) \
00075   (cOut).Real = (C1).Real + (C2).Real; \
00076   (cOut).Imag = (C1).Imag + (C2).Imag
00077 
00078 #define vtkImageComplexSubtract(C1, C2, cOut) \
00079   (cOut).Real = (C1).Real - (C2).Real; \
00080   (cOut).Imag = (C1).Imag - (C2).Imag
00081 
00082 #define vtkImageComplexMultiply(C1, C2, cOut) \
00083 { \
00084   vtkImageComplex _vtkImageComplexMultiplyTemp; \
00085   _vtkImageComplexMultiplyTemp.Real = (C1).Real*(C2).Real-(C1).Imag*(C2).Imag;\
00086   _vtkImageComplexMultiplyTemp.Imag = (C1).Real*(C2).Imag+(C1).Imag*(C2).Real;\
00087   cOut = _vtkImageComplexMultiplyTemp; \
00088 }
00089 
00090 // This macro calculates exp(cIn) and puts the result in cOut 
00091 #define vtkImageComplexExponential(cIn, cOut) \
00092 { \
00093   double tmp = exp(cIn.Real); \
00094   cOut.Real = tmp * cos(cIn.Imag); \
00095   cOut.Imag = tmp * sin(cIn.Imag); \
00096 }
00097 
00098 /******************* End of COMPLEX number stuff ********************/
00099 //ETX
00100 
00101 class VTK_IMAGING_EXPORT vtkImageFourierFilter : public vtkImageDecomposeFilter
00102 {
00103 public:
00104   vtkTypeRevisionMacro(vtkImageFourierFilter,vtkImageDecomposeFilter);
00105   
00106   
00107   // public for templated functions of this object
00108   //BTX
00109 
00112   void ExecuteFft(vtkImageComplex *in, vtkImageComplex *out, int N);
00113 
00114 
00117   void ExecuteRfft(vtkImageComplex *in, vtkImageComplex *out, int N);
00118 
00119   //ETX
00120   
00121 protected:
00122   vtkImageFourierFilter() {};
00123   ~vtkImageFourierFilter() {};
00124 
00125   //BTX
00126   void ExecuteFftStep2(vtkImageComplex *p_in, vtkImageComplex *p_out, 
00127                        int N, int bsize, int fb);
00128   void ExecuteFftStepN(vtkImageComplex *p_in, vtkImageComplex *p_out,
00129                        int N, int bsize, int n, int fb);
00130   void ExecuteFftForwardBackward(vtkImageComplex *in, vtkImageComplex *out, 
00131                                  int N, int fb);
00132   //ETX
00133 private:
00134   vtkImageFourierFilter(const vtkImageFourierFilter&);  // Not implemented.
00135   void operator=(const vtkImageFourierFilter&);  // Not implemented.
00136 };
00137 
00138 
00139 
00140 #endif
00141 
00142