00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkFFTWComplexConjugateToRealImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-12-21 19:13:11 $ 00007 Version: $Revision: 1.9 $ 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 #ifndef __itkFFTWComplexConjugateToRealImageFilter_h 00018 #define __itkFFTWComplexConjugateToRealImageFilter_h 00019 00020 #include "itkFFTComplexConjugateToRealImageFilter.h" 00021 00022 // 00023 // FFTWCommon defines proxy classes based on data types 00024 #include "itkFFTWCommon.h" 00025 00026 00027 namespace itk 00028 { 00029 00030 template <typename TPixel,unsigned int VDimension> 00031 class FFTWComplexConjugateToRealImageFilter : 00032 public FFTComplexConjugateToRealImageFilter<TPixel,VDimension> 00033 { 00034 public: 00035 typedef FFTWComplexConjugateToRealImageFilter Self; 00036 typedef FFTComplexConjugateToRealImageFilter<TPixel,VDimension> Superclass; 00037 typedef SmartPointer<Self> Pointer; 00038 typedef SmartPointer<const Self> ConstPointer; 00039 // 00040 // the proxy type is a wrapper for the fftw API 00041 // since the proxy is only defined over double and float, 00042 // trying to use any other pixel type is inoperative, as 00043 // is trying to use double if only the float FFTW version is 00044 // configured in, or float if only double is configured. 00045 // 00046 typedef typename fftw::Proxy<TPixel> FFTWProxyType; 00047 00049 typedef typename Superclass::TInputImageType TInputImageType; 00050 typedef typename Superclass::TOutputImageType TOutputImageType; 00051 00053 itkNewMacro(Self); 00054 00056 itkTypeMacro(FFTWComplexConjugateToRealImageFilter, 00057 FFTComplexConjugateToRealImageFilter); 00058 00060 typedef TInputImageType ImageType; 00061 typedef typename ImageType::SizeType ImageSizeType; 00062 00063 // 00064 // these should be defined in every FFT filter class 00065 virtual void GenerateData(); // generates output from input 00066 virtual bool FullMatrix(); 00067 protected: 00068 FFTWComplexConjugateToRealImageFilter() : m_PlanComputed(false), 00069 m_LastImageSize(0), 00070 m_InputBuffer(0), 00071 m_OutputBuffer(0) 00072 { 00073 } 00074 virtual ~FFTWComplexConjugateToRealImageFilter() 00075 { 00076 if(m_PlanComputed) 00077 { 00078 FFTWProxyType::DestroyPlan(m_Plan); 00079 delete [] m_InputBuffer; 00080 delete [] m_OutputBuffer; 00081 } 00082 } 00083 00084 private: 00085 FFTWComplexConjugateToRealImageFilter(const Self&); //purposely not implemented 00086 void operator=(const Self&); //purposely not implemented 00087 bool m_PlanComputed; 00088 typename FFTWProxyType::PlanType m_Plan; 00089 unsigned int m_LastImageSize; 00090 // local storage needed to keep fftw from scribbling on 00091 typename FFTWProxyType::ComplexType *m_InputBuffer; 00092 TPixel *m_OutputBuffer; 00093 }; 00094 00095 00096 } // namespace itk 00097 00098 #ifndef ITK_MANUAL_INSTANTIATION 00099 #include "itkFFTWComplexConjugateToRealImageFilter.txx" 00100 #endif 00101 00102 #endif //__itkFFTWComplexConjugateToRealImageFilter_h 00103