 |
ITK
5.4.0
Insight Toolkit
|
Go to the documentation of this file.
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"
31 #include <type_traits>
51 template <
typename T,
unsigned int VRows = 3,
unsigned int VColumns = 3>
63 static constexpr
unsigned int RowDimensions = VRows;
64 static constexpr
unsigned int ColumnDimensions = VColumns;
84 vnl_vector_fixed<T, VRows>
operator*(
const vnl_vector_fixed<T, VColumns> & inVNLvect)
const;
89 template <
unsigned int OuterDim>
101 operator+=(
const Self & matrix);
108 operator-=(
const Self & matrix);
111 vnl_matrix<T>
operator*(
const vnl_matrix<T> & matrix)
const;
115 operator*=(
const CompatibleSquareMatrixType & matrix);
119 operator*=(
const vnl_matrix<T> & matrix);
122 vnl_vector<T>
operator*(
const vnl_vector<T> & vc)
const;
161 return m_Matrix(row, col);
168 return m_Matrix(row, col);
172 inline T *
operator[](
unsigned int i) {
return m_Matrix[i]; }
175 inline const T *
operator[](
unsigned int i)
const {
return m_Matrix[i]; }
178 inline InternalMatrixType &
185 inline const InternalMatrixType &
195 m_Matrix.set_identity();
203 internalMatrix.set_identity();
204 return Self{ internalMatrix };
212 m_Matrix.fill(value);
225 inline explicit Matrix(
const vnl_matrix<T> & matrix)
233 template <
typename TElement>
234 explicit Matrix(
const TElement (&elements)[VRows][VColumns])
235 : m_Matrix(&elements[0][0])
237 static_assert(std::is_same<TElement, T>::value,
238 "The type of an element should correspond with this itk::Matrix instantiation.");
247 for (
unsigned int r = 0; r < VRows; ++r)
249 for (
unsigned int c = 0; c < VColumns; ++c)
261 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(
Self);
267 this->m_Matrix = matrix;
277 inline vnl_matrix_fixed<T, VColumns, VRows>
282 itkGenericExceptionMacro(<<
"Singular matrix. Determinant is 0.");
284 vnl_matrix_inverse<T> inverse(m_Matrix.as_ref());
285 return vnl_matrix_fixed<T, VColumns, VRows>{ inverse.as_matrix() };
290 inline vnl_matrix_fixed<T, VColumns, VRows>
293 return vnl_matrix_fixed<T, VColumns, VRows>{ m_Matrix.transpose().as_matrix() };
316 template <
typename T,
unsigned int VRows,
unsigned int VColumns>
325 template <
typename T,
unsigned int VRows,
unsigned int VColumns>
334 #ifndef ITK_MANUAL_INSTANTIATION
335 # include "itkMatrix.hxx"
const T & operator()(unsigned int row, unsigned int col) const
Self & operator=(const vnl_matrix< T > &matrix)
const T * operator[](unsigned int i) const
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
CovariantVector< T, VVectorDimension > operator*(const T &scalar, const CovariantVector< T, VVectorDimension > &v)
Self operator/(const T &value) const
void operator/=(const T &value)
vnl_matrix_fixed< double, VRows, VColumns > InternalMatrixType
Self operator*(const T &value) const
void swap(Array< T > &a, Array< T > &b)
A templated class holding a n-Dimensional vector.
ConstNeighborhoodIterator< TImage > operator-(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
Matrix(const vnl_matrix< T > &matrix)
bool operator==(const Self &matrix) const
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
static Self GetIdentity()
T & operator()(unsigned int row, unsigned int col)
const InternalMatrixType & GetVnlMatrix() const
InternalMatrixType & GetVnlMatrix()
Matrix< T, VRows, OuterDim > operator*(const vnl_matrix_fixed< T, VRows, OuterDim > &matrix) const
Self & operator=(const InternalMatrixType &matrix)
T * operator[](unsigned int i)
Matrix(const TElement(&elements)[VRows][VColumns])
A templated class holding a M x N size Matrix.
InternalMatrixType m_Matrix
void Fill(const T &value)
Define additional traits for native types such as int or float.
A templated class holding a n-Dimensional covariant vector.
void swap(const Matrix< T, VRows, VColumns > &a, const Matrix< T, VRows, VColumns > &b)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ConstNeighborhoodIterator< TImage > operator+(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
A templated class holding a geometric point in n-Dimensional space.
void operator*=(const T &value)
vnl_matrix_fixed< T, VColumns, VRows > GetTranspose() const
vnl_matrix_fixed< T, VColumns, VRows > GetInverse() const
Matrix(const InternalMatrixType &matrix)