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/11/13 03:51:29 $
00007   Version:   $Revision: 1.24 $
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 NVectorDimension=3>
00064 class CovariantVector : public FixedArray<T,NVectorDimension> {
00065  public:
00067   typedef CovariantVector  Self;
00068   typedef FixedArray<T,NVectorDimension>  Superclass;
00069     
00072   typedef T ValueType;
00073 
00075   itkStaticConstMacro(Dimension, unsigned int, NVectorDimension);
00076 
00078   typedef Self CovariantVectorType;
00079   
00081   typedef FixedArray<T, NVectorDimension>                BaseArray;
00082     
00084   static unsigned int GetCovariantVectorDimension() 
00085     { return NVectorDimension; }  
00086 
00088   void Set_vnl_vector( const vnl_vector<T> & );
00089 
00091   vnl_vector_ref<T> Get_vnl_vector( void );
00092 
00094   vnl_vector<T> Get_vnl_vector( void ) const;
00095 
00097   CovariantVector() {}
00098 
00100   CovariantVector(const Self& r): BaseArray(r) {}
00101   CovariantVector(const ValueType r[Dimension]): BaseArray(r) {}  
00102     
00104   CovariantVector& operator= (const Self& r);
00105   CovariantVector& operator= (const ValueType r[Dimension]);
00106     
00108   const Self& operator*=(const ValueType &value);
00109 
00111   const Self& operator/=(const ValueType &value);
00112 
00114   const Self& operator+=(const Self &vec);
00115 
00117   const Self& operator-=(const Self &vec);
00118 
00120   Self operator-() const;
00121   
00123   Self operator+(const Self &vec) const;
00124   
00126   Self operator-(const Self &vec) const;
00127   
00130   Self operator*(const ValueType& val) const;
00131 
00135   ValueType operator*(const Self &vec) const;
00136 
00139   ValueType operator*(const Vector<T,NVectorDimension> &vec) const;
00140 
00143   Self operator/(const ValueType& val) const;
00144 
00146   ValueType GetNorm( void ) const;
00147 
00149   ValueType GetSquaredNorm( void ) const;
00150 
00152   void PrintSelf(std::ostream& os, Indent indent) const;
00153 
00156   template < typename TCoordRepB >
00157   void CastFrom( const CovariantVector<TCoordRepB,NVectorDimension> & pa )
00158   {
00159     for(unsigned int i=0; i<NVectorDimension; i++ )
00160       {
00161       (*this)[i] = static_cast<T>( pa[i] );
00162       }
00163   }
00164 
00165 
00166 };
00167 
00168 
00169 } // end namespace itk
00170   
00171 
00172 #ifndef ITK_MANUAL_INSTANTIATION
00173 #include "itkCovariantVector.txx"
00174 #endif
00175 
00176 
00177 #endif 

Generated at Fri May 21 01:14:35 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000