00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSqrtImageAdaptor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-09-19 19:56:20 $ 00007 Version: $Revision: 1.14 $ 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 __itkSqrtImageAdaptor_h 00018 #define __itkSqrtImageAdaptor_h 00019 00020 #include <itkImageAdaptor.h> 00021 #include "vnl/vnl_math.h" 00022 00023 namespace itk 00024 { 00025 00026 namespace Accessor { 00037 template <class TInternalType, class TExternalType > 00038 class ITK_EXPORT SqrtPixelAccessor 00039 { 00040 public: 00043 typedef TExternalType ExternalType; 00044 00047 typedef TInternalType InternalType; 00048 00049 static inline void Set(TInternalType & output, const TExternalType & input) 00050 {output = (TInternalType)vcl_sqrt((double)input);} 00051 00052 static inline TExternalType Get( const TInternalType & input ) 00053 {return (TExternalType)vcl_sqrt((double)input);} 00054 }; 00055 00056 } // end namespace Accessor 00057 00066 template <class TImage, class TOutputPixelType> 00067 class ITK_EXPORT SqrtImageAdaptor : public 00068 ImageAdaptor<TImage, Accessor::SqrtPixelAccessor< 00069 typename TImage::PixelType, 00070 TOutputPixelType> > 00071 { 00072 public: 00074 typedef SqrtImageAdaptor Self; 00075 typedef ImageAdaptor<TImage,Accessor::SqrtPixelAccessor< 00076 typename TImage::PixelType, 00077 TOutputPixelType> > Superclass; 00078 typedef SmartPointer<Self> Pointer; 00079 typedef SmartPointer<const Self> ConstPointer; 00080 00082 itkNewMacro(Self); 00083 00085 itkTypeMacro( SqrtImageAdaptor, ImageAdaptor ); 00086 00087 protected: 00088 SqrtImageAdaptor() {} 00089 virtual ~SqrtImageAdaptor() {} 00090 00091 private: 00092 SqrtImageAdaptor(const Self&); //purposely not implemented 00093 void operator=(const Self&); //purposely not implemented 00094 }; 00095 00096 } // end namespace itk 00097 00098 #endif 00099