Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkFFTWComplexToComplexImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFFTWComplexToComplexImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-07-03 18:41:16 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkFFTWComplexToComplexImageFilter_h
00019 #define __itkFFTWComplexToComplexImageFilter_h
00020 
00021 #if defined(USE_FFTWF) || defined(USE_FFTWD)
00022 
00023 #include "itkFFTComplexToComplexImageFilter.h"
00024 #include "fftw3.h"
00025 
00026 namespace itk
00027 {
00046 template <typename TPixel,unsigned int NDimension = 3 >
00047 class FFTWComplexToComplexImageFilter:
00048     public FFTComplexToComplexImageFilter< TPixel, NDimension >
00049 {
00050 //#error Invalid Type Listed for TPixel
00051 };
00052 
00053 template <unsigned int NDimension>
00054 class FFTWComplexToComplexImageFilter<float,NDimension>:
00055     public FFTComplexToComplexImageFilter<float,NDimension>
00056 {
00057 // TODO:  There should be compile time type checks so that
00058 //        if only USE_FFTWF is defined, then only floats are valid.
00059 //        and if USE_FFTWD is defined, then only doubles are valid.
00060 public:
00061   typedef float                                       TPixel;
00062   typedef FFTWComplexToComplexImageFilter             Self;
00063   typedef FFTComplexToComplexImageFilter<
00064     TPixel,NDimension>                                Superclass;
00065   typedef SmartPointer<Self>                          Pointer;
00066   typedef SmartPointer<const Self>                    ConstPointer;
00067 
00069   typedef typename Superclass::InputImageType         InputImageType;
00070   typedef typename Superclass::OutputImageType        OutputImageType;
00071 
00073   itkNewMacro(Self);
00074 
00076   itkTypeMacro(FFTWComplexToComplexImageFilter,
00077                FFTComplexToComplexImageFilter);
00078 
00080   typedef InputImageType                          ImageType;
00081   typedef typename ImageType::SizeType            ImageSizeType;
00082 
00083 
00084 protected:
00085 
00086   FFTWComplexToComplexImageFilter()
00087     {
00088     this->m_PlanComputed= false;
00089     }
00090 
00091   virtual ~FFTWComplexToComplexImageFilter()
00092     {
00093     if(m_PlanComputed)
00094       {
00095       fftwf_destroy_plan(m_Plan);
00096       }
00097     }
00098   
00102   virtual void GenerateData();  // generates output from input
00103   virtual bool FullMatrix();
00105 
00106 
00107   void PrintSelf(std::ostream& os, Indent indent) const;
00108 
00109 private:
00110   FFTWComplexToComplexImageFilter(const Self&); //purposely not implemented
00111   void operator=(const Self&); //purposely not implemented
00112 
00113   bool            m_PlanComputed;
00114   fftwf_plan      m_Plan;
00115 };
00116 
00117 
00118 template <unsigned int NDimension>
00119 class FFTWComplexToComplexImageFilter<double,NDimension>:
00120     public FFTComplexToComplexImageFilter<double,NDimension>
00121 {
00122 // TODO:  There should be compile time type checks so that
00123 //        if only USE_FFTWF is defined, then only floats are valid.
00124 //        and if USE_FFTWD is defined, then only doubles are valid.
00125 public:
00126   typedef double                                  TPixel;
00127   typedef FFTWComplexToComplexImageFilter         Self;
00128   typedef FFTComplexToComplexImageFilter<
00129     TPixel,NDimension>                            Superclass;
00130   typedef SmartPointer<Self>                      Pointer;
00131   typedef SmartPointer<const Self>                ConstPointer;
00132 
00134   typedef typename Superclass::InputImageType     InputImageType;
00135   typedef typename Superclass::OutputImageType    OutputImageType;
00136 
00138   itkNewMacro(Self);
00139 
00141   itkTypeMacro(FFTWComplexToComplexImageFilter,
00142                FFTComplexToComplexImageFilter);
00143 
00145   typedef InputImageType                          ImageType;
00146   typedef typename ImageType::SizeType            ImageSizeType;
00147 
00148 protected:
00149 
00150   FFTWComplexToComplexImageFilter()
00151     {
00152     m_PlanComputed= false;
00153     }
00154 
00155   virtual ~FFTWComplexToComplexImageFilter()
00156     {
00157     if( this->m_PlanComputed )
00158       {
00159       fftw_destroy_plan( this->m_Plan );
00160       }
00161     }
00162 
00163   void PrintSelf(std::ostream& os, Indent indent) const;
00164 
00165   //
00166   // these should be defined in every FFT filter class
00167   virtual void GenerateData();  // generates output from input
00168   virtual bool FullMatrix();
00169 
00170 private:
00171   FFTWComplexToComplexImageFilter(const Self&); //purposely not implemented
00172   void operator=(const Self&); //purposely not implemented
00173 
00174   bool                      m_PlanComputed;
00175   fftw_plan                 m_Plan;
00176 };
00177 
00178 } // namespace itk
00179 
00180 #ifndef ITK_MANUAL_INSTANTIATION
00181 #include "itkFFTWComplexToComplexImageFilter.txx"
00182 #endif
00183 
00184 #endif // defined(USE_FFTWF) || defined(USE_FFTWD)
00185 
00186 #endif //__itkFFTWComplexToComplexImageFilter_h
00187 

Generated at Wed Nov 5 21:25:04 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000