00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkAbsImageAdaptor_h
00018 #define __itkAbsImageAdaptor_h
00019
00020 #include <itkImageAdaptor.h>
00021
00022 namespace itk
00023 {
00024
00025 namespace Accessor {
00036 template <class TInternalType, class TExternalType >
00037 class ITK_EXPORT AbsPixelAccessor
00038 {
00039 public:
00042 typedef TExternalType ExternalType;
00043
00046 typedef TInternalType InternalType;
00047
00048 static inline void Set(TInternalType & output, const TExternalType & input)
00049 {output = (TInternalType)((input > NumericTraits<TExternalType>::Zero) ? input : -input );}
00050
00051 static inline TExternalType Get( const TInternalType & input )
00052 {return (TExternalType) ( (input > NumericTraits<TInternalType>::Zero) ? input : -input );}
00053 };
00054
00055 }
00056
00065 template <class TImage, class TOutputPixelType>
00066 class ITK_EXPORT AbsImageAdaptor : public
00067 ImageAdaptor<TImage,
00068 Accessor::AbsPixelAccessor<
00069 typename TImage::PixelType,
00070 TOutputPixelType> >
00071 {
00072 public:
00074 typedef AbsImageAdaptor Self;
00075 typedef ImageAdaptor<TImage, Accessor::AbsPixelAccessor<
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( AbsImageAdaptor, ImageAdaptor );
00086
00087 protected:
00088 AbsImageAdaptor() {}
00089 virtual ~AbsImageAdaptor() {}
00090
00091 private:
00092 AbsImageAdaptor(const Self&);
00093 void operator=(const Self&);
00094
00095 };
00096
00097 }
00098
00099 #endif