KWStyle - itkSqrtImageAdaptor.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkSqrtImageAdaptor.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
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 __itkSqrtImageAdaptor_h
18 #define __itkSqrtImageAdaptor_h
19
20 #include <itkImageAdaptor.h>
21 #include "vnl/vnl_math.h"
22
23 namespace itk
24 {
25  
26 namespace Accessor {
27 /** \class SqrtPixelAccessor
28  * \brief Give access to the sqrt() function of a value
29  *
30  * SqrtPixelAccessor 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 template <class TInternalType, class TExternalType >
38 class ITK_EXPORT SqrtPixelAccessor  
39 {
40 public:
41 IND */** External typedef. It defines the external aspect
42    * that this class will exhibit. */
43   typedef TExternalType ExternalType;
44
45   /** Internal typedef. It defines the internal real
46    * representation of data. */
47   typedef TInternalType InternalType;
48
49   static inline void Set(TInternalType & output, const TExternalType & input) 
50     {output = (TInternalType)sqrt((double)input);}
51
52   static inline TExternalType Get( const TInternalType & input ) 
53     {return (TExternalType)sqrt((double)input);}
54 };
55
56 // end namespace Accessor
57  
58 /** \class SqrtImageAdaptor
59  * \brief Presents an image as being composed of the sqrt() of its pixels
60  *
61  * Additional casting is performed according to the input and output image
62  * types following C++ default casting rules.
63  *
64  * \ingroup ImageAdaptors
65  */
66 template <class TImage, class TOutputPixelType>
67 class ITK_EXPORT SqrtImageAdaptor : public
68 IND ******ImageAdaptor<TImage, Accessor::SqrtPixelAccessor<
69                                       typename TImage::PixelType,
70                                       TOutputPixelType>   >
71 {
72 public:
73   /** Standard class typedefs. */
74   typedef SqrtImageAdaptor  Self;
75   typedef ImageAdaptor<TImage,Accessor::SqrtPixelAccessor<
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( SqrtImageAdaptor, ImageAdaptor );
86
87 IND *protected:
88   SqrtImageAdaptor() {}
89   virtual ~SqrtImageAdaptor() {}
90   
91 IND *private:
92   SqrtImageAdaptor(const Self&); //purposely not implemented
93   void operator=(const Self&); //purposely not implemented
94 };
95
96 // end namespace itk
97
98 #endif
99

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