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

itkMatrix.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMatrix.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/01/15 18:57:05 $
00007   Version:   $Revision: 1.10 $
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 __itkMatrix_h
00018 #define __itkMatrix_h
00019 
00020 
00021 #include "itkPoint.h"
00022 #include "itkVector.h"
00023 #include "itkCovariantVector.h"
00024 #include "vnl/vnl_matrix_fixed.h"
00025 
00026 
00027 namespace itk
00028 {
00029 
00038 template<class T, unsigned int NRows=3, unsigned int NColumns=3>
00039 class Matrix {
00040 public:
00042   typedef Matrix  Self;
00043 
00045   typedef vnl_matrix_fixed<T,NRows,NColumns>  InternalMatrixType;
00046 
00048   Vector<T,NRows> operator*(const Vector<T,NColumns> & vector) const;
00049  
00051   Point<T,NRows> operator*(const Point<T,NColumns> & vector) const;
00052  
00054   CovariantVector<T,NRows> 
00055   operator*(const CovariantVector<T,NColumns> & vector) const;
00056   
00058   Self operator*(const Self & matrix) const;
00059  
00061   vnl_matrix<T> operator*(const vnl_matrix<T> & matrix) const;
00062 
00064   void operator*=(const Self & matrix);
00065  
00067   void operator*=(const vnl_matrix<T> & matrix);
00068 
00070   vnl_vector<T> operator*(const vnl_vector<T> & matrix) const;
00071 
00073   void operator*=(const T & value)
00074     { m_Matrix *= value; }
00075 
00077   inline T * operator[]( unsigned int i )
00078     { return m_Matrix[i]; }
00079 
00081   inline const T * operator[]( unsigned int i ) const
00082     { return m_Matrix[i]; }
00083 
00085   inline InternalMatrixType & GetVnlMatrix( void )
00086     { return m_Matrix; }
00087 
00089   inline const InternalMatrixType & GetVnlMatrix( void ) const
00090     { return m_Matrix; }
00091 
00093   inline void SetIdentity( void ) 
00094     { m_Matrix.set_identity(); }
00095 
00097   inline void Fill( const T & value ) 
00098     { m_Matrix.fill( value ); }
00099 
00101   inline const Self & operator=( const vnl_matrix<T> & matrix);
00102 
00104   inline const Self & operator=( const Self & matrix);
00105 
00107   inline vnl_matrix<T> GetInverse( void ) const;
00108  
00110   inline vnl_matrix<T> GetTranspose( void ) const;
00111 
00113   Matrix() : m_Matrix(NumericTraits<T>::Zero) {};
00114 
00116   Matrix(const Self & matrix) : m_Matrix( matrix.m_Matrix ) {};
00117  
00118 private:
00119   InternalMatrixType     m_Matrix;
00120 
00121 };
00122 
00123 template< class T, unsigned int NRows, unsigned int NColumns >  
00124 ITK_EXPORT std::ostream& operator<<(std::ostream& os, 
00125                                     const Matrix<T,NRows,NColumns> & v) 
00126                             { os << v.GetVnlMatrix(); return os; }
00127 
00128 
00129   
00130 } // end namespace itk
00131   
00132 
00133 #ifndef ITK_MANUAL_INSTANTIATION
00134 #include "itkMatrix.txx"
00135 #endif
00136 
00137 
00138 #endif 

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