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/12/02 01:43:44 $ 00007 Version: $Revision: 1.15 $ 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 T ValueType; 00046 typedef T ComponentType; 00047 00049 itkStaticConstMacro(RowDimensions, unsigned int, NRows); 00050 itkStaticConstMacro(ColumnDimensions, unsigned int, NColumns); 00051 00053 typedef vnl_matrix_fixed<T,NRows,NColumns> InternalMatrixType; 00054 00056 Vector<T,NRows> operator*(const Vector<T,NColumns> & vector) const; 00057 00059 Point<T,NRows> operator*(const Point<T,NColumns> & vector) const; 00060 00062 CovariantVector<T,NRows> 00063 operator*(const CovariantVector<T,NColumns> & vector) const; 00064 00066 Self operator*(const Self & matrix) const; 00067 00069 vnl_matrix<T> operator*(const vnl_matrix<T> & matrix) const; 00070 00072 void operator*=(const Self & matrix); 00073 00075 void operator*=(const vnl_matrix<T> & matrix); 00076 00078 vnl_vector<T> operator*(const vnl_vector<T> & matrix) const; 00079 00081 void operator*=(const T & value) 00082 { m_Matrix *= value; } 00083 00085 Self operator*(const T & value) 00086 { Self result( *this ); 00087 result *= value; 00088 return result; } 00089 00091 inline T * operator[]( unsigned int i ) 00092 { return m_Matrix[i]; } 00093 00095 inline const T * operator[]( unsigned int i ) const 00096 { return m_Matrix[i]; } 00097 00099 inline InternalMatrixType & GetVnlMatrix( void ) 00100 { return m_Matrix; } 00101 00103 inline const InternalMatrixType & GetVnlMatrix( void ) const 00104 { return m_Matrix; } 00105 00107 inline void SetIdentity( void ) 00108 { m_Matrix.set_identity(); } 00109 00111 inline void Fill( const T & value ) 00112 { m_Matrix.fill( value ); } 00113 00115 inline const Self & operator=( const vnl_matrix<T> & matrix); 00116 00118 inline const Self & operator=( const Self & matrix); 00119 00121 inline vnl_matrix_fixed<T,NColumns,NRows> GetInverse( void ) const; 00122 00124 inline vnl_matrix_fixed<T,NColumns,NRows> GetTranspose( void ) const; 00125 00127 Matrix() : m_Matrix(NumericTraits<T>::Zero) {}; 00128 00130 Matrix(const Self & matrix) : m_Matrix( matrix.m_Matrix ) {}; 00131 00132 private: 00133 InternalMatrixType m_Matrix; 00134 00135 }; 00136 00137 template< class T, unsigned int NRows, unsigned int NColumns > 00138 ITK_EXPORT std::ostream& operator<<(std::ostream& os, 00139 const Matrix<T,NRows,NColumns> & v) 00140 { os << v.GetVnlMatrix(); return os; } 00141 00142 00143 00144 } // end namespace itk 00145 00146 00147 #ifndef ITK_MANUAL_INSTANTIATION 00148 #include "itkMatrix.txx" 00149 #endif 00150 00151 00152 #endif

Generated at Sun Apr 1 02:37:16 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000