ITK  6.0.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members

#include <itkSymmetricSecondRankTensor.h>

Detailed Description

template<typename TComponent, unsigned int VDimension = 3>
class itk::SymmetricSecondRankTensor< TComponent, VDimension >

Represent a symmetric tensor of second rank.

This class implements a ND symmetric tensor of second rank.

Since SymmetricSecondRankTensor is a subclass of FixedArray, you can access its components as:

using TensorPixelType = itk::SymmetricSecondRankTensor< float >; TensorPixelType tensor;

tensor[0] = 1.233; tensor[1] = 1.456;

for convenience the indexed access is also available as

tensor(0,0) = 1.233; tensor(2,0) = 1.233;

The Tensor in principle represents a NxN matrix, but given that it is always symmetric the representation can be compacted into a N*(N+1)/2 elements array that derives from the itk::FixedArray<T>

Author
Jeffrey Duda from School of Engineering at University of Pennsylvania
Torsten Rohlfing from SRI International Neuroscience Program.

This class was mostly based on files that Jeffrey Duda, Torsten Rohlfing and Martin Styner contributed to the ITK users list during a discussion on support for DiffusionTensorImages. The funding for creating this class was largely provided by NAMIC (National Alliance for Medical Image Computing) (https://www.na-mic.org). A discussion on the design of this class can be found in the WIKI pages of NAMIC:

https://www.na-mic.org/Wiki/index.php/NAMIC_Wiki:DTI:ITK-DiffusionTensorPixelType

See also
DiffusionTensor3D
Examples
SphinxExamples/src/Nonunit/Review/SegmentBloodVesselsWithMultiScaleHessianBasedMeasure/Code.cxx.

Definition at line 75 of file itkSymmetricSecondRankTensor.h.

+ Inheritance diagram for itk::SymmetricSecondRankTensor< TComponent, VDimension >:
+ Collaboration diagram for itk::SymmetricSecondRankTensor< TComponent, VDimension >:

Public Types

using AccumulateValueType = typename NumericTraits< ValueType >::RealType
 
using BaseArray = FixedArray< TComponent, Self::InternalDimension >
 
using ComponentArrayType = ComponentType[Self::InternalDimension]
 
using ComponentType = TComponent
 
using EigenValuesArrayType = FixedArray< TComponent, VDimension >
 
using EigenVectorsMatrixType = Matrix< TComponent, VDimension, VDimension >
 
using MatrixType = Matrix< TComponent, VDimension, VDimension >
 
using RealValueType = typename NumericTraits< ValueType >::RealType
 
using Self = SymmetricSecondRankTensor
 
using Superclass = FixedArray< TComponent, VDimension *(VDimension+1)/2 >
 
using SymmetricEigenAnalysisType = SymmetricEigenAnalysisFixedDimension< Dimension, MatrixType, EigenValuesArrayType, EigenVectorsMatrixType >
 
- Public Types inherited from itk::FixedArray< TComponent, VDimension *(VDimension+1)/2 >
using CArray = ValueType[VLength]
 
using const_iterator = const ValueType *
 
using const_pointer = const ValueType *
 
using const_reference = const ValueType &
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using ConstIterator = const ValueType *
 
using Iterator = ValueType *
 
using iterator = ValueType *
 
using pointer = ValueType *
 
using reference = ValueType &
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using SizeType = unsigned int
 
using ValueType = TComponent
 

Public Member Functions

void ComputeEigenAnalysis (EigenValuesArrayType &eigenValues, EigenVectorsMatrixType &eigenVectors) const
 
void ComputeEigenValues (EigenValuesArrayType &eigenValues) const
 
ComponentType GetNthComponent (int c) const
 
AccumulateValueType GetTrace () const
 
ValueTypeoperator() (unsigned int row, unsigned int col)
 
const ValueTypeoperator() (unsigned int row, unsigned int col) const
 
Self operator* (const RealValueType &r) const
 
const Selfoperator*= (const RealValueType &r)
 
Self operator+ (const Self &r) const
 
const Selfoperator+= (const Self &r)
 
Self operator- (const Self &r) const
 
const Selfoperator-= (const Self &r)
 
Self operator/ (const RealValueType &r) const
 
const Selfoperator/= (const RealValueType &r)
 
Selfoperator= (const ComponentArrayType r)
 
Selfoperator= (const ComponentType &r)
 
MatrixType PostMultiply (const MatrixType &m) const
 
MatrixType PreMultiply (const MatrixType &m) const
 
void SetIdentity ()
 
void SetNthComponent (int c, const ComponentType &v)
 
 SymmetricSecondRankTensor (const ComponentArrayType r)
 
 SymmetricSecondRankTensor (const ComponentType &r)
 
template<typename TCoordRepB >
 SymmetricSecondRankTensor (const SymmetricSecondRankTensor< TCoordRepB, VDimension > &pa)
 
 SymmetricSecondRankTensor ()=default
 
template<typename TCoordRepB >
Selfoperator= (const SymmetricSecondRankTensor< TCoordRepB, VDimension > &pa)
 
template<typename TMatrixValueType >
Self Rotate (const Matrix< TMatrixValueType, VDimension, VDimension > &m) const
 
template<typename TMatrixValueType >
Self Rotate (const vnl_matrix_fixed< TMatrixValueType, VDimension, VDimension > &m) const
 
template<typename TMatrixValueType >
Self Rotate (const vnl_matrix< TMatrixValueType > &m) const
 
- Public Member Functions inherited from itk::FixedArray< TComponent, VDimension *(VDimension+1)/2 >
Iterator Begin ()
 
ConstIterator Begin () const
 
constexpr const_iterator begin () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
ValueTypedata ()
 
const ValueTypedata () const
 
Iterator End ()
 
ConstIterator End () const
 
constexpr const_iterator end () const noexcept
 
constexpr iterator end () noexcept
 
void Fill (const ValueType &)
 
 FixedArray ()=default
 
 FixedArray (const FixedArray< TFixedArrayValueType, VLength > &r)
 
 FixedArray (const std::array< ValueType, VLength > &stdArray)
 
 FixedArray (const TScalarValue *r)
 
ValueTypeGetDataPointer ()
 
const ValueTypeGetDataPointer () const
 
 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (FixedArray)
 
 itkLegacyMacro (ReverseIterator rBegin();) itkLegacyMacro(ConstReverseIterator rBegin() const
 
 itkLegacyMacro (ReverseIterator rEnd();) itkLegacyMacro(ConstReverseIterator rEnd() const
 
FixedArrayoperator= (const FixedArray< TFixedArrayValueType, VLength > &r)
 
FixedArrayoperator= (const ValueType r[VLength])
 
bool operator== (const FixedArray &r) const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
SizeType Size () const
 
constexpr SizeType size () const
 
void swap (FixedArray &other)
 
 FixedArray (const ValueType r[VLength])
 
 FixedArray (const ValueType &)
 
ITK_GCC_PRAGMA_PUSH constexpr ITK_GCC_SUPPRESS_Warray_bounds reference operator[] (unsigned int index)
 
constexpr const_reference operator[] (unsigned int index) const
 
ITK_GCC_PRAGMA_POP void SetElement (unsigned int index, const_reference value)
 
const_reference GetElement (unsigned int index) const
 

Static Public Member Functions

static unsigned int GetNumberOfComponents ()
 
- Static Public Member Functions inherited from itk::FixedArray< TComponent, VDimension *(VDimension+1)/2 >
static constexpr FixedArray Filled (const ValueType &value)
 

Static Public Attributes

static constexpr unsigned int Dimension = VDimension
 
static constexpr unsigned int InternalDimension = VDimension * (VDimension + 1) / 2
 
- Static Public Attributes inherited from itk::FixedArray< TComponent, VDimension *(VDimension+1)/2 >
static constexpr unsigned int Dimension
 
static constexpr unsigned int Length
 

Member Typedef Documentation

◆ AccumulateValueType

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::AccumulateValueType = typename NumericTraits<ValueType>::RealType

Definition at line 99 of file itkSymmetricSecondRankTensor.h.

◆ BaseArray

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::BaseArray = FixedArray<TComponent, Self::InternalDimension>

Convenience type alias.

Definition at line 87 of file itkSymmetricSecondRankTensor.h.

◆ ComponentArrayType

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::ComponentArrayType = ComponentType[Self::InternalDimension]

Definition at line 122 of file itkSymmetricSecondRankTensor.h.

◆ ComponentType

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::ComponentType = TComponent

Define the component type.

Definition at line 97 of file itkSymmetricSecondRankTensor.h.

◆ EigenValuesArrayType

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::EigenValuesArrayType = FixedArray<TComponent, VDimension>

Array of eigen-values.

Definition at line 90 of file itkSymmetricSecondRankTensor.h.

◆ EigenVectorsMatrixType

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::EigenVectorsMatrixType = Matrix<TComponent, VDimension, VDimension>

Definition at line 94 of file itkSymmetricSecondRankTensor.h.

◆ MatrixType

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::MatrixType = Matrix<TComponent, VDimension, VDimension>

Matrix of eigen-vectors.

Definition at line 93 of file itkSymmetricSecondRankTensor.h.

◆ RealValueType

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::RealValueType = typename NumericTraits<ValueType>::RealType

Definition at line 100 of file itkSymmetricSecondRankTensor.h.

◆ Self

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::Self = SymmetricSecondRankTensor

Standard class type aliases.

Definition at line 79 of file itkSymmetricSecondRankTensor.h.

◆ Superclass

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::Superclass = FixedArray<TComponent, VDimension *(VDimension + 1) / 2>

Definition at line 80 of file itkSymmetricSecondRankTensor.h.

◆ SymmetricEigenAnalysisType

template<typename TComponent, unsigned int VDimension = 3>
using itk::SymmetricSecondRankTensor< TComponent, VDimension >::SymmetricEigenAnalysisType = SymmetricEigenAnalysisFixedDimension<Dimension, MatrixType, EigenValuesArrayType, EigenVectorsMatrixType>

Definition at line 103 of file itkSymmetricSecondRankTensor.h.

Constructor & Destructor Documentation

◆ SymmetricSecondRankTensor() [1/4]

template<typename TComponent, unsigned int VDimension = 3>
itk::SymmetricSecondRankTensor< TComponent, VDimension >::SymmetricSecondRankTensor ( )
default

Default-constructor.

Note
The other five "special member functions" are defaulted implicitly, following the C++ "Rule of Zero".

◆ SymmetricSecondRankTensor() [2/4]

template<typename TComponent, unsigned int VDimension = 3>
itk::SymmetricSecondRankTensor< TComponent, VDimension >::SymmetricSecondRankTensor ( const ComponentType r)
inline

Definition at line 114 of file itkSymmetricSecondRankTensor.h.

◆ SymmetricSecondRankTensor() [3/4]

template<typename TComponent, unsigned int VDimension = 3>
template<typename TCoordRepB >
itk::SymmetricSecondRankTensor< TComponent, VDimension >::SymmetricSecondRankTensor ( const SymmetricSecondRankTensor< TCoordRepB, VDimension > &  pa)
inline

Constructor to enable casting...

Definition at line 118 of file itkSymmetricSecondRankTensor.h.

◆ SymmetricSecondRankTensor() [4/4]

template<typename TComponent, unsigned int VDimension = 3>
itk::SymmetricSecondRankTensor< TComponent, VDimension >::SymmetricSecondRankTensor ( const ComponentArrayType  r)
inline

Pass-through constructor for the Array base class.

Definition at line 125 of file itkSymmetricSecondRankTensor.h.

Member Function Documentation

◆ ComputeEigenAnalysis()

template<typename TComponent, unsigned int VDimension = 3>
void itk::SymmetricSecondRankTensor< TComponent, VDimension >::ComputeEigenAnalysis ( EigenValuesArrayType eigenValues,
EigenVectorsMatrixType eigenVectors 
) const

Return an array containing EigenValues, and a matrix containing Eigen vectors.

◆ ComputeEigenValues()

template<typename TComponent, unsigned int VDimension = 3>
void itk::SymmetricSecondRankTensor< TComponent, VDimension >::ComputeEigenValues ( EigenValuesArrayType eigenValues) const

Return an array containing EigenValues.

◆ GetNthComponent()

template<typename TComponent, unsigned int VDimension = 3>
ComponentType itk::SymmetricSecondRankTensor< TComponent, VDimension >::GetNthComponent ( int  c) const
inline

Return the value for the Nth component.

Definition at line 181 of file itkSymmetricSecondRankTensor.h.

◆ GetNumberOfComponents()

template<typename TComponent, unsigned int VDimension = 3>
static unsigned int itk::SymmetricSecondRankTensor< TComponent, VDimension >::GetNumberOfComponents ( )
inlinestatic

Return the number of components.

Definition at line 174 of file itkSymmetricSecondRankTensor.h.

◆ GetTrace()

template<typename TComponent, unsigned int VDimension = 3>
AccumulateValueType itk::SymmetricSecondRankTensor< TComponent, VDimension >::GetTrace ( ) const

Get Trace value

◆ operator()() [1/2]

template<typename TComponent, unsigned int VDimension = 3>
ValueType& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator() ( unsigned int  row,
unsigned int  col 
)

Matrix notation, in const and non-const forms.

◆ operator()() [2/2]

template<typename TComponent, unsigned int VDimension = 3>
const ValueType& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator() ( unsigned int  row,
unsigned int  col 
) const

◆ operator*()

template<typename TComponent, unsigned int VDimension = 3>
Self itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator* ( const RealValueType r) const

Arithmetic operations between tensors and scalars

◆ operator*=()

template<typename TComponent, unsigned int VDimension = 3>
const Self& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator*= ( const RealValueType r)

◆ operator+()

template<typename TComponent, unsigned int VDimension = 3>
Self itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator+ ( const Self r) const

Arithmetic operations between pixels. Return a new SymmetricSecondRankTensor.

◆ operator+=()

template<typename TComponent, unsigned int VDimension = 3>
const Self& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator+= ( const Self r)

◆ operator-()

template<typename TComponent, unsigned int VDimension = 3>
Self itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator- ( const Self r) const

◆ operator-=()

template<typename TComponent, unsigned int VDimension = 3>
const Self& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator-= ( const Self r)

◆ operator/()

template<typename TComponent, unsigned int VDimension = 3>
Self itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator/ ( const RealValueType r) const

◆ operator/=()

template<typename TComponent, unsigned int VDimension = 3>
const Self& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator/= ( const RealValueType r)

◆ operator=() [1/3]

template<typename TComponent, unsigned int VDimension = 3>
Self& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator= ( const ComponentArrayType  r)

◆ operator=() [2/3]

template<typename TComponent, unsigned int VDimension = 3>
Self& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator= ( const ComponentType r)

Pass-through assignment operator for the Array base class.

◆ operator=() [3/3]

template<typename TComponent, unsigned int VDimension = 3>
template<typename TCoordRepB >
Self& itk::SymmetricSecondRankTensor< TComponent, VDimension >::operator= ( const SymmetricSecondRankTensor< TCoordRepB, VDimension > &  pa)
inline

Templated Pass-through assignment for the Array base class.

Definition at line 132 of file itkSymmetricSecondRankTensor.h.

Referenced by itk::DiffusionTensor3D< TComponent >::operator=().

◆ PostMultiply()

template<typename TComponent, unsigned int VDimension = 3>
MatrixType itk::SymmetricSecondRankTensor< TComponent, VDimension >::PostMultiply ( const MatrixType m) const

Post-Multiply by a Matrix as ResultingMatrix = ThisTensor * Matrix.

◆ PreMultiply()

template<typename TComponent, unsigned int VDimension = 3>
MatrixType itk::SymmetricSecondRankTensor< TComponent, VDimension >::PreMultiply ( const MatrixType m) const

Pre-Multiply by a Matrix as ResultingMatrix = Matrix * ThisTensor.

◆ Rotate() [1/3]

template<typename TComponent, unsigned int VDimension = 3>
template<typename TMatrixValueType >
Self itk::SymmetricSecondRankTensor< TComponent, VDimension >::Rotate ( const Matrix< TMatrixValueType, VDimension, VDimension > &  m) const

Returns the tensor rotated by the provided matrix. ResultingTensor = Matrix * ThisTensor * Matrix.GetTranspose()

◆ Rotate() [2/3]

template<typename TComponent, unsigned int VDimension = 3>
template<typename TMatrixValueType >
Self itk::SymmetricSecondRankTensor< TComponent, VDimension >::Rotate ( const vnl_matrix< TMatrixValueType > &  m) const
inline

Returns the tensor rotated by the provided matrix. ResultingTensor = Matrix * ThisTensor * Matrix.GetTranspose()

Definition at line 232 of file itkSymmetricSecondRankTensor.h.

◆ Rotate() [3/3]

template<typename TComponent, unsigned int VDimension = 3>
template<typename TMatrixValueType >
Self itk::SymmetricSecondRankTensor< TComponent, VDimension >::Rotate ( const vnl_matrix_fixed< TMatrixValueType, VDimension, VDimension > &  m) const
inline

Returns the tensor rotated by the provided matrix. ResultingTensor = Matrix * ThisTensor * Matrix.GetTranspose()

Definition at line 226 of file itkSymmetricSecondRankTensor.h.

◆ SetIdentity()

template<typename TComponent, unsigned int VDimension = 3>
void itk::SymmetricSecondRankTensor< TComponent, VDimension >::SetIdentity ( )

Set the tensor to an identity tensor. This has 1 in its diagonal elements and zero elsewhere.

◆ SetNthComponent()

template<typename TComponent, unsigned int VDimension = 3>
void itk::SymmetricSecondRankTensor< TComponent, VDimension >::SetNthComponent ( int  c,
const ComponentType v 
)
inline

Set the Nth component to v.

Definition at line 188 of file itkSymmetricSecondRankTensor.h.

Member Data Documentation

◆ Dimension

template<typename TComponent, unsigned int VDimension = 3>
constexpr unsigned int itk::SymmetricSecondRankTensor< TComponent, VDimension >::Dimension = VDimension
staticconstexpr

Dimension of the vector space.

Definition at line 83 of file itkSymmetricSecondRankTensor.h.

◆ InternalDimension

template<typename TComponent, unsigned int VDimension = 3>
constexpr unsigned int itk::SymmetricSecondRankTensor< TComponent, VDimension >::InternalDimension = VDimension * (VDimension + 1) / 2
staticconstexpr

Definition at line 84 of file itkSymmetricSecondRankTensor.h.


The documentation for this class was generated from the following file: