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: 2003/09/10 14:29:14 $
00007   Version:   $Revision: 1.13 $
00008 
00009   Copyright (c) Insight Software 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_fixed<T,NRows,NColumns> 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   Self operator*(const T & value)
00078     { Self result( *this );
00079       result *= value;
00080       return result; }
00081 
00083   inline T * operator[]( unsigned int i )
00084     { return m_Matrix[i]; }
00085 
00087   inline const T * operator[]( unsigned int i ) const
00088     { return m_Matrix[i]; }
00089 
00091   inline InternalMatrixType & GetVnlMatrix( void )
00092     { return m_Matrix; }
00093 
00095   inline const InternalMatrixType & GetVnlMatrix( void ) const
00096     { return m_Matrix; }
00097 
00099   inline void SetIdentity( void ) 
00100     { m_Matrix.set_identity(); }
00101 
00103   inline void Fill( const T & value ) 
00104     { m_Matrix.fill( value ); }
00105 
00107   inline const Self & operator=( const vnl_matrix<T> & matrix);
00108 
00110   inline const Self & operator=( const Self & matrix);
00111 
00113   inline vnl_matrix_fixed<T,NColumns,NRows> GetInverse( void ) const;
00114  
00116   inline vnl_matrix_fixed<T,NColumns,NRows> GetTranspose( void ) const;
00117 
00119   Matrix() : m_Matrix(NumericTraits<T>::Zero) {};
00120 
00122   Matrix(const Self & matrix) : m_Matrix( matrix.m_Matrix ) {};
00123  
00124 private:
00125   InternalMatrixType     m_Matrix;
00126 
00127 };
00128 
00129 template< class T, unsigned int NRows, unsigned int NColumns >  
00130 ITK_EXPORT std::ostream& operator<<(std::ostream& os, 
00131                                     const Matrix<T,NRows,NColumns> & v) 
00132                             { os << v.GetVnlMatrix(); return os; }
00133 
00134 
00135   
00136 } // end namespace itk
00137   
00138 
00139 #ifndef ITK_MANUAL_INSTANTIATION
00140 #include "itkMatrix.txx"
00141 #endif
00142 
00143 
00144 #endif 

Generated at Tue Sep 16 11:32:03 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000