16 #include <itkMatrix.h> 24 template <
class T,
unsigned int NRows = 3,
unsigned int NColumns = 3>
25 class Matrix :
public itk::Matrix<T, NRows, NColumns>
48 using itk::Matrix<T, NRows, NColumns>::operator=;
56 template <
typename ArrayType>
59 for (
unsigned i = 0; i < NRows; i++)
61 for (
unsigned j = 0; j < NColumns; j++)
63 (*this)[i][j] = array[i][j];
71 template <
typename MatrixType>
74 for (
unsigned i = 0; i < NRows; i++)
76 for (
unsigned j = 0; j < NColumns; j++)
78 matrix[i][j] = (*this)[i][j];
95 template <
typename TCoordRep,
unsigned int NRows,
unsigned int NCols>
96 inline bool MatrixEqualRMS(
const vnl_matrix_fixed<TCoordRep, NRows, NCols> &matrix1,
97 const vnl_matrix_fixed<TCoordRep, NRows, NCols> &matrix2,
100 if ((matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()))
102 vnl_matrix_fixed<TCoordRep, NRows, NCols> differenceMatrix = matrix1 - matrix2;
103 if (differenceMatrix.rms() < epsilon)
125 template <
typename TCoordRep,
unsigned int NRows,
unsigned int NCols>
127 const itk::Matrix<TCoordRep, NRows, NCols> &matrix2,
139 template <
typename TCoordRep,
unsigned int NRows,
unsigned int NCols>
141 const vnl_matrix_fixed<TCoordRep, NRows, NCols> &matrix2,
144 if ((matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()))
146 for (
unsigned int r = 0; r < NRows; r++)
148 for (
unsigned int c = 0; c < NCols; c++)
150 TCoordRep difference = matrix1(r, c) - matrix2(r, c);
171 template <
typename TCoordRep,
unsigned int NRows,
unsigned int NCols>
173 const itk::Matrix<TCoordRep, NRows, NCols> &matrix2,
bool MatrixEqualElementWise(const vnl_matrix_fixed< TCoordRep, NRows, NCols > &matrix1, const vnl_matrix_fixed< TCoordRep, NRows, NCols > &matrix2, mitk::ScalarType epsilon=mitk::eps)
Check for element-wise matrix equality with a user defined accuracy.
itk::Matrix< T, NRows, NColumns >::InternalMatrixType InternalMatrixType
Matrix< ScalarType, 3, 3 > Matrix3D
DataCollection - Class to facilitate loading/accessing structured data.
void FillMatrix(const ArrayType &array)
Matrix< ScalarType, 2, 2 > Matrix2D
void ToArray(MatrixType matrix) const
bool MatrixEqualRMS(const vnl_matrix_fixed< TCoordRep, NRows, NCols > &matrix1, const vnl_matrix_fixed< TCoordRep, NRows, NCols > &matrix2, mitk::ScalarType epsilon=mitk::eps)
Check for matrix equality with a user defined accuracy. As an equality metric the root mean squared e...
MITKCORE_EXPORT const ScalarType eps
bool DifferenceBiggerOrEqualEps(DifferenceType diff, mitk::ScalarType epsilon=mitk::eps)
Matrix< ScalarType, 4, 4 > Matrix4D