Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkCovariantVector.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkCovariantVector.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/11 19:57:12 $
00007   Version:   $Revision: 1.21 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkCovariantVector_h
00018 #define __itkCovariantVector_h
00019 
00020 
00021 #include "itkFixedArray.h"
00022 #include "vnl/vnl_vector_ref.h"
00023 #include "itkIndent.h"
00024 #include "itkVector.h"
00025 
00026 
00027 namespace itk
00028 {
00029 
00063 template<class T, unsigned int NCovariantVectorDimension=3>
00064 class CovariantVector : public FixedArray<T,NCovariantVectorDimension> {
00065  public:
00067   typedef CovariantVector  Self;
00068   typedef FixedArray<T,NCovariantVectorDimension>  Superclass;
00069     
00072   typedef T ValueType;
00073 
00075   itkStaticConstMacro(CovariantVectorDimension, unsigned int,
00076                       NCovariantVectorDimension);
00077 
00079   typedef Self CovariantVectorType;
00080   
00082   typedef FixedArray<T, NCovariantVectorDimension>                BaseArray;
00083     
00085   static unsigned int GetCovariantVectorDimension() 
00086     { return NCovariantVectorDimension; }  
00087 
00089   void Set_vnl_vector( const vnl_vector<T> & );
00090 
00092   vnl_vector_ref<T> Get_vnl_vector( void );
00093 
00095   vnl_vector<T> Get_vnl_vector( void ) const;
00096 
00098   CovariantVector() {}
00099 
00101   CovariantVector(const Self& r): BaseArray(r) {}
00102   CovariantVector(const ValueType r[CovariantVectorDimension]): BaseArray(r) {}  
00103     
00105   CovariantVector& operator= (const Self& r);
00106   CovariantVector& operator= (const ValueType r[CovariantVectorDimension]);
00107     
00109   const Self& operator*=(const ValueType &value);
00110 
00112   const Self& operator/=(const ValueType &value);
00113 
00115   const Self& operator+=(const Self &vec);
00116 
00118   const Self& operator-=(const Self &vec);
00119 
00121   Self operator-() const;
00122   
00124   Self operator+(const Self &vec) const;
00125   
00127   Self operator-(const Self &vec) const;
00128   
00131   Self operator*(const ValueType& val) const;
00132 
00136   ValueType operator*(const Self &vec) const;
00137 
00140   ValueType operator*(const Vector<T,NCovariantVectorDimension> &vec) const;
00141 
00144   Self operator/(const ValueType& val) const;
00145 
00147   ValueType GetNorm( void ) const;
00148 
00150   ValueType GetSquaredNorm( void ) const;
00151 
00153   void PrintSelf(std::ostream& os, Indent indent) const;
00154 
00157   template < typename TCoordRepB >
00158   void CastFrom( const CovariantVector<TCoordRepB,NCovariantVectorDimension> & pa )
00159   {
00160     for(unsigned int i=0; i<NCovariantVectorDimension; i++ )
00161       {
00162       (*this)[i] = static_cast<T>( pa[i] );
00163       }
00164   }
00165 
00166 
00167 };
00168 
00169 
00170 } // end namespace itk
00171   
00172 
00173 #ifndef ITK_MANUAL_INSTANTIATION
00174 #include "itkCovariantVector.txx"
00175 #endif
00176 
00177 
00178 #endif 

Generated at Wed Mar 12 01:12:51 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000