00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _freVectorToNormAccessor_h
00023 #define _freVectorToNormAccessor_h
00024
00025 #include "itkVector.h"
00026
00027 namespace FREE
00028 {
00029 namespace Accessor
00030 {
00031
00046 template <class TVector>
00047 class ITK_EXPORT VectorToNormAccessor
00048 {
00049 public:
00051 typedef VectorToNormAccessor Self;
00052
00055 typedef TVector InternalType;
00056
00059 typedef typename InternalType::ValueType ExternalType;
00060
00062 inline void Set( InternalType & output, const ExternalType & input ) const
00063 {
00064 output = input*m_NormVector;
00065 }
00066
00068 inline ExternalType Get( const InternalType & input ) const
00069 {
00070 if (!m_NormVectorNorm) return input.GetNorm();
00071
00072
00073 ExternalType norm = input*m_NormVector;
00074 return norm;
00075 }
00076
00077 inline void SetNormVector(const InternalType& normVector)
00078 {
00079 m_NormVector = normVector;
00080 m_NormVectorNorm = normVector.GetNorm();
00081 if (m_NormVectorNorm) m_NormVector.Normalize();
00082 };
00083
00084 inline InternalType GetNormVector() const
00085 {
00086 return m_NormVector;
00087 };
00088
00089 VectorToNormAccessor();
00090 ~VectorToNormAccessor();
00091
00092 private:
00094 InternalType m_NormVector;
00096 ExternalType m_NormVectorNorm;
00097 };
00098
00099 }
00100 }
00101
00102 #endif