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

#include <itkVector.h>

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

Public Types

using BaseArray = FixedArray< T, NVectorDimension >
 
using ComponentType = T
 
using RealValueType = typename NumericTraits< ValueType >::RealType
 
using Self = Vector
 
using Superclass = FixedArray< T, NVectorDimension >
 
using ValueType = T
 
using VectorType = Self
 
- 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
 
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
 
void Fill (const ValueType &)
 
void swap (FixedArray &other)
 

Static Public Member Functions

static unsigned int GetVectorDimension ()
 
- 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 ()
 
 Vector ()=default
 
 Vector (const Vector &)=default
 
 Vector (Vector &&)=default
 
Vectoroperator= (const Vector &)=default
 
Vectoroperator= (Vector &&)=default
 
 ~Vector ()=default
 
 Vector (const ValueType &r)
 
template<typename TVectorValueType >
 Vector (const Vector< TVectorValueType, NVectorDimension > &r)
 
 Vector (const ValueType r[Dimension])
 
template<typename TVectorValueType >
 Vector (const TVectorValueType r[Dimension])
 
template<typename TVectorValueType >
Vectoroperator= (const Vector< TVectorValueType, NVectorDimension > &r)
 
Vectoroperator= (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 &vec) const
 
Self operator* (const ValueType &value) const
 
template<typename Tt >
Self operator/ (const Tt &value) const
 
bool operator== (const Self &v) const
 
bool operator!= (const Self &v) const
 
RealValueType GetNorm () const
 
RealValueType GetSquaredNorm () const
 
RealValueType Normalize ()
 
void SetNthComponent (int c, const ComponentType &v)
 
template<typename TCoordRepB >
void CastFrom (const Vector< TCoordRepB, NVectorDimension > &pa)
 
template<typename TCoordRepB >
 operator Vector< TCoordRepB, NVectorDimension > ()
 

Detailed Description

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

A templated class holding a n-Dimensional vector.

Vector is a templated class that holds a single vector (i.e., an array of values). Vector 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.

Vector 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 ScalarVector, 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.)

See also
Image
Mesh
Point
CovariantVector
Matrix
ITK Sphinx Examples:
\li All ITK Sphinx Examples
Examples
Examples/DataRepresentation/Image/Image4.cxx, Examples/DataRepresentation/Image/VectorImage.cxx, Examples/DataRepresentation/Mesh/MeshTraits.cxx, Examples/DataRepresentation/Mesh/PointSetWithVectors.cxx, Examples/Filtering/GradientVectorFlowImageFilter.cxx, Examples/Filtering/WarpImageFilter1.cxx, Examples/IO/VectorImageReadWrite.cxx, Examples/RegistrationITKv4/BSplineWarping1.cxx, Examples/RegistrationITKv4/BSplineWarping2.cxx, Examples/RegistrationITKv4/DeformableRegistration10.cxx, Examples/RegistrationITKv4/DeformableRegistration12.cxx, Examples/RegistrationITKv4/DeformableRegistration13.cxx, Examples/RegistrationITKv4/DeformableRegistration14.cxx, Examples/RegistrationITKv4/DeformableRegistration15.cxx, Examples/RegistrationITKv4/DeformableRegistration16.cxx, Examples/RegistrationITKv4/DeformableRegistration17.cxx, Examples/RegistrationITKv4/DeformableRegistration2.cxx, Examples/RegistrationITKv4/DeformableRegistration3.cxx, Examples/RegistrationITKv4/DeformableRegistration4.cxx, Examples/RegistrationITKv4/DeformableRegistration5.cxx, Examples/RegistrationITKv4/DeformableRegistration6.cxx, Examples/RegistrationITKv4/DeformableRegistration7.cxx, Examples/RegistrationITKv4/DeformableRegistration8.cxx, Examples/RegistrationITKv4/DeformableRegistration9.cxx, Examples/RegistrationITKv4/DisplacementFieldInitialization.cxx, Examples/RegistrationITKv4/LandmarkWarping2.cxx, Examples/RegistrationITKv4/ThinPlateSplineWarp.cxx, Examples/Segmentation/WatershedSegmentation1.cxx, Examples/Statistics/BayesianPluginClassifier.cxx, Examples/Statistics/ExpectationMaximizationMixtureModelEstimator.cxx, Examples/Statistics/GaussianMembershipFunction.cxx, Examples/Statistics/KdTree.cxx, Examples/Statistics/KdTreeBasedKMeansClustering.cxx, Examples/Statistics/ListSample.cxx, Examples/Statistics/MembershipSample.cxx, Examples/Statistics/MembershipSampleGenerator.cxx, Examples/Statistics/NeighborhoodSampler.cxx, Examples/Statistics/SampleSorting.cxx, Examples/Statistics/SampleStatistics.cxx, Examples/Statistics/SampleToHistogramFilter.cxx, Examples/Statistics/SelectiveSubsampleGenerator.cxx, Examples/Statistics/Subsample.cxx, Examples/Statistics/WeightedSampleStatistics.cxx, SphinxExamples/src/Core/Common/BresenhamLine/Code.cxx, SphinxExamples/src/Core/Common/CreateAnImageOfVectors/Code.cxx, SphinxExamples/src/Core/Common/CreateAVector/Code.cxx, SphinxExamples/src/Core/Common/CustomOperationToEachPixelInImage/Code.cxx, SphinxExamples/src/Core/Common/ReadWriteVectorImage/Code.cxx, SphinxExamples/src/Core/Common/VariableLengthVector/Code.cxx, SphinxExamples/src/Core/Common/VectorDotProduct/Code.cxx, SphinxExamples/src/Filtering/ImageGradient/ApplyGradientRecursiveGaussianWithVectorInput/Code.cxx, SphinxExamples/src/Filtering/ImageGrid/FitSplineIntoPointSet/Code.cxx, SphinxExamples/src/Filtering/ImageGrid/WarpAnImageUsingADeformationField/Code.cxx, SphinxExamples/src/Filtering/QuadEdgeMeshFiltering/ComputeNormalsOfAMesh/Code.cxx, SphinxExamples/src/Numerics/Statistics/2DGaussianMixtureModelExpectMax/Code.cxx, SphinxExamples/src/Numerics/Statistics/CreateHistogramFromListOfMeasurements/Code.cxx, SphinxExamples/src/Numerics/Statistics/CreateListOfSampleMeasurements/Code.cxx, SphinxExamples/src/Numerics/Statistics/CreateListOfSamplesWithIDs/Code.cxx, SphinxExamples/src/Numerics/Statistics/DistributeSamplingUsingGMM/Code.cxx, SphinxExamples/src/Numerics/Statistics/SpatialSearch/Code.cxx, SphinxExamples/src/Registration/Metricsv4/PerformRegistrationOnVectorImages/Code.cxx, and SphinxExamples/src/Segmentation/Classifiers/KMeansClusterOfPixelsInImage/Code.cxx.

Definition at line 62 of file itkVector.h.

Member Typedef Documentation

◆ BaseArray

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

The Array type from which this vector is derived.

Definition at line 84 of file itkVector.h.

◆ ComponentType

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

Component value type

Definition at line 81 of file itkVector.h.

◆ RealValueType

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

Definition at line 72 of file itkVector.h.

◆ Self

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

Standard class type aliases.

Definition at line 66 of file itkVector.h.

◆ Superclass

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

Definition at line 67 of file itkVector.h.

◆ ValueType

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

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

Definition at line 71 of file itkVector.h.

◆ VectorType

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

I am a vector type.

Definition at line 78 of file itkVector.h.

Constructor & Destructor Documentation

◆ Vector() [1/7]

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

Default constructors, assignments and destructor

◆ Vector() [2/7]

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

Returns the number of components in this vector type

◆ Vector() [3/7]

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

Returns the number of components in this vector type

◆ ~Vector()

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

Returns the number of components in this vector type

◆ Vector() [4/7]

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

Constructor to initialize entire vector to one value.

Warning
Not intended to convert a scalar value into a Vector filled with that value.
Deprecated:

◆ Vector() [5/7]

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

Pass-through constructor for the Array base class.

Definition at line 131 of file itkVector.h.

◆ Vector() [6/7]

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

Returns the number of components in this vector type

Definition at line 134 of file itkVector.h.

◆ Vector() [7/7]

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

Returns the number of components in this vector type

Definition at line 138 of file itkVector.h.

Member Function Documentation

◆ CastFrom()

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

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

Definition at line 281 of file itkVector.h.

◆ GetNorm()

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

Returns the Euclidean Norm of the vector

◆ GetNumberOfComponents()

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

Returns the number of components in this vector type

Definition at line 261 of file itkVector.h.

◆ GetSquaredNorm()

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

Returns vector's Squared Euclidean Norm

◆ GetVectorDimension()

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

Get the dimension (size) of the vector.

Definition at line 88 of file itkVector.h.

◆ GetVnlVector() [1/2]

template<typename T, unsigned int NVectorDimension = 3>
vnl_vector_ref<T> itk::Vector< 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::Vector< 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::Vector< T, NVectorDimension >::Normalize ( )

Divides the vector components by the vector norm (when the norm is not null). The norm used is returned.

◆ operator Vector< TCoordRepB, NVectorDimension >()

template<typename T, unsigned int NVectorDimension = 3>
template<typename TCoordRepB >
itk::Vector< T, NVectorDimension >::operator Vector< TCoordRepB, NVectorDimension > ( )
inline

Returns the number of components in this vector type

Definition at line 291 of file itkVector.h.

◆ operator!=()

template<typename T, unsigned int NVectorDimension = 3>
bool itk::Vector< T, NVectorDimension >::operator!= ( const Self v) const
inline

Returns the number of components in this vector type

Definition at line 245 of file itkVector.h.

◆ operator*() [1/2]

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

Vector operator*. Performs the inner product of two vectors. this is also known as the scalar product.

◆ operator*() [2/2]

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

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

Definition at line 209 of file itkVector.h.

◆ operator*=()

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

Scalar operator*=. Scales elements by a scalar.

Definition at line 159 of file itkVector.h.

◆ operator+()

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

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

◆ operator+=()

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

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

◆ operator-() [1/2]

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

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

◆ operator-() [2/2]

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

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

◆ operator-=()

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

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

◆ operator/()

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

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

Definition at line 224 of file itkVector.h.

◆ operator/=()

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

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

Definition at line 172 of file itkVector.h.

◆ operator=() [1/4]

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

Returns the number of components in this vector type

◆ operator=() [2/4]

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

Returns the number of components in this vector type

◆ operator=() [3/4]

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

Pass-through assignment operator for the Array base class.

Definition at line 146 of file itkVector.h.

◆ operator=() [4/4]

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

Returns the number of components in this vector type

◆ operator==()

template<typename T, unsigned int NVectorDimension = 3>
bool itk::Vector< T, NVectorDimension >::operator== ( const Self v) const
inline

Operators == and != compare a vector component by component. All components must be equal for two vectors to be equal. (Of course compile-time constraints on the template parameters length and type prevent comparisons between vectors of different type and length.)

Definition at line 240 of file itkVector.h.

◆ SetNthComponent()

template<typename T, unsigned int NVectorDimension = 3>
void itk::Vector< T, NVectorDimension >::SetNthComponent ( int  c,
const ComponentType v 
)
inline

Returns the number of components in this vector type

Definition at line 272 of file itkVector.h.

◆ SetVnlVector()

template<typename T, unsigned int NVectorDimension = 3>
void itk::Vector< 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::Vector< T, NVectorDimension >::Dimension = NVectorDimension
staticconstexpr

Dimension of the vector space.

Definition at line 75 of file itkVector.h.


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