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;
102 vnl_vector_fixed<T, VRows>
operator*(
const vnl_vector_fixed<T, VColumns> & inVNLvect)
const;
107 template <
unsigned int OuterDim>
129 vnl_matrix<T>
operator*(
const vnl_matrix<T> & matrix)
const;
140 vnl_vector<T>
operator*(
const vnl_vector<T> & vc)
const;
179 return m_Matrix(row, col);
186 return m_Matrix(row, col);
190 inline T *
operator[](
unsigned int i) {
return m_Matrix[i]; }
193 inline const T *
operator[](
unsigned int i)
const {
return m_Matrix[i]; }
196 inline InternalMatrixType &
203 inline const InternalMatrixType &
213 m_Matrix.set_identity();
221 internalMatrix.set_identity();
222 return Self{ internalMatrix };
230 m_Matrix.fill(value);
243 inline explicit Matrix(
const vnl_matrix<T> & matrix)
251 template <
typename TElement>
252 explicit Matrix(
const TElement (&elements)[VRows][VColumns])
253 : m_Matrix(&elements[0][0])
255 static_assert(std::is_same_v<TElement, T>,
256 "The type of an element should correspond with this itk::Matrix instantiation.");
265 for (
unsigned int r = 0; r < VRows; ++r)
267 for (
unsigned int c = 0; c < VColumns; ++c)
285 this->m_Matrix = matrix;
295 inline vnl_matrix_fixed<T, VColumns, VRows>
298 if (vnl_determinant(m_Matrix) == T{})
300 itkGenericExceptionMacro(
"Singular matrix. Determinant is 0.");
302 vnl_matrix_inverse<T> inverse(m_Matrix.as_ref());
303 return vnl_matrix_fixed<T, VColumns, VRows>{ inverse.as_matrix() };
308 inline vnl_matrix_fixed<T, VColumns, VRows>
311 return vnl_matrix_fixed<T, VColumns, VRows>{ m_Matrix.transpose().as_matrix() };
323 constexpr unsigned int
326 return m_Matrix.size();
333 return m_Matrix.begin();
340 return m_Matrix.end();
347 return m_Matrix.begin();
354 return m_Matrix.end();
361 return m_Matrix.begin();
368 return m_Matrix.end();
382 os << indent <<
"Matrix (" << VRows <<
"x" << VColumns <<
")\n";
383 for (
unsigned int r = 0; r < VRows; ++r)
386 for (
unsigned int c = 0; c < VColumns; ++c)
388 os << m_Matrix(r, c) <<
" ";
398template <
typename T,
unsigned int VRows,
unsigned int VColumns>
407template <
typename T,
unsigned int VRows,
unsigned int VColumns>
416#ifndef ITK_MANUAL_INSTANTIATION
417# 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
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)