freVectorToPhaseAccessor.cxx

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: freVectorToPhaseAccessor.cxx,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 
00023 
00024 #include "freVectorToPhaseAccessor.h"
00025 
00026 namespace FREE
00027 {
00028 namespace Accessor
00029 {
00030 
00031   template <class TVector>
00032   typename VectorToPhaseAccessor<TVector>::ExternalType
00033   VectorToPhaseAccessor<TVector>::
00034   Get( const InternalType & input ) const
00035   {
00036     if (input[1]==0) return 0.0;
00037 
00038     InternalType normVector = input;
00039     normVector.Normalize();
00040 
00041     ExternalType dAngle = acos(normVector[0]);
00042 
00043     //checking if upper or lower demi circle
00044     if (normVector[1]<0) dAngle = (2*M_PI) - dAngle; 
00045 
00046     if (!m_bOutputAsRad) dAngle = 360*(dAngle/2*M_PI);
00047 
00048     return dAngle;
00049   }
00050 
00051   template <class TVector>
00052   VectorToPhaseAccessor<TVector>::
00053 	VectorToPhaseAccessor()
00054         {
00055     m_bOutputAsRad = true;
00056         }
00057 
00058   template <class TVector>
00059   VectorToPhaseAccessor<TVector>::
00060 	~VectorToPhaseAccessor()
00061         {
00062         }
00063 
00064 } // namespace Accessor
00065 } // namespace free

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