Imaging/vtkImageFourierFilter.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Imaging/vtkImageFourierFilter.h

Go to the documentation of this file.

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