20 #include <itkMatrix.h>
28 template <
class T,
unsigned int NRows = 3,
unsigned int NColumns = 3>
29 class Matrix :
public itk::Matrix<T, NRows, NColumns>
52 using itk::Matrix<T, NRows, NColumns>::operator=;
60 template <
typename ArrayType>
63 for (
unsigned i = 0; i < NRows; i++)
65 for (
unsigned j = 0; j < NColumns; j++)
67 (*this)[i][j] = array[i][j];
75 template <
typename MatrixType>
78 for (
unsigned i = 0; i < NRows; i++)
80 for (
unsigned j = 0; j < NColumns; j++)
82 matrix[i][j] = (*this)[i][j];
99 template <
typename TCoordRep,
unsigned int NRows,
unsigned int NCols>
100 inline bool MatrixEqualRMS(
const vnl_matrix_fixed<TCoordRep, NRows, NCols> &matrix1,
101 const vnl_matrix_fixed<TCoordRep, NRows, NCols> &matrix2,
104 if ((matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()))
106 vnl_matrix_fixed<TCoordRep, NRows, NCols> differenceMatrix = matrix1 - matrix2;
107 if (differenceMatrix.rms() < epsilon)
129 template <
typename TCoordRep,
unsigned int NRows,
unsigned int NCols>
131 const itk::Matrix<TCoordRep, NRows, NCols> &matrix2,
143 template <
typename TCoordRep,
unsigned int NRows,
unsigned int NCols>
145 const vnl_matrix_fixed<TCoordRep, NRows, NCols> &matrix2,
148 if ((matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()))
150 for (
unsigned int r = 0; r < NRows; r++)
152 for (
unsigned int c = 0; c < NCols; c++)
154 TCoordRep difference = matrix1(r, c) - matrix2(r, c);
175 template <
typename TCoordRep,
unsigned int NRows,
unsigned int NCols>
177 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 ToArray(MatrixType matrix) const
void FillMatrix(const ArrayType &array)
Matrix< ScalarType, 2, 2 > Matrix2D
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