KWStyle - itkLogImageAdaptor.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkLogImageAdaptor.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:41 $
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 __itkLogImageAdaptor_h
18 #define __itkLogImageAdaptor_h
19
20 #include <itkImageAdaptor.h>
21 #include "vnl/vnl_math.h"
22
23 namespace itk
24 {
25  
26 namespace Accessor {
27 /** \class LogPixelAccessor
28  * \brief Give access to the log() function of a value
29  *
30  * LogPixelAccessor is templated over an internal type and an
31  * external type representation. This class cast the input
32  * applies the funtion to it and cast the result according 
33  * to the types defined as template parameters
34  *
35  * \ingroup ImageAdaptors
36  */
37
38 template <class TInternalType, class TExternalType >
39 class ITK_EXPORT LogPixelAccessor  
40 {
41 public:
42 IND */** External typedef. It defines the external aspect
43    * that this class will exhibit. */
44   typedef TExternalType ExternalType;
45
46   /** Internal typedef. It defines the internal real
47    * representation of data. */
48   typedef TInternalType InternalType;
49
50   static inline void Set(TInternalType & output, const TExternalType & input) 
51     {output = (TInternalType)log((double)input);}
52
53   static inline TExternalType Get( const TInternalType & input ) 
54     {return (TExternalType)log((double)input);}
55
56 };
57
58   
59 // end namespace Accessor
60
61 /** \class LogImageAdaptor
62  * \brief Presents an image as being composed of the log() of its pixels
63  *
64  * Additional casting is performed according to the input and output image
65  * types following C++ default casting rules.
66  *
67  * \ingroup ImageAdaptors
68  */
69 template <class TImage, class TOutputPixelType>
70 class ITK_EXPORT LogImageAdaptor : public
71 IND ******ImageAdaptor<TImage,
72                    Accessor::LogPixelAccessor<
73                                       typename TImage::PixelType,
74                                       TOutputPixelType>   >
75 {
76 public:
77   /** Standard class typedefs. */
78   typedef LogImageAdaptor  Self;
79   typedef ImageAdaptor<TImage,
80                        Accessor::LogPixelAccessor<
81                                  typename TImage::PixelType,
82 TDA                                  TOutputPixelType> >  Superclass;
83 TDA   typedef SmartPointer<Self>  Pointer;
84 TDA   typedef SmartPointer<const Self>  ConstPointer;
85   
86   /** Run-time type information (and related methods). */
87   itkTypeMacro( LogImageAdaptor, ImageAdaptor );
88
89   /** Method for creation through the object factory. */
90   itkNewMacro(Self);  
91
92 protected:
93   LogImageAdaptor() {}
94   virtual ~LogImageAdaptor() {}
95   
96 private:
97   LogImageAdaptor(const Self&); //purposely not implemented
98   void operator=(const Self&); //purposely not implemented
99 };
100
101 // end namespace itk
102
103 #endif
104

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