00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkComplexToRealImageAdaptor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2006-03-19 23:24:29 $ 00007 Version: $Revision: 1.3 $ 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 __itkComplexToRealImageAdaptor_h 00018 #define __itkComplexToRealImageAdaptor_h 00019 00020 #include <itkImageAdaptor.h> 00021 #include <complex> 00022 00023 namespace itk 00024 { 00025 00026 namespace Accessor { 00038 template <class TInternalType, class TExternalType > 00039 class ITK_EXPORT ComplexToRealPixelAccessor 00040 { 00041 public: 00044 typedef TExternalType ExternalType; 00045 00048 typedef TInternalType InternalType; 00049 00050 static inline void Set(TInternalType & output, const TExternalType & input) 00051 {output = (TInternalType)(input);} 00052 00053 static inline TExternalType Get( const TInternalType & input ) 00054 {return (TExternalType)(input.real());} 00055 }; 00056 00057 } // end namespace Accessor 00058 00068 template <class TImage, class TOutputPixelType> 00069 class ITK_EXPORT ComplexToRealImageAdaptor : public 00070 ImageAdaptor<TImage, 00071 Accessor::ComplexToRealPixelAccessor< 00072 typename TImage::PixelType, 00073 TOutputPixelType> > 00074 { 00075 public: 00077 typedef ComplexToRealImageAdaptor Self; 00078 typedef ImageAdaptor<TImage, Accessor::ComplexToRealPixelAccessor< 00079 typename TImage::PixelType, 00080 TOutputPixelType> > Superclass; 00081 typedef SmartPointer<Self> Pointer; 00082 typedef SmartPointer<const Self> ConstPointer; 00083 00085 itkNewMacro(Self); 00086 00088 itkTypeMacro( ComplexToRealImageAdaptor, ImageAdaptor ); 00089 00090 protected: 00091 ComplexToRealImageAdaptor() {} 00092 virtual ~ComplexToRealImageAdaptor() {} 00093 00094 private: 00095 ComplexToRealImageAdaptor(const Self&); //purposely not implemented 00096 void operator=(const Self&); //purposely not implemented 00097 00098 }; 00099 00100 } // end namespace itk 00101 00102 #endif 00103