ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itk::CovariantVector< T, VVectorDimension > Class Template Reference

#include <itkCovariantVector.h>

Detailed Description

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

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 VVectorDimension 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, and Examples/IO/CovariantVectorImageWrite.cxx.

Definition at line 68 of file itkCovariantVector.h.

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

Public Types

using BaseArray = FixedArray<T, VVectorDimension>
 
using ComponentType = T
 
using CovariantVectorType = Self
 
using RealValueType = typename NumericTraits<ValueType>::RealType
 
using Self = CovariantVector
 
using Superclass = FixedArray<T, VVectorDimension>
 
using ValueType = T
 
- Public Types inherited from itk::FixedArray< T, 3 >
using CArray
 
using const_iterator
 
using const_pointer
 
using const_reference
 
using const_reverse_iterator
 
using ConstIterator
 
using Iterator
 
using iterator
 
using pointer
 
using reference
 
using reverse_iterator
 
using SizeType
 
using value_type
 
using ValueType
 

Public Member Functions

template<typename TCoordinateB>
void CastFrom (const CovariantVector< TCoordinateB, VVectorDimension > &pa)
 
 CovariantVector ()=default
 
template<typename TVectorValueType>
 CovariantVector (const CovariantVector< TVectorValueType, VVectorDimension > &r)
 
 CovariantVector (const ValueType &r)
 
 CovariantVector (const ValueType r[Dimension])
 
RealValueType GetNorm () const
 
RealValueType GetSquaredNorm () const
 
vnl_vector_ref< T > GetVnlVector ()
 
vnl_vector< T > GetVnlVector () const
 
RealValueType Normalize ()
 
ValueType operator* (const Self &other) const
 
Self operator* (const ValueType &val) const
 
ValueType operator* (const Vector< T, VVectorDimension > &other) const
 
template<typename Tt>
const Selfoperator*= (const Tt &value)
 
Self operator+ (const Self &vec) const
 
const Selfoperator+= (const Self &vec)
 
Self operator- () const
 
Self operator- (const Self &vec) const
 
const Selfoperator-= (const Self &vec)
 
template<typename Tt>
Self operator/ (const Tt &val) const
 
template<typename Tt>
const Selfoperator/= (const Tt &value)
 
template<typename TCovariantVectorValueType>
Selfoperator= (const CovariantVector< TCovariantVectorValueType, VVectorDimension > &r)
 
CovariantVectoroperator= (const ValueType r[VVectorDimension])
 
void SetVnlVector (const vnl_vector< T > &)
 
- Public Member Functions inherited from itk::FixedArray< T, 3 >
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)
 
FixedArrayoperator= (const FixedArray< TFixedArrayValueType, VLength > &r)
 
FixedArrayoperator= (const ValueType r[VLength])
 
bool operator== (const FixedArray &r) const
 
ReverseIterator rBegin ()
 
ConstReverseIterator rBegin () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
ReverseIterator rEnd ()
 
ConstReverseIterator rEnd () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
SizeType Size () const
 
constexpr SizeType size () const
 
void swap (FixedArray &other) noexcept
 
 FixedArray (const ValueType r[VLength])
 
 FixedArray (const ValueType &)
 
ITK_GCC_PRAGMA_PUSH ITK_GCC_SUPPRESS_Warray_bounds constexpr 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 GetCovariantVectorDimension ()
 
static unsigned int GetNumberOfComponents ()
 
- Static Public Member Functions inherited from itk::FixedArray< T, 3 >
static constexpr FixedArray Filled (const ValueType &value)
 

Static Public Attributes

static constexpr unsigned int Dimension = VVectorDimension
 
- Static Public Attributes inherited from itk::FixedArray< T, 3 >
static constexpr unsigned int Dimension
 
static constexpr unsigned int Length
 

Member Typedef Documentation

◆ BaseArray

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

The Array type from which this CovariantVector is derived.

Definition at line 90 of file itkCovariantVector.h.

◆ ComponentType

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

Component value type

Definition at line 81 of file itkCovariantVector.h.

◆ CovariantVectorType

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

I am a covariant vector.

Definition at line 87 of file itkCovariantVector.h.

◆ RealValueType

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

Definition at line 78 of file itkCovariantVector.h.

◆ Self

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

Standard class type aliases.

Definition at line 72 of file itkCovariantVector.h.

◆ Superclass

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

Definition at line 73 of file itkCovariantVector.h.

◆ ValueType

template<typename T, unsigned int VVectorDimension = 3>
using itk::CovariantVector< T, VVectorDimension >::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 77 of file itkCovariantVector.h.

Constructor & Destructor Documentation

◆ CovariantVector() [1/4]

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

Default-constructor.

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

◆ CovariantVector() [2/4]

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

Constructor to initialize entire vector to one value.

◆ CovariantVector() [3/4]

template<typename T, unsigned int VVectorDimension = 3>
template<typename TVectorValueType>
itk::CovariantVector< T, VVectorDimension >::CovariantVector ( const CovariantVector< TVectorValueType, VVectorDimension > & 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 123 of file itkCovariantVector.h.

◆ CovariantVector() [4/4]

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

Definition at line 126 of file itkCovariantVector.h.

Member Function Documentation

◆ CastFrom()

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

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

Definition at line 252 of file itkCovariantVector.h.

◆ GetCovariantVectorDimension()

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

Get the dimension (size) of the vector.

Definition at line 94 of file itkCovariantVector.h.

◆ GetNorm()

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

Returns the Euclidean Norm of the vector

◆ GetNumberOfComponents()

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

Returns the number of components in this vector type

Definition at line 235 of file itkCovariantVector.h.

◆ GetSquaredNorm()

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

Returns vector's Squared Euclidean Norm

◆ GetVnlVector() [1/2]

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

Get a vnl_vector_ref referencing the same memory block.

◆ GetVnlVector() [2/2]

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

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

◆ Normalize()

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

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

◆ operator*() [1/3]

template<typename T, unsigned int VVectorDimension = 3>
ValueType itk::CovariantVector< T, VVectorDimension >::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 VVectorDimension = 3>
Self itk::CovariantVector< T, VVectorDimension >::operator* ( const ValueType & val) const
inline

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

Definition at line 203 of file itkCovariantVector.h.

◆ operator*() [3/3]

template<typename T, unsigned int VVectorDimension = 3>
ValueType itk::CovariantVector< T, VVectorDimension >::operator* ( const Vector< T, VVectorDimension > & 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 VVectorDimension = 3>
template<typename Tt>
const Self & itk::CovariantVector< T, VVectorDimension >::operator*= ( const Tt & value)
inline

Scalar operator*=. Scales elements by a scalar.

Definition at line 146 of file itkCovariantVector.h.

◆ operator+()

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

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

◆ operator+=()

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

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

◆ operator-() [1/2]

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

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

◆ operator-() [2/2]

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

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

◆ operator-=()

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

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

◆ operator/()

template<typename T, unsigned int VVectorDimension = 3>
template<typename Tt>
Self itk::CovariantVector< T, VVectorDimension >::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 218 of file itkCovariantVector.h.

◆ operator/=()

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

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

Definition at line 158 of file itkCovariantVector.h.

◆ operator=() [1/2]

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

Assignment operator with implicit casting from another data type

Definition at line 133 of file itkCovariantVector.h.

◆ operator=() [2/2]

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

Pass-through assignment operator for the Array base class.

◆ SetVnlVector()

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

Set a vnl_vector_ref referencing the same memory block.

Member Data Documentation

◆ Dimension

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

Dimension of the Space

Definition at line 84 of file itkCovariantVector.h.


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