00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _freVectorToPhaseAccessor_h
00024 #define _freVectorToPhaseAccessor_h
00025
00026 #include "itkVector.h"
00027
00028 namespace FREE
00029 {
00030 namespace Accessor
00031 {
00032
00043 template <class TVector>
00044 class ITK_EXPORT VectorToPhaseAccessor
00045 {
00046 public:
00048 typedef VectorToPhaseAccessor Self;
00049
00052 typedef TVector InternalType;
00053
00056 typedef double ExternalType;
00057
00059 inline void Set( InternalType & output, const ExternalType & input ) const
00060 {
00061 ExternalType dAngle = input;
00062 if (!m_bOutputAsRad) dAngle = (output/360)*M_PI;
00063
00064 output[0] = cos(dAngle);
00065 output[1] = sin(dAngle);
00066 }
00067
00069 ExternalType Get( const InternalType & input ) const;
00070
00071 inline void SetOutputAsRad(const bool& bAsRad)
00072 {
00073 m_bOutputAsRad = bAsRad;
00074 };
00075
00076 inline bool GetOutputAsRad() const
00077 {
00078 return m_bOutputAsRad;
00079 };
00080
00081 VectorToPhaseAccessor();
00082 ~VectorToPhaseAccessor();
00083
00084 private:
00085 bool m_bOutputAsRad;
00086 };
00087
00088 }
00089 }
00090
00091 #endif