KWStyle - itkComplexToModulusImageAdaptor.h
 
Matrix View
Description

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

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