MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Class template for a two dimensional dense matrix stored in row-major format. More...
#include <mdsMatrix.h>
Public Types | |
enum | { CLASS_MATRIX } |
Templates that require members of the CMatrix class can use this enum to check the existence. More... | |
enum | { CLASS_OBJECT } |
Templates that require members of the CObject class can use this enum to check the existence. More... | |
enum | { HEAP_OBJECT = 0x70616568 } |
Signature used to recognize objects on the heap. More... | |
typedef CMatrixBase< CMatrix< T > > | tBase |
Base class. | |
typedef T | tElement |
Matrix element type. | |
typedef CMatrix< T > | tMatrix |
Matrix type. | |
typedef Eigen::Matrix < tElement, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor|Eigen::AutoAlign > | tStorage |
Underlying matrix data (see the Eigen library). | |
Public Member Functions | |
CMatrix & | abs () |
Makes absolute value of all elements. | |
tStorage & | asEigen () |
Returns reference to the underlying matrix data (see the Eigen library). | |
const tStorage & | asEigen () const |
T & | at (tSize Row, tSize Col) |
Returns reference to the element [Row][Col]. | |
const T & | at (tSize Row, tSize Col) const |
Method returns element (by value) at (row, col). | |
T & | at (tSize i) |
Returns the subscripted pixel. | |
const T & | at (tSize i) const |
template<typename T > | |
CMatrix () | |
template<typename T > | |
CMatrix (tSize NumOfRows, tSize NumOfCols) | |
template<typename T > | |
CMatrix (const CMatrix< T > &Matrix, tSize Row, tSize Col, tSize NumOfRows, tSize NumOfCols) | |
template<typename T > | |
CMatrix (const CMatrix< T > &Matrix) | |
CMatrix () | |
Declare iterators. | |
template<typename Derived > | |
CMatrix (const Eigen::MatrixBase< Derived > &Matrix) | |
CMatrix (tSize NumOfRows, tSize NumOfCols) | |
Constructor. | |
CMatrix (const CMatrix &Matrix, tSize Row, tSize Col, tSize NumOfRows, tSize NumOfCols) | |
Constructor. | |
CMatrix (const CMatrix &Matrix) | |
Copy constructor. | |
template<typename Derived > | |
CMatrix (const Eigen::MatrixBase< Derived > &Matrix) | |
Constructor. | |
tSize | cols () const |
template<typename T > | |
CMatrix< T > & | create (tSize NumOfRows, tSize NumOfCols) |
template<typename T > | |
CMatrix< T > & | create (const CMatrix< T > &Matrix, tSize Row, tSize Col, tSize NumOfRows, tSize NumOfCols) |
CMatrix & | create (tSize NumOfRows, tSize NumOfCols) |
Re-allocates memory for the matrix if needed. | |
CMatrix & | create (const CMatrix &Matrix, tSize Row, tSize Col, tSize NumOfRows, tSize NumOfCols) |
Re-creates the matrix. | |
template<typename Derived > | |
CMatrix & | create (const CMatrixBase< Derived > &Matrix) |
Re-creates the matrix. | |
template<typename Derived > | |
CMatrix & | create (const Eigen::MatrixBase< Derived > &Matrix) |
Assignment operator. | |
template<typename Derived > | |
CMatrix< T > & | create (const CMatrixBase< Derived > &Matrix) |
template<typename Derived > | |
CMatrix< T > & | create (const Eigen::MatrixBase< Derived > &Matrix) |
CMatrix & | fill (const T &Value) |
Fills the matrix using a given value. | |
template<class Function > | |
Function | forEach (Function Func) |
Calls a function object for every matrix element. | |
template<class Function > | |
Function | forEach (Function Func) const |
Calls a function object for every matrix element. | |
template<class Function > | |
Function | forEach (Function Func) |
Calls a function object for every matrix coefficient. | |
template<class Function > | |
Function | forEach (Function Func) const |
Calls a function object for every matrix coefficient. | |
tSize | getColOffset () const |
Returns column offset. | |
T * | getColPtr (tSize Col) |
Returns pointer to the first element of matrix column. | |
const T * | getColPtr (tSize Col) const |
tSize | getIdx (tSize Row, tSize Col) const |
Calculates index of a specified pixel. | |
tMatrix & | getImpl () |
Returns reference to the matrix implementation. | |
const tMatrix & | getImpl () const |
tSize | getNumOfCols () const |
tSize | getNumOfRows () const |
Returns the matrix dimensions. | |
T * | getPtr () |
Returns pointer to the first matrix element. | |
const T * | getPtr () const |
T * | getPtr (tSize Row, tSize Col) |
Returns pointer to the given element. | |
const T * | getPtr (tSize Row, tSize Col) const |
int | getReferencesCount () const |
Returns the number of references. | |
tSize | getRowOffset () const |
Returns row offset. | |
T * | getRowPtr (tSize Row) |
Returns pointer to the first element of matrix row. | |
const T * | getRowPtr (tSize Row) const |
bool | isOnHeap () const |
Returns true if the object is allocated on the heap. | |
bool | isSquare () const |
Returns true of the matrix is square. | |
MDS_SHAREDPTR (CMatrix) | |
Smart pointer type. | |
CMatrix & | mult (const CMatrix &m1, const CMatrix &m2) |
Makes this to be result of multiplication of two matrices. | |
CMatrix & | ones () |
Sets all elements to one. | |
T & | operator() (tSize Row, tSize Col) |
Returns reference to the element [Row][Col]. | |
const T & | operator() (tSize Row, tSize Col) const |
Method returns element (by value) at (row, col). | |
T & | operator() (tSize i) |
Returns the subscripted pixel. | |
const T & | operator() (tSize i) const |
template<typename T > | |
CMatrix< T > & | operator*= (const CMatrix< T > &Matrix) |
template<typename U > | |
CMatrix< T > & | operator*= (const CScalar< U > &c) |
CMatrix & | operator*= (const CMatrix &Matrix) |
Element wise product. | |
template<typename U > | |
CMatrix & | operator*= (const CScalar< U > &c) |
Multiplies all elements by scalar. | |
template<typename T > | |
CMatrix< T > & | operator+= (const CMatrix< T > &Matrix) |
template<typename U > | |
CMatrix< T > & | operator+= (const CScalar< U > &c) |
CMatrix & | operator+= (const CMatrix &Matrix) |
Element wise addition. | |
template<typename U > | |
CMatrix & | operator+= (const CScalar< U > &c) |
Adds scalar to all elements. | |
template<typename T > | |
CMatrix< T > & | operator-= (const CMatrix< T > &Matrix) |
template<typename U > | |
CMatrix< T > & | operator-= (const CScalar< U > &c) |
CMatrix & | operator-= (const CMatrix &Matrix) |
Element wise subtraction. | |
template<typename U > | |
CMatrix & | operator-= (const CScalar< U > &c) |
Subtracts scalar to all elements. | |
template<typename T > | |
CMatrix< T > & | operator/= (const CMatrix< T > &Matrix) |
template<typename U > | |
CMatrix< T > & | operator/= (const CScalar< U > &c) |
CMatrix & | operator/= (const CMatrix &Matrix) |
Element wise division. | |
template<typename U > | |
CMatrix & | operator/= (const CScalar< U > &c) |
Divides all elements by scalar. | |
CMatrix & | operator= (const CMatrix &Matrix) |
Assignment operator. | |
template<typename Derived > | |
CMatrix & | operator= (const Eigen::MatrixBase< Derived > &Matrix) |
Assignment operator. | |
template<typename T > | |
CMatrix< T > & | operator= (const CMatrix< T > &Matrix) |
template<typename Derived > | |
CMatrix< T > & | operator= (const Eigen::MatrixBase< Derived > &Matrix) |
template<class Function > | |
Function | pforEach (Function Func) |
Calls a function object for every matrix element. | |
template<class Function > | |
Function | pforEach (Function Func) const |
Calls a function object for every matrix element. | |
template<class Function > | |
Function | pforEach (Function Func) |
Calls a function object for every matrix coefficient. | |
template<class Function > | |
Function | pforEach (Function Func) const |
Calls a function object for every matrix coefficient. | |
tSize | rows () const |
Returns the matrix dimensions. | |
tMatrix & | set (tSize row, tSize col, const tElement &Value) |
Method sets value of element at (row, col). | |
CMatrix & | set (tSize Row, tSize Col, const T &Value) |
Sets the element of matrix at the position [row][col]. | |
tMatrix & | set (tSize i, const tElement &Value) |
Sets the subscripted matrix coefficient. | |
CMatrix & | set (tSize i, const T &Value) |
Sets the subscripted voxel. | |
CMatrix & | transpose (const CMatrix &Matrix) |
Makes this to be transpose of a given matrix. | |
CMatrix & | unit () |
Makes the matrix unit. | |
CMatrix & | zeros () |
Zeros the matrix. | |
virtual | ~CMatrix () |
Virtual destructor. | |
Static Public Member Functions | |
static void * | operator new (std::size_t Size) |
Allocates a new object on the heap. | |
Protected Member Functions | |
void | addReference () const |
Increase the reference counter. | |
bool | delReference () const |
Decrease the reference counter. | |
Protected Attributes | |
int | m_iHeapObject |
Flag initialized if the object is on the heap. | |
int | m_iReferences |
The number of references to the object. | |
tStorage | m_Matrix |
Underlying matrix data (see the Eigen math library). |
Class template for a two dimensional dense matrix stored in row-major format.
typedef CMatrixBase<CMatrix<T> > mds::math::CMatrix< T >::tBase |
Base class.
typedef T mds::math::CMatrix< T >::tElement |
Matrix element type.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
typedef CMatrix< T > mds::math::CMatrixBase< CMatrix< T > >::tMatrix [inherited] |
Matrix type.
typedef Eigen::Matrix<tElement, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::AutoAlign> mds::math::CMatrix< T >::tStorage |
Underlying matrix data (see the Eigen library).
anonymous enum |
Templates that require members of the CMatrix class can use this enum to check the existence.
anonymous enum [inherited] |
Templates that require members of the CObject class can use this enum to check the existence.
mds::math::CMatrix< T >::CMatrix | ( | ) |
Declare iterators.
mds::math::CMatrix< T >::CMatrix | ( | tSize | NumOfRows, |
tSize | NumOfCols | ||
) |
Constructor.
mds::math::CMatrix< T >::CMatrix | ( | const CMatrix< T > & | Matrix, |
tSize | Row, | ||
tSize | Col, | ||
tSize | NumOfRows, | ||
tSize | NumOfCols | ||
) |
Constructor.
mds::math::CMatrix< T >::CMatrix | ( | const CMatrix< T > & | Matrix | ) |
Copy constructor.
mds::math::CMatrix< T >::CMatrix | ( | const Eigen::MatrixBase< Derived > & | Matrix | ) |
Constructor.
CMatrix::~CMatrix | ( | ) | [virtual] |
Virtual destructor.
mds::math::CMatrix< T >::CMatrix | ( | tSize | NumOfRows, |
tSize | NumOfCols | ||
) |
mds::math::CMatrix< T >::CMatrix | ( | const CMatrix< T > & | Matrix, |
tSize | Row, | ||
tSize | Col, | ||
tSize | NumOfRows, | ||
tSize | NumOfCols | ||
) |
mds::math::CMatrix< T >::CMatrix | ( | const CMatrix< T > & | Matrix | ) |
mds::math::CMatrix< T >::CMatrix | ( | const Eigen::MatrixBase< Derived > & | Matrix | ) |
CMatrix< T > & CMatrix::abs | ( | ) |
Makes absolute value of all elements.
void mds::base::CObject::addReference | ( | ) | const [protected, inherited] |
Increase the reference counter.
tStorage& mds::math::CMatrix< T >::asEigen | ( | ) |
Returns reference to the underlying matrix data (see the Eigen library).
const tStorage& mds::math::CMatrix< T >::asEigen | ( | ) | const |
T& mds::math::CMatrix< T >::at | ( | tSize | Row, |
tSize | Col | ||
) |
Returns reference to the element [Row][Col].
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
const T& mds::math::CMatrix< T >::at | ( | tSize | row, |
tSize | col | ||
) | const |
Method returns element (by value) at (row, col).
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
T& mds::math::CMatrix< T >::at | ( | tSize | i | ) |
Returns the subscripted pixel.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
const T& mds::math::CMatrix< T >::at | ( | tSize | i | ) | const |
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
tSize mds::math::CMatrix< T >::cols | ( | ) | const |
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
CMatrix<T>& mds::math::CMatrix< T >::create | ( | tSize | NumOfRows, |
tSize | NumOfCols | ||
) |
CMatrix< T > & mds::math::CMatrix< T >::create | ( | tSize | NumOfRows, |
tSize | NumOfCols | ||
) |
Re-allocates memory for the matrix if needed.
CMatrix<T>& mds::math::CMatrix< T >::create | ( | const CMatrix< T > & | Matrix, |
tSize | Row, | ||
tSize | Col, | ||
tSize | NumOfRows, | ||
tSize | NumOfCols | ||
) |
CMatrix< T > & mds::math::CMatrix< T >::create | ( | const CMatrix< T > & | Matrix, |
tSize | Row, | ||
tSize | Col, | ||
tSize | NumOfRows, | ||
tSize | NumOfCols | ||
) |
Re-creates the matrix.
CMatrix< T > & mds::math::CMatrix< T >::create | ( | const CMatrixBase< Derived > & | Matrix | ) |
Re-creates the matrix.
CMatrix< T > & mds::math::CMatrix< T >::create | ( | const Eigen::MatrixBase< Derived > & | Matrix | ) |
Assignment operator.
CMatrix<T>& mds::math::CMatrix< T >::create | ( | const CMatrixBase< Derived > & | Matrix | ) |
CMatrix<T>& mds::math::CMatrix< T >::create | ( | const Eigen::MatrixBase< Derived > & | Matrix | ) |
bool mds::base::CObject::delReference | ( | ) | const [protected, inherited] |
Decrease the reference counter.
CMatrix< T > & CMatrix::fill | ( | const T & | Value | ) |
Fills the matrix using a given value.
Function mds::math::CMatrix< T >::forEach | ( | Function | Func | ) |
Calls a function object for every matrix element.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
Function mds::math::CMatrix< T >::forEach | ( | Function | Func | ) | const |
Calls a function object for every matrix element.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
Function mds::math::CMatrix< T >::forEach | ( | Function | Func | ) |
Calls a function object for every matrix coefficient.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
Function mds::math::CMatrix< T >::forEach | ( | Function | Func | ) | const |
Calls a function object for every matrix coefficient.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
tSize mds::math::CMatrix< T >::getColOffset | ( | ) | const |
Returns column offset.
In other words, offset between two neighbouring elements in a matrix row.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
T* mds::math::CMatrix< T >::getColPtr | ( | tSize | Col | ) |
Returns pointer to the first element of matrix column.
const T* mds::math::CMatrix< T >::getColPtr | ( | tSize | Col | ) | const |
tSize mds::math::CMatrix< T >::getIdx | ( | tSize | Row, |
tSize | Col | ||
) | const |
Calculates index of a specified pixel.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
tMatrix& mds::math::CMatrixBase< CMatrix< T > >::getImpl | ( | ) | [inherited] |
Returns reference to the matrix implementation.
const tMatrix& mds::math::CMatrixBase< CMatrix< T > >::getImpl | ( | ) | const [inherited] |
tSize mds::math::CMatrix< T >::getNumOfCols | ( | ) | const |
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
tSize mds::math::CMatrix< T >::getNumOfRows | ( | ) | const |
Returns the matrix dimensions.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
T* mds::math::CMatrix< T >::getPtr | ( | ) |
Returns pointer to the first matrix element.
const T* mds::math::CMatrix< T >::getPtr | ( | ) | const |
T* mds::math::CMatrix< T >::getPtr | ( | tSize | Row, |
tSize | Col | ||
) |
Returns pointer to the given element.
const T* mds::math::CMatrix< T >::getPtr | ( | tSize | Row, |
tSize | Col | ||
) | const |
int mds::base::CObject::getReferencesCount | ( | ) | const [inherited] |
Returns the number of references.
tSize mds::math::CMatrix< T >::getRowOffset | ( | ) | const |
Returns row offset.
In other words, offset between two neighbouring elements in a matrix column.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
T* mds::math::CMatrix< T >::getRowPtr | ( | tSize | Row | ) |
Returns pointer to the first element of matrix row.
const T* mds::math::CMatrix< T >::getRowPtr | ( | tSize | Row | ) | const |
bool mds::base::CObject::isOnHeap | ( | ) | const [inherited] |
Returns true if the object is allocated on the heap.
bool mds::math::CMatrix< T >::isSquare | ( | ) | const |
Returns true of the matrix is square.
mds::math::CMatrix< T >::MDS_SHAREDPTR | ( | CMatrix< T > | ) |
Smart pointer type.
CMatrix< T > & CMatrix::mult | ( | const CMatrix< T > & | m1, |
const CMatrix< T > & | m2 | ||
) |
Makes this to be result of multiplication of two matrices.
CMatrix< T > & CMatrix::ones | ( | ) |
Sets all elements to one.
static void* mds::base::CObject::operator new | ( | std::size_t | Size | ) | [static, inherited] |
Allocates a new object on the heap.
T& mds::math::CMatrix< T >::operator() | ( | tSize | Row, |
tSize | Col | ||
) |
Returns reference to the element [Row][Col].
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
const T& mds::math::CMatrix< T >::operator() | ( | tSize | row, |
tSize | col | ||
) | const |
Method returns element (by value) at (row, col).
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
T& mds::math::CMatrix< T >::operator() | ( | tSize | i | ) |
Returns the subscripted pixel.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
const T& mds::math::CMatrix< T >::operator() | ( | tSize | i | ) | const |
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
CMatrix<T>& mds::math::CMatrix< T >::operator*= | ( | const CMatrix< T > & | Matrix | ) |
CMatrix<T>& mds::math::CMatrix< T >::operator*= | ( | const CScalar< U > & | c | ) |
CMatrix< T > & mds::math::CMatrix< T >::operator*= | ( | const CMatrix< T > & | Matrix | ) |
Element wise product.
CMatrix< T > & mds::math::CMatrix< T >::operator*= | ( | const CScalar< U > & | c | ) |
Multiplies all elements by scalar.
CMatrix<T>& mds::math::CMatrix< T >::operator+= | ( | const CMatrix< T > & | Matrix | ) |
CMatrix<T>& mds::math::CMatrix< T >::operator+= | ( | const CScalar< U > & | c | ) |
CMatrix< T > & mds::math::CMatrix< T >::operator+= | ( | const CMatrix< T > & | Matrix | ) |
Element wise addition.
CMatrix< T > & mds::math::CMatrix< T >::operator+= | ( | const CScalar< U > & | c | ) |
Adds scalar to all elements.
CMatrix<T>& mds::math::CMatrix< T >::operator-= | ( | const CMatrix< T > & | Matrix | ) |
CMatrix<T>& mds::math::CMatrix< T >::operator-= | ( | const CScalar< U > & | c | ) |
CMatrix< T > & mds::math::CMatrix< T >::operator-= | ( | const CMatrix< T > & | Matrix | ) |
Element wise subtraction.
CMatrix< T > & mds::math::CMatrix< T >::operator-= | ( | const CScalar< U > & | c | ) |
Subtracts scalar to all elements.
CMatrix<T>& mds::math::CMatrix< T >::operator/= | ( | const CMatrix< T > & | Matrix | ) |
CMatrix<T>& mds::math::CMatrix< T >::operator/= | ( | const CScalar< U > & | c | ) |
CMatrix< T > & mds::math::CMatrix< T >::operator/= | ( | const CMatrix< T > & | Matrix | ) |
Element wise division.
CMatrix< T > & mds::math::CMatrix< T >::operator/= | ( | const CScalar< U > & | c | ) |
Divides all elements by scalar.
CMatrix< T > & mds::math::CMatrix< T >::operator= | ( | const CMatrix< T > & | Matrix | ) |
Assignment operator.
CMatrix< T > & mds::math::CMatrix< T >::operator= | ( | const Eigen::MatrixBase< Derived > & | Matrix | ) |
Assignment operator.
CMatrix<T>& mds::math::CMatrix< T >::operator= | ( | const CMatrix< T > & | Matrix | ) |
CMatrix<T>& mds::math::CMatrix< T >::operator= | ( | const Eigen::MatrixBase< Derived > & | Matrix | ) |
Function mds::math::CMatrix< T >::pforEach | ( | Function | Func | ) |
Calls a function object for every matrix element.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
Function mds::math::CMatrix< T >::pforEach | ( | Function | Func | ) | const |
Calls a function object for every matrix element.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
Function mds::math::CMatrix< T >::pforEach | ( | Function | Func | ) |
Calls a function object for every matrix coefficient.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
Function mds::math::CMatrix< T >::pforEach | ( | Function | Func | ) | const |
Calls a function object for every matrix coefficient.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
tSize mds::math::CMatrix< T >::rows | ( | ) | const |
Returns the matrix dimensions.
Reimplemented from mds::math::CMatrixBase< CMatrix< T > >.
tMatrix& mds::math::CMatrixBase< CMatrix< T > >::set | ( | tSize | row, |
tSize | col, | ||
const tElement & | Value | ||
) | [inherited] |
Method sets value of element at (row, col).
tMatrix& mds::math::CMatrixBase< CMatrix< T > >::set | ( | tSize | i, |
const tElement & | Value | ||
) | [inherited] |
Sets the subscripted matrix coefficient.
CMatrix& mds::math::CMatrix< T >::set | ( | tSize | Row, |
tSize | Col, | ||
const T & | Value | ||
) |
Sets the element of matrix at the position [row][col].
CMatrix& mds::math::CMatrix< T >::set | ( | tSize | i, |
const T & | Value | ||
) |
Sets the subscripted voxel.
CMatrix< T > & CMatrix::transpose | ( | const CMatrix< T > & | Matrix | ) |
Makes this to be transpose of a given matrix.
CMatrix< T > & CMatrix::unit | ( | ) |
Makes the matrix unit.
CMatrix< T > & CMatrix::zeros | ( | ) |
Zeros the matrix.
int mds::base::CObject::m_iHeapObject [mutable, protected, inherited] |
Flag initialized if the object is on the heap.
int mds::base::CObject::m_iReferences [mutable, protected, inherited] |
The number of references to the object.
tStorage mds::math::CMatrix< T >::m_Matrix [protected] |
Underlying matrix data (see the Eigen math library).