freVectorToNormAccessor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freVectorToNormAccessor.h,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
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                 /*Calculate projection of the given vector along the norm vector.*/
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 } // namespace Accessor
00100 } // namespace free
00101 
00102 #endif

Generated at Sat Oct 13 18:02:05 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000