Orfeo Toolbox  4.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
itk::Vector< T, NVectorDimension > Class Template Reference

A templated class holding a n-Dimensional vector. More...

#include <itkVector.h>

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

Public Types

typedef FixedArray< T,
NVectorDimension > 
BaseArray
 
typedef ValueType CArray [VLength]
 
typedef T ComponentType
 
typedef const ValueTypeconst_pointer
 
typedef const ValueTypeconst_reference
 
typedef const ValueTypeConstIterator
 
typedef ValueTypeIterator
 
typedef ValueTypepointer
 
typedef NumericTraits
< ValueType >::RealType 
RealValueType
 
typedef ValueTypereference
 
typedef Vector Self
 
typedef unsigned int SizeType
 
typedef FixedArray< T,
NVectorDimension > 
Superclass
 
typedef T ValueType
 
typedef Self VectorType
 

Public Member Functions

 Vector ()
 
 Vector (const ValueType &r)
 
template<typename TVectorValueType >
 Vector (const Vector< TVectorValueType, NVectorDimension > &r)
 
 Vector (const ValueType r[Dimension])
 
Iterator Begin ()
 
ConstIterator Begin () const
 
template<typename TCoordRepB >
void CastFrom (const Vector< TCoordRepB, NVectorDimension > &pa)
 
Iterator End ()
 
ConstIterator End () const
 
void Fill (const ValueType &)
 
ValueTypeGetDataPointer ()
 
const ValueTypeGetDataPointer () const
 
const_reference GetElement (unsigned short index) const
 
RealValueType GetNorm (void) const
 
RealValueType GetSquaredNorm (void) const
 
vnl_vector_ref< T > GetVnlVector (void)
 
vnl_vector< T > GetVnlVector (void) const
 
 itkLegacyMacro (void Set_vnl_vector(const vnl_vector< T > &))
 
 itkLegacyMacro (vnl_vector_ref< T > Get_vnl_vector(void))
 
 itkLegacyMacro (vnl_vector< T > Get_vnl_vector(void) const)
 
void Normalize (void)
 
template<typename TCoordRepB >
 operator Vector< TCoordRepB, NVectorDimension > ()
 
bool operator!= (const FixedArray &r) const
 
bool operator!= (const Self &v) const
 
ValueType operator* (const Self &vec) const
 
Self operator* (const ValueType &value) 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 &value) const
 
template<typename Tt >
const Selfoperator/= (const Tt &value)
 
template<typename TVectorValueType >
Vectoroperator= (const Vector< TVectorValueType, NVectorDimension > &r)
 
Vectoroperator= (const ValueType r[NVectorDimension])
 
bool operator== (const FixedArray &r) const
 
bool operator== (const Self &v) 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
 
ReverseIterator rBegin ()
 
ConstReverseIterator rBegin () const
 
ReverseIterator rEnd ()
 
ConstReverseIterator rEnd () const
 
void SetElement (unsigned short index, const_reference value)
 
void SetNthComponent (int c, const ComponentType &v)
 
void SetVnlVector (const vnl_vector< T > &)
 
SizeType Size () const
 

Static Public Member Functions

static FixedArray Filled (const ValueType &)
 
static unsigned int GetNumberOfComponents ()
 
static unsigned int GetVectorDimension ()
 

Static Public Attributes

static const unsigned int Dimension = NVectorDimension
 
static const unsigned int Length
 

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

{SimpleOperations/CreateVector,Create a vector} {Math/DotProduct,Dot product (inner product) of two vectors}

Examples:
DisparityMap/FineRegistrationImageFilterExample.cxx, and DisparityMap/NCCRegistrationFilterExample.cxx.

Definition at line 62 of file itkVector.h.

Member Typedef Documentation

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

The Array type from which this vector is derived.

Definition at line 84 of file itkVector.h.

typedef ValueType itk::FixedArray< T , VLength >::CArray[VLength]
inherited

A type representing the C-array version of this FixedArray.

Definition at line 63 of file itkFixedArray.h.

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

Component value type

Definition at line 81 of file itkVector.h.

typedef const ValueType* itk::FixedArray< T , VLength >::const_pointer
inherited

A const pointer to the ValueType.

Definition at line 121 of file itkFixedArray.h.

typedef const ValueType& itk::FixedArray< T , VLength >::const_reference
inherited

A const reference to the ValueType.

Definition at line 127 of file itkFixedArray.h.

typedef const ValueType* itk::FixedArray< T , VLength >::ConstIterator
inherited

A const iterator through the array.

Definition at line 69 of file itkFixedArray.h.

typedef ValueType* itk::FixedArray< T , VLength >::Iterator
inherited

An iterator through the array.

Definition at line 66 of file itkFixedArray.h.

typedef ValueType* itk::FixedArray< T , VLength >::pointer
inherited

A pointer to the ValueType.

Definition at line 118 of file itkFixedArray.h.

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

Definition at line 72 of file itkVector.h.

typedef ValueType& itk::FixedArray< T , VLength >::reference
inherited

A reference to the ValueType.

Definition at line 124 of file itkFixedArray.h.

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

Standard class typedefs.

Definition at line 66 of file itkVector.h.

typedef unsigned int itk::FixedArray< T , VLength >::SizeType
inherited

Definition at line 129 of file itkFixedArray.h.

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

Definition at line 67 of file itkVector.h.

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

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.

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

I am a vector type.

Definition at line 78 of file itkVector.h.

Constructor & Destructor Documentation

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

Default constructor and copy constructors.

Definition at line 111 of file itkVector.h.

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

Constructor to initialize entire vector to one value.

Definition at line 30 of file itkVector.hxx.

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 118 of file itkVector.h.

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

Definition at line 119 of file itkVector.h.

Member Function Documentation

Iterator itk::FixedArray< T , VLength >::Begin ( void  )
inherited

Get various iterators to the array.

Get an Iterator for the beginning of the FixedArray.

ConstIterator itk::FixedArray< T , VLength >::Begin ( void  ) const
inherited

Get a ConstIterator for the beginning of the FixedArray.

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

Get an Iterator for the end of the FixedArray.

ConstIterator itk::FixedArray< T , VLength >::End ( void  ) const
inherited

Get a ConstIterator for the end of the FixedArray.

void itk::FixedArray< T , VLength >::Fill ( const ValueType )
inherited
static FixedArray itk::FixedArray< T , VLength >::Filled ( const ValueType )
staticinherited

Return an FixedArray with all elements assigned to the given value.

ValueType* itk::FixedArray< T , VLength >::GetDataPointer ( )
inlineinherited

Return a pointer to the data.

Definition at line 220 of file itkFixedArray.h.

const ValueType* itk::FixedArray< T , VLength >::GetDataPointer ( ) const
inlineinherited

Definition at line 225 of file itkFixedArray.h.

const_reference itk::FixedArray< T , VLength >::GetElement ( unsigned short  index) const
inlineinherited

Definition at line 217 of file itkFixedArray.h.

template<typename T , unsigned int TVectorDimension>
Vector< T, TVectorDimension >::RealValueType itk::Vector< T, TVectorDimension >::GetNorm ( void  ) const
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 216 of file itkVector.h.

template<typename T , unsigned int TVectorDimension>
Vector< T, TVectorDimension >::RealValueType itk::Vector< T, TVectorDimension >::GetSquaredNorm ( void  ) const
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 87 of file itkVector.h.

template<typename T , unsigned int TVectorDimension>
vnl_vector_ref< T > itk::Vector< T, TVectorDimension >::GetVnlVector ( void  )
template<typename T , unsigned int TVectorDimension>
vnl_vector< T > itk::Vector< T, TVectorDimension >::GetVnlVector ( void  ) const

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

Definition at line 159 of file itkVector.hxx.

template<typename T, unsigned int NVectorDimension = 3>
itk::Vector< T, NVectorDimension >::itkLegacyMacro ( void   Set_vnl_vectorconst vnl_vector< T > &)

Set a vnl_vector_ref referencing the same memory block.

Deprecated:
Use SetVnlVector() instead.
template<typename T, unsigned int NVectorDimension = 3>
itk::Vector< T, NVectorDimension >::itkLegacyMacro ( vnl_vector_ref< T >   Get_vnl_vectorvoid)

Get a vnl_vector_ref referencing the same memory block.

Deprecated:
Use GetVnlVector() instead.
template<typename T, unsigned int NVectorDimension = 3>
itk::Vector< T, NVectorDimension >::itkLegacyMacro ( vnl_vector< T > Get_vnl_vector(void)  const)

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

Deprecated:
Use GetVnlVector() instead.
template<typename T , unsigned int TVectorDimension>
void itk::Vector< T, TVectorDimension >::Normalize ( void  )
template<typename T, unsigned int NVectorDimension = 3>
template<typename TCoordRepB >
itk::Vector< T, NVectorDimension >::operator Vector< TCoordRepB, NVectorDimension > ( )
inline

Definition at line 236 of file itkVector.h.

bool itk::FixedArray< T , VLength >::operator!= ( const FixedArray< T, NVectorDimension > &  r) const
inlineinherited

Definition at line 191 of file itkFixedArray.h.

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

Definition at line 206 of file itkVector.h.

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

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

Definition at line 215 of file itkVector.hxx.

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 175 of file itkVector.h.

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 133 of file itkVector.h.

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

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

Definition at line 88 of file itkVector.hxx.

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

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

Definition at line 50 of file itkVector.hxx.

template<typename T , unsigned int TVectorDimension>
Vector< T, TVectorDimension > itk::Vector< T, TVectorDimension >::operator- ( ) const

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

Definition at line 74 of file itkVector.hxx.

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

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

Definition at line 102 of file itkVector.hxx.

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

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

Definition at line 62 of file itkVector.hxx.

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 189 of file itkVector.h.

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 144 of file itkVector.h.

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 123 of file itkVector.h.

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

Definition at line 41 of file itkVector.hxx.

bool itk::FixedArray< T , VLength >::operator== ( const FixedArray< T, NVectorDimension > &  r) const
inherited

Operators == and != are used to compare whether two arrays are equal. Note that arrays are equal when the number of components (size) is the same, and each component value is equal.

Operator != compares different types of arrays.

Referenced by itk::Vector< TScalar, NDimensions >::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 204 of file itkVector.h.

Referenced by itk::Vector< TScalar, NDimensions >::operator!=().

reference itk::FixedArray< T , VLength >::operator[] ( short  index)
inlineinherited

Allow the FixedArray to be indexed normally. No bounds checking is done. The separate versions are a work-around for an integer conversion bug in Visual C++.

Definition at line 197 of file itkFixedArray.h.

Referenced by itk::Vector< TScalar, NDimensions >::SetNthComponent().

const_reference itk::FixedArray< T , VLength >::operator[] ( short  index) const
inlineinherited

Definition at line 198 of file itkFixedArray.h.

reference itk::FixedArray< T , VLength >::operator[] ( unsigned short  index)
inlineinherited

Definition at line 199 of file itkFixedArray.h.

const_reference itk::FixedArray< T , VLength >::operator[] ( unsigned short  index) const
inlineinherited

Definition at line 200 of file itkFixedArray.h.

reference itk::FixedArray< T , VLength >::operator[] ( int  index)
inlineinherited

Definition at line 201 of file itkFixedArray.h.

const_reference itk::FixedArray< T , VLength >::operator[] ( int  index) const
inlineinherited

Definition at line 202 of file itkFixedArray.h.

reference itk::FixedArray< T , VLength >::operator[] ( unsigned int  index)
inlineinherited

Definition at line 203 of file itkFixedArray.h.

const_reference itk::FixedArray< T , VLength >::operator[] ( unsigned int  index) const
inlineinherited

Definition at line 204 of file itkFixedArray.h.

reference itk::FixedArray< T , VLength >::operator[] ( long  index)
inlineinherited

Definition at line 205 of file itkFixedArray.h.

const_reference itk::FixedArray< T , VLength >::operator[] ( long  index) const
inlineinherited

Definition at line 206 of file itkFixedArray.h.

reference itk::FixedArray< T , VLength >::operator[] ( unsigned long  index)
inlineinherited

Definition at line 207 of file itkFixedArray.h.

const_reference itk::FixedArray< T , VLength >::operator[] ( unsigned long  index) const
inlineinherited

Definition at line 208 of file itkFixedArray.h.

reference itk::FixedArray< T , VLength >::operator[] ( long long  index)
inlineinherited

Definition at line 209 of file itkFixedArray.h.

const_reference itk::FixedArray< T , VLength >::operator[] ( long long  index) const
inlineinherited

Definition at line 210 of file itkFixedArray.h.

reference itk::FixedArray< T , VLength >::operator[] ( unsigned long long  index)
inlineinherited

Definition at line 211 of file itkFixedArray.h.

const_reference itk::FixedArray< T , VLength >::operator[] ( unsigned long long  index) const
inlineinherited

Definition at line 212 of file itkFixedArray.h.

ReverseIterator itk::FixedArray< T , VLength >::rBegin ( )
inherited

Get a begin ReverseIterator.

ConstReverseIterator itk::FixedArray< T , VLength >::rBegin ( ) const
inherited

Get a begin ConstReverseIterator.

ReverseIterator itk::FixedArray< T , VLength >::rEnd ( )
inherited

Get an end ReverseIterator.

ConstReverseIterator itk::FixedArray< T , VLength >::rEnd ( ) const
inherited

Get an end ConstReverseIterator.

void itk::FixedArray< T , VLength >::SetElement ( unsigned short  index,
const_reference  value 
)
inlineinherited

Set/Get element methods are more convenient in wrapping languages

Definition at line 215 of file itkFixedArray.h.

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

Definition at line 221 of file itkVector.h.

template<typename T, unsigned int TVectorDimension>
void itk::Vector< T, TVectorDimension >::SetVnlVector ( const vnl_vector< T > &  v)
SizeType itk::FixedArray< T , VLength >::Size ( void  ) const
inherited

Get the size of the FixedArray.

Member Data Documentation

template<typename T, unsigned int NVectorDimension = 3>
const unsigned int itk::Vector< T, NVectorDimension >::Dimension = NVectorDimension
static

Dimension of the vector space.

Definition at line 75 of file itkVector.h.

const unsigned int itk::FixedArray< T , VLength >::Length
staticinherited

Length constant

Definition at line 54 of file itkFixedArray.h.


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

Generated at Sat Mar 8 2014 17:55:49 for Orfeo Toolbox with doxygen 1.8.3.1