ITK  4.13.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
itk::Vector< T, NVectorDimension > Class Template Reference

#include <itkVector.h>

+ Inheritance diagram for itk::Vector< T, NVectorDimension >:
+ Collaboration diagram for itk::Vector< T, 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
Wiki 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/RegistrationITKv3/BSplineWarping1.cxx, Examples/RegistrationITKv3/BSplineWarping2.cxx, Examples/RegistrationITKv3/DeformableRegistration10.cxx, Examples/RegistrationITKv3/DeformableRegistration12.cxx, Examples/RegistrationITKv3/DeformableRegistration13.cxx, Examples/RegistrationITKv3/DeformableRegistration14.cxx, Examples/RegistrationITKv3/DeformableRegistration15.cxx, Examples/RegistrationITKv3/DeformableRegistration16.cxx, Examples/RegistrationITKv3/DeformableRegistration17.cxx, Examples/RegistrationITKv3/DeformableRegistration2.cxx, Examples/RegistrationITKv3/DeformableRegistration3.cxx, Examples/RegistrationITKv3/DeformableRegistration4.cxx, Examples/RegistrationITKv3/DeformableRegistration5.cxx, Examples/RegistrationITKv3/DeformableRegistration6.cxx, Examples/RegistrationITKv3/DeformableRegistration7.cxx, Examples/RegistrationITKv3/DeformableRegistration8.cxx, Examples/RegistrationITKv3/DeformableRegistration9.cxx, Examples/RegistrationITKv3/DeformationFieldJacobian.cxx, Examples/RegistrationITKv3/DisplacementFieldInitialization.cxx, Examples/RegistrationITKv3/LandmarkWarping2.cxx, Examples/RegistrationITKv3/ThinPlateSplineWarp.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/CreateAVector/Code.cxx, SphinxExamples/src/Filtering/ImageGradient/ApplyGradientRecursiveGaussianWithVectorInput/Code.cxx, SphinxExamples/src/Filtering/QuadEdgeMeshFiltering/ComputeNormalsOfAMesh/Code.cxx, SphinxExamples/src/Registration/Metricsv4/PerformRegistrationOnVectorImages/Code.cxx, WikiExamples/ImageProcessing/UnaryFunctorImageFilter.cxx, WikiExamples/Meshes/QuadEdgeMeshNormalFilter.cxx, WikiExamples/Registration/DeformationFieldTransform.cxx, WikiExamples/Registration/LandmarkBasedTransformInitializer.cxx, WikiExamples/Registration/WarpImageFilter.cxx, WikiExamples/SimpleOperations/BresenhamLine.cxx, WikiExamples/SimpleOperations/VariableLengthVector.cxx, WikiExamples/Smoothing/VectorMeanImageFilter.cxx, WikiExamples/Statistics/ExpectationMaximizationMixtureModelEstimator_2D.cxx, WikiExamples/Statistics/KdTree.cxx, WikiExamples/Statistics/KdTreeBasedKMeansClustering1D.cxx, WikiExamples/Statistics/ListSample.cxx, WikiExamples/Statistics/MembershipSample.cxx, and WikiExamples/Statistics/SampleToHistogramFilter.cxx.

Definition at line 62 of file itkVector.h.

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static const unsigned int Dimension = NVectorDimension
 
- Static Public Attributes inherited from itk::FixedArray< T, NVectorDimension >
static const unsigned int Dimension
 
static const unsigned int Length
 

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.

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.

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

Definition at line 72 of file itkVector.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.

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

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

Pass-through constructor for the Array base class.

Definition at line 129 of file itkVector.h.

Member Function Documentation

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

Referenced by itk::ImageBase< TImage::ImageDimension >::InternalSetSpacing().

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

Returns the Euclidean Norm of the vector

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

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

Returns vector's Squared Euclidean Norm

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 NVectorDimension = 3>
vnl_vector_ref< T > itk::Vector< T, NVectorDimension >::GetVnlVector ( )

Get a vnl_vector_ref referencing the same memory block.

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.

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 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.

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

Definition at line 253 of file itkVector.h.

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

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.

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 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 elements by a scalar.

Definition at line 145 of file itkVector.h.

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.

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.

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

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.

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.

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 203 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 157 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 134 of file itkVector.h.

template<typename T, unsigned int NVectorDimension = 3>
Vector& itk::Vector< T, NVectorDimension >::operator= ( const ValueType  r[NVectorDimension])
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 218 of file itkVector.h.

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

Definition at line 237 of file itkVector.h.

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

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.


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