24#include <vxl_version.h>
25#include "vnl/vnl_matrix_fixed.hxx"
26#include "vnl/vnl_transpose.h"
27#include "vnl/algo/vnl_matrix_inverse.h"
28#include "vnl/vnl_matrix.h"
29#include "vnl/algo/vnl_determinant.h"
51template <
typename T,
unsigned int VRows = 3,
unsigned int VColumns = 3>
81 static constexpr unsigned int RowDimensions = VRows;
82 static constexpr unsigned int ColumnDimensions = VColumns;
105 vnl_vector_fixed<T, VRows>
106 operator*(
const vnl_vector_fixed<T, VColumns> & inVNLvect)
const;
112 template <
unsigned int OuterDim>
114 operator*(
const vnl_matrix_fixed<T, VRows, OuterDim> & matrix)
const
188 return m_Matrix(row, col);
195 return m_Matrix(row, col);
213 inline InternalMatrixType &
220 inline const InternalMatrixType &
230 m_Matrix.set_identity();
238 internalMatrix.set_identity();
239 return Self{ internalMatrix };
247 m_Matrix.fill(value);
260 inline explicit Matrix(
const vnl_matrix<T> & matrix)
268 template <
typename TElement>
269 explicit Matrix(
const TElement (&elements)[VRows][VColumns])
270 : m_Matrix(&elements[0][0])
272 static_assert(std::is_same_v<TElement, T>,
273 "The type of an element should correspond with this itk::Matrix instantiation.");
282 for (
unsigned int r = 0; r < VRows; ++r)
284 for (
unsigned int c = 0; c < VColumns; ++c)
302 this->m_Matrix = matrix;
312 inline vnl_matrix_fixed<T, VColumns, VRows>
315 if (vnl_determinant(m_Matrix) == T{})
317 itkGenericExceptionMacro(
"Singular matrix. Determinant is 0.");
319 const vnl_matrix_inverse<T> inverse(m_Matrix.as_ref());
320 return vnl_matrix_fixed<T, VColumns, VRows>{ inverse.as_matrix() };
325 inline vnl_matrix_fixed<T, VColumns, VRows>
328 return vnl_matrix_fixed<T, VColumns, VRows>{ m_Matrix.transpose().as_matrix() };
340 constexpr unsigned int
343 return m_Matrix.size();
350 return m_Matrix.begin();
357 return m_Matrix.end();
364 return m_Matrix.begin();
371 return m_Matrix.end();
378 return m_Matrix.begin();
385 return m_Matrix.end();
393 swap(this->m_Matrix, other.m_Matrix);
399 os << indent <<
"Matrix (" << VRows <<
"x" << VColumns <<
")\n";
400 for (
unsigned int r = 0; r < VRows; ++r)
403 for (
unsigned int c = 0; c < VColumns; ++c)
405 os << m_Matrix(r, c) <<
" ";
415template <
typename T,
unsigned int VRows,
unsigned int VColumns>
424template <
typename T,
unsigned int VRows,
unsigned int VColumns>
433#ifndef ITK_MANUAL_INSTANTIATION
434# include "itkMatrix.hxx"
Pixel-wise addition of two images.
A templated class holding a n-Dimensional covariant vector.
Control indentation during Print() invocation.
A templated class holding a M x N size Matrix.
constexpr unsigned int size() const
const_iterator cbegin() const
T & operator()(unsigned int row, unsigned int col)
Self operator/(const T &value) const
void operator/=(const T &value)
T * operator[](unsigned int i)
void Fill(const T &value)
Self operator-(const Self &matrix) const
Self & operator=(const InternalMatrixType &matrix)
const_iterator end() const
Self & operator=(const vnl_matrix< T > &matrix)
bool operator==(const Self &matrix) const
vnl_vector< T > operator*(const vnl_vector< T > &vc) const
const T & operator()(unsigned int row, unsigned int col) const
InternalMatrixType & GetVnlMatrix()
const_iterator begin() const
Matrix< T, VRows, OuterDim > operator*(const vnl_matrix_fixed< T, VRows, OuterDim > &matrix) const
static Self GetIdentity()
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Self)
CovariantVector< T, VRows > operator*(const CovariantVector< T, VColumns > &covect) const
const Self & operator+=(const Self &matrix)
vnl_vector_fixed< T, VRows > operator*(const vnl_vector_fixed< T, VColumns > &inVNLvect) const
void operator*=(const vnl_matrix< T > &matrix)
const Self & operator-=(const Self &matrix)
vnl_matrix< T > operator*(const vnl_matrix< T > &matrix) const
Matrix(const InternalMatrixType &matrix)
const ValueType & const_reference
void PrintSelf(std::ostream &os, Indent indent) const
Matrix(const vnl_matrix< T > &matrix)
const_iterator cend() const
Self operator*(const T &value) const
Self operator+(const Self &matrix) const
vnl_matrix_fixed< T, VColumns, VRows > GetTranspose() const
void operator*=(const CompatibleSquareMatrixType &matrix)
const ValueType * const_pointer
void swap(Self &other) noexcept
vnl_matrix_fixed< T, VColumns, VRows > GetInverse() const
vnl_matrix_fixed< T, VRows, VColumns > InternalMatrixType
const InternalMatrixType & GetVnlMatrix() const
const T * operator[](unsigned int i) const
void operator*=(const T &value)
Vector< T, VRows > operator*(const Vector< T, VColumns > &vect) const
Self operator*(const CompatibleSquareMatrixType &matrix) const
Matrix(const TElement(&elements)[VRows][VColumns])
InternalMatrixType m_Matrix
const ValueType * const_iterator
Point< T, VRows > operator*(const Point< T, VColumns > &pnt) const
A templated class holding a geometric point in n-Dimensional space.
A templated class holding a n-Dimensional vector.
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
void swap(Array< T > &a, Array< T > &b) noexcept
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
void swap(const Matrix< T, VRows, VColumns > &a, const Matrix< T, VRows, VColumns > &b) noexcept