KWStyle - itkAbsImageAdaptor.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkAbsImageAdaptor.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:32 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkAbsImageAdaptor_h
18 #define __itkAbsImageAdaptor_h
19
20 #include <itkImageAdaptor.h>
21
22 namespace itk
23 {
24  
25 namespace Accessor {
26 /** \class AbsPixelAccessor
27  * \brief Give access to the abs() function of a value
28  *
29  * AbsPixelAccessor is templated over an internal type and an
30  * external type representation. This class cast the input
31  * applies the funtion to it and cast the result according 
32  * to the types defined as template parameters
33  *
34  * \ingroup ImageAdaptors
35  */
36 template <class TInternalType, class TExternalType >
37 class ITK_EXPORT AbsPixelAccessor  
38 {
39 public:
40   /** External typedef. It defines the external aspect
41    * that this class will exhibit. */
42   typedef TExternalType ExternalType;
43
44   /** Internal typedef. It defines the internal real
45    * representation of data. */
46   typedef TInternalType InternalType;
47
48   static inline void Set(TInternalType & output, const TExternalType & input) 
49 LEN     {output = (TInternalType)((input > NumericTraits<TExternalType>::Zero) ? input : -input );}
50
51   static inline TExternalType Get( const TInternalType & input ) 
52 LEN     {return (TExternalType) ( (input > NumericTraits<TInternalType>::Zero) ? input : -input );}
53 };
54   
55 // end namespace Accessor
56  
57 /** \class AbsImageAdaptor
58  * \brief Presents an image as being composed of the abs() of its pixels
59  *
60  * Additional casting is performed according to the input and output image
61  * types following C++ default casting rules.
62  *
63  * \ingroup ImageAdaptors
64  */
65 template <class TImage, class TOutputPixelType>
66 class ITK_EXPORT AbsImageAdaptor : public
67 IND ******ImageAdaptor<TImage,
68                    Accessor::AbsPixelAccessor<
69                                       typename TImage::PixelType,
70                                       TOutputPixelType>   >
71 {
72 public:
73   /** Standard class typedefs. */
74   typedef AbsImageAdaptor  Self;
75   typedef ImageAdaptor<TImage, Accessor::AbsPixelAccessor<
76                                typename TImage::PixelType,
77 TDA                                TOutputPixelType> >  Superclass;
78 TDA   typedef SmartPointer<Self>  Pointer;
79 TDA   typedef SmartPointer<const Self>  ConstPointer;
80   
81   /** Method for creation through the object factory. */
82   itkNewMacro(Self);  
83
84   /** Run-time type information (and related methods). */
85   itkTypeMacro( AbsImageAdaptor, ImageAdaptor );
86
87 IND *protected:
88   AbsImageAdaptor() {}
89   virtual ~AbsImageAdaptor() {}
90   
91 IND *private:
92   AbsImageAdaptor(const Self&); //purposely not implemented
93   void operator=(const Self&); //purposely not implemented
94
95 };
96
97 // end namespace itk
98
99 #endif
100

Generated by KWStyle 1.0b on Tuesday January,17 at 02:13:58PM
© Kitware Inc.