ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
itk::CovariantVector< T, NVectorDimension > Class Template Reference

#include <itkCovariantVector.h>

+ Inheritance diagram for itk::CovariantVector< T, NVectorDimension >:
+ Collaboration diagram for itk::CovariantVector< T, NVectorDimension >:

Public Types

using BaseArray = FixedArray< T, NVectorDimension >
 
using ComponentType = T
 
using CovariantVectorType = Self
 
using RealValueType = typename NumericTraits< ValueType >::RealType
 
using Self = CovariantVector
 
using Superclass = FixedArray< T, NVectorDimension >
 
using ValueType = T
 
- Public Types inherited from itk::FixedArray< T, NVectorDimension >
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 = T
 

Public Member Functions

vnl_vector_ref< T > GetVnlVector ()
 
vnl_vector< T > GetVnlVector () const
 
void SetVnlVector (const vnl_vector< T > &)
 
- Public Member Functions inherited from itk::FixedArray< T, NVectorDimension >
 FixedArray ()=default
 
 FixedArray (const FixedArray &)=default
 
 FixedArray (FixedArray &&)=default
 
 FixedArray (const ValueType r[VLength])
 
 FixedArray (const ValueType &)
 
 FixedArray (const std::array< ValueType, VLength > &stdArray)
 
 FixedArray (const FixedArray< TFixedArrayValueType, VLength > &r)
 
 FixedArray (const TScalarValue *r)
 
FixedArrayoperator= (const FixedArray &)=default
 
FixedArrayoperator= (FixedArray &&)=default
 
FixedArrayoperator= (const FixedArray< TFixedArrayValueType, VLength > &r)
 
FixedArrayoperator= (const ValueType r[VLength])
 
 ~FixedArray ()=default
 
bool operator== (const FixedArray &r) const
 
bool operator!= (const FixedArray &r) const
 
reference operator[] (short index)
 
const_reference operator[] (short index) const
 
reference operator[] (unsigned short index)
 
const_reference operator[] (unsigned short index) const
 
reference operator[] (int index)
 
const_reference operator[] (int index) const
 
reference operator[] (unsigned int index)
 
const_reference operator[] (unsigned int index) const
 
reference operator[] (long index)
 
const_reference operator[] (long index) const
 
reference operator[] (unsigned long index)
 
const_reference operator[] (unsigned long index) const
 
reference operator[] (long long index)
 
const_reference operator[] (long long index) const
 
reference operator[] (unsigned long long index)
 
const_reference operator[] (unsigned long long index) const
 
void SetElement (unsigned int index, const_reference value)
 
const_reference GetElement (unsigned int index) const
 
ValueTypeGetDataPointer ()
 
const ValueTypeGetDataPointer () const
 
ValueTypedata ()
 
const ValueTypedata () const
 
Iterator Begin ()
 
ConstIterator Begin () const
 
Iterator End ()
 
ConstIterator End () const
 
 itkLegacyMacro (ReverseIterator rBegin())
 
 itkLegacyMacro (ConstReverseIterator rBegin() const)
 
 itkLegacyMacro (ReverseIterator rEnd())
 
 itkLegacyMacro (ConstReverseIterator rEnd() const)
 
const_iterator cbegin () const noexcept
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cend () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator crbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
const_reverse_iterator crend () const
 
SizeType Size () const
 
constexpr SizeType size () const
 
void Fill (const ValueType &)
 
void swap (FixedArray &other)
 

Static Public Member Functions

static unsigned int GetCovariantVectorDimension ()
 
- Static Public Member Functions inherited from itk::FixedArray< T, NVectorDimension >
static FixedArray Filled (const ValueType &)
 

Static Public Attributes

static constexpr unsigned int Dimension = NVectorDimension
 
- Static Public Attributes inherited from itk::FixedArray< T, NVectorDimension >
static constexpr unsigned int Dimension
 
static constexpr unsigned int Length
 
static unsigned int GetNumberOfComponents ()
 
 CovariantVector ()=default
 
 CovariantVector (const CovariantVector &)=default
 
 CovariantVector (CovariantVector &&)=default
 
CovariantVectoroperator= (const CovariantVector &)=default
 
CovariantVectoroperator= (CovariantVector &&)=default
 
 ~CovariantVector ()=default
 
 CovariantVector (const ValueType &r)
 
template<typename TVectorValueType >
 CovariantVector (const CovariantVector< TVectorValueType, NVectorDimension > &r)
 
 CovariantVector (const ValueType r[Dimension])
 
template<typename TCovariantVectorValueType >
Selfoperator= (const CovariantVector< TCovariantVectorValueType, NVectorDimension > &r)
 
CovariantVectoroperator= (const ValueType r[NVectorDimension])
 
template<typename Tt >
const Selfoperator*= (const Tt &value)
 
template<typename Tt >
const Selfoperator/= (const Tt &value)
 
const Selfoperator+= (const Self &vec)
 
const Selfoperator-= (const Self &vec)
 
Self operator- () const
 
Self operator+ (const Self &vec) const
 
Self operator- (const Self &vec) const
 
ValueType operator* (const Self &other) const
 
ValueType operator* (const Vector< T, NVectorDimension > &other) const
 
Self operator* (const ValueType &val) const
 
template<typename Tt >
Self operator/ (const Tt &val) const
 
RealValueType GetNorm () const
 
RealValueType Normalize ()
 
RealValueType GetSquaredNorm () const
 
template<typename TCoordRepB >
void CastFrom (const CovariantVector< TCoordRepB, NVectorDimension > &pa)
 

Detailed Description

template<typename T, unsigned int NVectorDimension = 3>
class itk::CovariantVector< T, NVectorDimension >

A templated class holding a n-Dimensional covariant vector.

CovariantVector is a templated class that holds a single vector (i.e., an array of values). CovariantVector can be used as the data type held at each pixel in an Image or at each vertex of an Mesh. The template parameter T can be any data type that behaves like a primitive (or atomic) data type (int, short, float, complex). The NVectorDimension defines the number of components in the vector array.

CovariantVector is not a dynamically extendible array like std::vector. It is intended to be used like a mathematical vector.

If you wish a simpler pixel types, you can use Scalar, which represents a single data value at a pixel. There is also the more complex type ScalarCovariantVector, which supports (for a given pixel) a single scalar value plus an array of vector values. (The scalar and vectors can be of different data type.)

CovariantVector is the type that should be used for representing normals to surfaces and gradients of functions. AffineTransform transform covariant vectors different than vectors.

See also
Image
Mesh
Point
Vector
Matrix
ITK Sphinx Examples:
Examples
Examples/DataRepresentation/Image/ImageAdaptor3.cxx, Examples/DataRepresentation/Mesh/PointSetWithCovariantVectors.cxx, Examples/Filtering/GradientRecursiveGaussianImageFilter.cxx, Examples/Filtering/VectorCurvatureAnisotropicDiffusionImageFilter.cxx, Examples/Filtering/VectorGradientAnisotropicDiffusionImageFilter.cxx, Examples/IO/CovariantVectorImageExtractComponent.cxx, Examples/IO/CovariantVectorImageRead.cxx, Examples/IO/CovariantVectorImageWrite.cxx, SphinxExamples/src/Core/Common/CovariantVectorDotProduct/Code.cxx, SphinxExamples/src/Core/Common/CreateACovariantVector/Code.cxx, SphinxExamples/src/Core/ImageAdaptors/ExtractChannelOfImageWithMultipleComponents/Code.cxx, SphinxExamples/src/Core/ImageAdaptors/PresentImageAfterOperation/Code.cxx, SphinxExamples/src/Core/ImageAdaptors/ProcessNthComponentOfVectorImage/Code.cxx, SphinxExamples/src/Filtering/Convolution/ColorNormalizedCorrelation/Code.cxx, SphinxExamples/src/Filtering/ImageGradient/ApplyGradientRecursiveGaussian/Code.cxx, SphinxExamples/src/Filtering/ImageGradient/ApplyGradientRecursiveGaussianWithVectorInput/Code.cxx, SphinxExamples/src/Filtering/ImageGradient/ComputeAndDisplayGradient/Code.cxx, SphinxExamples/src/Filtering/ImageGradient/GradientOfVectorImage/Code.cxx, SphinxExamples/src/Filtering/ImageGradient/ImplementationOfSnakes/Code.cxx, and SphinxExamples/src/Numerics/Statistics/DistributionOfPixelsUsingGMM/Code.cxx.

Definition at line 70 of file itkCovariantVector.h.

Member Typedef Documentation

◆ BaseArray

template<typename T, unsigned int NVectorDimension = 3>
using itk::CovariantVector< T, NVectorDimension >::BaseArray = FixedArray<T, NVectorDimension>

The Array type from which this CovariantVector is derived.

Definition at line 92 of file itkCovariantVector.h.

◆ ComponentType

template<typename T, unsigned int NVectorDimension = 3>
using itk::CovariantVector< T, NVectorDimension >::ComponentType = T

Component value type

Definition at line 83 of file itkCovariantVector.h.

◆ CovariantVectorType

template<typename T, unsigned int NVectorDimension = 3>
using itk::CovariantVector< T, NVectorDimension >::CovariantVectorType = Self

I am a covariant vector.

Definition at line 89 of file itkCovariantVector.h.

◆ RealValueType

template<typename T, unsigned int NVectorDimension = 3>
using itk::CovariantVector< T, NVectorDimension >::RealValueType = typename NumericTraits<ValueType>::RealType

Definition at line 80 of file itkCovariantVector.h.

◆ Self

template<typename T, unsigned int NVectorDimension = 3>
using itk::CovariantVector< T, NVectorDimension >::Self = CovariantVector

Standard class type aliases.

Definition at line 74 of file itkCovariantVector.h.

◆ Superclass

template<typename T, unsigned int NVectorDimension = 3>
using itk::CovariantVector< T, NVectorDimension >::Superclass = FixedArray<T, NVectorDimension>

Definition at line 75 of file itkCovariantVector.h.

◆ ValueType

template<typename T, unsigned int NVectorDimension = 3>
using itk::CovariantVector< T, NVectorDimension >::ValueType = T

ValueType can be used to declare a variable that is the same type as a data element held in an CovariantVector.

Definition at line 79 of file itkCovariantVector.h.

Constructor & Destructor Documentation

◆ CovariantVector() [1/6]

template<typename T, unsigned int NVectorDimension = 3>
itk::CovariantVector< T, NVectorDimension >::CovariantVector ( )
default

Default constructor.

◆ CovariantVector() [2/6]

template<typename T, unsigned int NVectorDimension = 3>
itk::CovariantVector< T, NVectorDimension >::CovariantVector ( const CovariantVector< T, NVectorDimension > &  )
default

Returns the number of components in this vector type

◆ CovariantVector() [3/6]

template<typename T, unsigned int NVectorDimension = 3>
itk::CovariantVector< T, NVectorDimension >::CovariantVector ( CovariantVector< T, NVectorDimension > &&  )
default

Returns the number of components in this vector type

◆ ~CovariantVector()

template<typename T, unsigned int NVectorDimension = 3>
itk::CovariantVector< T, NVectorDimension >::~CovariantVector ( )
default

Returns the number of components in this vector type

◆ CovariantVector() [4/6]

template<typename T, unsigned int NVectorDimension = 3>
itk::CovariantVector< T, NVectorDimension >::CovariantVector ( const ValueType r)
explicit

Constructor to initialize entire vector to one value.

◆ CovariantVector() [5/6]

template<typename T, unsigned int NVectorDimension = 3>
template<typename TVectorValueType >
itk::CovariantVector< T, NVectorDimension >::CovariantVector ( const CovariantVector< TVectorValueType, NVectorDimension > &  r)
inline

Pass-through constructor for the Array base class. Implicit casting is performed to initialize constructor from any another one of datatype.

Definition at line 132 of file itkCovariantVector.h.

◆ CovariantVector() [6/6]

template<typename T, unsigned int NVectorDimension = 3>
itk::CovariantVector< T, NVectorDimension >::CovariantVector ( const ValueType  r[Dimension])
inline

Returns the number of components in this vector type

Definition at line 135 of file itkCovariantVector.h.

Member Function Documentation

◆ CastFrom()

template<typename T, unsigned int NVectorDimension = 3>
template<typename TCoordRepB >
void itk::CovariantVector< T, NVectorDimension >::CastFrom ( const CovariantVector< TCoordRepB, NVectorDimension > &  pa)
inline

Copy from another CovariantVector with a different representation type. Casting is done with C-Like rules

Definition at line 262 of file itkCovariantVector.h.

◆ GetCovariantVectorDimension()

template<typename T, unsigned int NVectorDimension = 3>
static unsigned int itk::CovariantVector< T, NVectorDimension >::GetCovariantVectorDimension ( )
inlinestatic

Get the dimension (size) of the vector.

Definition at line 96 of file itkCovariantVector.h.

◆ GetNorm()

template<typename T, unsigned int NVectorDimension = 3>
RealValueType itk::CovariantVector< T, NVectorDimension >::GetNorm ( ) const

Returns the Euclidean Norm of the vector

◆ GetNumberOfComponents()

template<typename T, unsigned int NVectorDimension = 3>
static unsigned int itk::CovariantVector< T, NVectorDimension >::GetNumberOfComponents ( )
inlinestatic

Returns the number of components in this vector type

Definition at line 245 of file itkCovariantVector.h.

◆ GetSquaredNorm()

template<typename T, unsigned int NVectorDimension = 3>
RealValueType itk::CovariantVector< T, NVectorDimension >::GetSquaredNorm ( ) const

Returns vector's Squared Euclidean Norm

◆ GetVnlVector() [1/2]

template<typename T, unsigned int NVectorDimension = 3>
vnl_vector_ref<T> itk::CovariantVector< T, NVectorDimension >::GetVnlVector ( )

Get a vnl_vector_ref referencing the same memory block.

◆ GetVnlVector() [2/2]

template<typename T, unsigned int NVectorDimension = 3>
vnl_vector<T> itk::CovariantVector< T, NVectorDimension >::GetVnlVector ( ) const

Get a vnl_vector with a copy of the internal memory block.

◆ Normalize()

template<typename T, unsigned int NVectorDimension = 3>
RealValueType itk::CovariantVector< T, NVectorDimension >::Normalize ( )

Divides the covariant vector components by the norm and return the norm

◆ operator*() [1/3]

template<typename T, unsigned int NVectorDimension = 3>
ValueType itk::CovariantVector< T, NVectorDimension >::operator* ( const Self other) const

CovariantVector operator*. Performs the inner product of two covariant vectors.

Warning
This is equivalent to the scalar product only if the reference system has orthogonal axis and equal scales.

◆ operator*() [2/3]

template<typename T, unsigned int NVectorDimension = 3>
Self itk::CovariantVector< T, NVectorDimension >::operator* ( const ValueType val) const
inline

Scalar operator*. Scale the elements of a vector by a scalar. Return a new vector.

Definition at line 213 of file itkCovariantVector.h.

◆ operator*() [3/3]

template<typename T, unsigned int NVectorDimension = 3>
ValueType itk::CovariantVector< T, NVectorDimension >::operator* ( const Vector< T, NVectorDimension > &  other) const

operator*. Performs the scalar product with a vector (contravariant). This scalar product is invariant under affine transformations

◆ operator*=()

template<typename T, unsigned int NVectorDimension = 3>
template<typename Tt >
const Self& itk::CovariantVector< T, NVectorDimension >::operator*= ( const Tt &  value)
inline

Scalar operator*=. Scales elements by a scalar.

Definition at line 157 of file itkCovariantVector.h.

◆ operator+()

template<typename T, unsigned int NVectorDimension = 3>
Self itk::CovariantVector< T, NVectorDimension >::operator+ ( const Self vec) const

CovariantVector addition. Add two vectors. Return a new vector.

◆ operator+=()

template<typename T, unsigned int NVectorDimension = 3>
const Self& itk::CovariantVector< T, NVectorDimension >::operator+= ( const Self vec)

CovariantVector operator+=. Adds a vectors to the current vector.

◆ operator-() [1/2]

template<typename T, unsigned int NVectorDimension = 3>
Self itk::CovariantVector< T, NVectorDimension >::operator- ( ) const

CovariantVector negation. Negate all the elements of a vector. Return a new vector

◆ operator-() [2/2]

template<typename T, unsigned int NVectorDimension = 3>
Self itk::CovariantVector< T, NVectorDimension >::operator- ( const Self vec) const

CovariantVector subtraction. Subtract two vectors. Return a new vector.

◆ operator-=()

template<typename T, unsigned int NVectorDimension = 3>
const Self& itk::CovariantVector< T, NVectorDimension >::operator-= ( const Self vec)

CovariantVector operator-=. Subtracts a vector from a current vector.

◆ operator/()

template<typename T, unsigned int NVectorDimension = 3>
template<typename Tt >
Self itk::CovariantVector< T, NVectorDimension >::operator/ ( const Tt &  val) const
inline

Scalar operator/. Scale (divide) the elements of a vector by a scalar. Return a new vector.

Definition at line 228 of file itkCovariantVector.h.

◆ operator/=()

template<typename T, unsigned int NVectorDimension = 3>
template<typename Tt >
const Self& itk::CovariantVector< T, NVectorDimension >::operator/= ( const Tt &  value)
inline

Scalar operator/=. Scales (divides) elements by a scalar.

Definition at line 170 of file itkCovariantVector.h.

◆ operator=() [1/4]

template<typename T, unsigned int NVectorDimension = 3>
CovariantVector& itk::CovariantVector< T, NVectorDimension >::operator= ( const CovariantVector< T, NVectorDimension > &  )
default

Returns the number of components in this vector type

◆ operator=() [2/4]

template<typename T, unsigned int NVectorDimension = 3>
template<typename TCovariantVectorValueType >
Self& itk::CovariantVector< T, NVectorDimension >::operator= ( const CovariantVector< TCovariantVectorValueType, NVectorDimension > &  r)
inline

Assignment operator with implicit casting from another data type

Definition at line 143 of file itkCovariantVector.h.

◆ operator=() [3/4]

template<typename T, unsigned int NVectorDimension = 3>
CovariantVector& itk::CovariantVector< T, NVectorDimension >::operator= ( const ValueType  r[NVectorDimension])

Pass-through assignment operator for the Array base class.

◆ operator=() [4/4]

template<typename T, unsigned int NVectorDimension = 3>
CovariantVector& itk::CovariantVector< T, NVectorDimension >::operator= ( CovariantVector< T, NVectorDimension > &&  )
default

Returns the number of components in this vector type

◆ SetVnlVector()

template<typename T, unsigned int NVectorDimension = 3>
void itk::CovariantVector< T, NVectorDimension >::SetVnlVector ( const vnl_vector< T > &  )

Set a vnl_vector_ref referencing the same memory block.

Member Data Documentation

◆ Dimension

template<typename T, unsigned int NVectorDimension = 3>
constexpr unsigned int itk::CovariantVector< T, NVectorDimension >::Dimension = NVectorDimension
staticconstexpr

Dimension of the Space

Definition at line 86 of file itkCovariantVector.h.


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