ITK
6.0.0
Insight Toolkit
|
#include <itkVector.h>
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 VVectorDimension 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.)
Definition at line 62 of file itkVector.h.
Public Types | |
using | BaseArray = FixedArray< T, VVectorDimension > |
using | ComponentType = T |
using | RealValueType = typename NumericTraits< ValueType >::RealType |
using | Self = Vector |
using | Superclass = FixedArray< T, VVectorDimension > |
using | ValueType = T |
using | VectorType = Self |
Public Types inherited from itk::FixedArray< T, VVectorDimension > | |
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 | |
RealValueType | GetNorm () const |
RealValueType | GetSquaredNorm () const |
vnl_vector_ref< T > | GetVnlVector () |
vnl_vector< T > | GetVnlVector () const |
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (Self) | |
RealValueType | Normalize () |
template<typename TCoordRepB > | |
operator Vector< TCoordRepB, VVectorDimension > () | |
ValueType | operator* (const Self &other) const |
Self | operator* (const ValueType &value) const |
Self | operator+ (const Self &vec) const |
const Self & | operator+= (const Self &vec) |
Self | operator- () const |
Self | operator- (const Self &vec) const |
const Self & | operator-= (const Self &vec) |
template<typename Tt > | |
Self | operator/ (const Tt &value) const |
Vector & | operator= (const ValueType r[VVectorDimension]) |
bool | operator== (const Self &v) const |
void | SetNthComponent (int c, const ComponentType &v) |
void | SetVnlVector (const vnl_vector< T > &) |
Vector ()=default | |
Vector (const std::array< ValueType, VVectorDimension > &stdArray) | |
Vector (const ValueType &r) | |
Vector (std::nullptr_t)=delete | |
template<typename TVectorValueType > | |
Vector (const Vector< TVectorValueType, VVectorDimension > &r) | |
Vector (const ValueType r[Dimension]) | |
template<typename TVectorValueType > | |
Vector (const TVectorValueType r[Dimension]) | |
template<typename TVectorValueType > | |
Vector & | operator= (const Vector< TVectorValueType, VVectorDimension > &r) |
template<typename Tt > | |
const Self & | operator*= (const Tt &value) |
template<typename Tt > | |
const Self & | operator/= (const Tt &value) |
template<typename TCoordRepB > | |
void | CastFrom (const Vector< TCoordRepB, VVectorDimension > &pa) |
Public Member Functions inherited from itk::FixedArray< T, VVectorDimension > | |
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 |
ValueType * | data () |
const ValueType * | data () 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) | |
ValueType * | GetDataPointer () |
const ValueType * | GetDataPointer () const |
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (FixedArray) | |
itkLegacyMacro (ReverseIterator rBegin();) itkLegacyMacro(ConstReverseIterator rBegin() const | |
itkLegacyMacro (ReverseIterator rEnd();) itkLegacyMacro(ConstReverseIterator rEnd() const | |
FixedArray & | operator= (const FixedArray< TFixedArrayValueType, VLength > &r) |
FixedArray & | operator= (const ValueType r[VLength]) |
bool | operator== (const FixedArray &r) const |
reverse_iterator | rbegin () |
const_reverse_iterator | rbegin () const |
reverse_iterator | rend () |
const_reverse_iterator | rend () const |
SizeType | Size () const |
constexpr SizeType | size () const |
void | swap (FixedArray &other) |
FixedArray (const ValueType r[VLength]) | |
FixedArray (const ValueType &) | |
ITK_GCC_PRAGMA_PUSH constexpr ITK_GCC_SUPPRESS_Warray_bounds 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 | GetNumberOfComponents () |
static unsigned int | GetVectorDimension () |
Static Public Member Functions inherited from itk::FixedArray< T, VVectorDimension > | |
static constexpr FixedArray | Filled (const ValueType &value) |
Static Public Attributes | |
static constexpr unsigned int | Dimension = VVectorDimension |
Static Public Attributes inherited from itk::FixedArray< T, VVectorDimension > | |
static constexpr unsigned int | Dimension |
static constexpr unsigned int | Length |
using itk::Vector< T, VVectorDimension >::BaseArray = FixedArray<T, VVectorDimension> |
The Array type from which this vector is derived.
Definition at line 84 of file itkVector.h.
using itk::Vector< T, VVectorDimension >::ComponentType = T |
Component value type
Definition at line 81 of file itkVector.h.
using itk::Vector< T, VVectorDimension >::RealValueType = typename NumericTraits<ValueType>::RealType |
Definition at line 72 of file itkVector.h.
using itk::Vector< T, VVectorDimension >::Self = Vector |
Standard class type aliases.
Definition at line 66 of file itkVector.h.
using itk::Vector< T, VVectorDimension >::Superclass = FixedArray<T, VVectorDimension> |
Definition at line 67 of file itkVector.h.
using itk::Vector< T, VVectorDimension >::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.
using itk::Vector< T, VVectorDimension >::VectorType = Self |
I am a vector type.
Definition at line 78 of file itkVector.h.
|
default |
Default-constructor.
|
explicit |
Constructor to initialize entire vector to one value, if explicitly invoked.
|
delete |
Prevents copy-initialization from nullptr
, as well as from 0
(NULL).
|
inline |
Pass-through constructor for the Array base class.
Definition at line 128 of file itkVector.h.
|
inline |
Pass-through constructor for the Array base class.
Definition at line 131 of file itkVector.h.
|
inline |
Pass-through constructor for the Array base class.
Definition at line 135 of file itkVector.h.
|
inlineexplicit |
Explicit constructor for std::array.
Definition at line 141 of file itkVector.h.
|
inline |
Copy from another Vector with a different representation type. Casting is done with C-Like rules
Definition at line 279 of file itkVector.h.
RealValueType itk::Vector< T, VVectorDimension >::GetNorm | ( | ) | const |
Returns the Euclidean Norm of the vector (also referred to as its "magnitude").
|
inlinestatic |
Returns the number of components in this vector type
Definition at line 259 of file itkVector.h.
RealValueType itk::Vector< T, VVectorDimension >::GetSquaredNorm | ( | ) | const |
Returns vector's Squared Euclidean Norm
|
inlinestatic |
Get the dimension (size) of the vector.
Definition at line 88 of file itkVector.h.
vnl_vector_ref<T> itk::Vector< T, VVectorDimension >::GetVnlVector | ( | ) |
Get a vnl_vector_ref referencing the same memory block.
vnl_vector<T> itk::Vector< T, VVectorDimension >::GetVnlVector | ( | ) | const |
Get a vnl_vector with a copy of the internal memory block.
itk::Vector< T, VVectorDimension >::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION | ( | Self | ) |
RealValueType itk::Vector< T, VVectorDimension >::Normalize | ( | ) |
Divides the vector components by the vector norm (when the norm is not null). The norm used is returned.
|
inline |
Definition at line 289 of file itkVector.h.
ValueType itk::Vector< T, VVectorDimension >::operator* | ( | const Self & | other | ) | const |
Vector operator*. Performs the inner product of two vectors. this is also known as the scalar product.
|
inline |
Scalar operator*. Scale the elements of a vector by a scalar. Return a new vector.
Definition at line 211 of file itkVector.h.
|
inline |
Scalar operator*=. Scales elements by a scalar.
Definition at line 161 of file itkVector.h.
Self itk::Vector< T, VVectorDimension >::operator+ | ( | const Self & | vec | ) | const |
Vector addition. Add two vectors. Return a new vector.
const Self& itk::Vector< T, VVectorDimension >::operator+= | ( | const Self & | vec | ) |
Vector operator+=. Adds a vectors to the current vector.
Self itk::Vector< T, VVectorDimension >::operator- | ( | ) | const |
Vector negation. Negate all the elements of a vector. Return a new vector
Self itk::Vector< T, VVectorDimension >::operator- | ( | const Self & | vec | ) | const |
Vector subtraction. Subtract two vectors. Return a new vector.
const Self& itk::Vector< T, VVectorDimension >::operator-= | ( | const Self & | vec | ) |
Vector operator-=. Subtracts a vector from a current vector.
|
inline |
Scalar operator/. Scale (divide) the elements of a vector by a scalar. Return a new vector.
Definition at line 226 of file itkVector.h.
|
inline |
Scalar operator/=. Scales (divides) elements by a scalar.
Definition at line 174 of file itkVector.h.
Vector& itk::Vector< T, VVectorDimension >::operator= | ( | const ValueType | r[VVectorDimension] | ) |
|
inline |
Pass-through assignment operator for the Array base class.
Definition at line 148 of file itkVector.h.
|
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 242 of file itkVector.h.
|
inline |
Definition at line 270 of file itkVector.h.
void itk::Vector< T, VVectorDimension >::SetVnlVector | ( | const vnl_vector< T > & | ) |
Copy values from the vnl_vector input to the internal memory block. The minimum of VVectorDimension and vnl_vector::size() elements are copied.
|
staticconstexpr |
Dimension of the vector space.
Definition at line 75 of file itkVector.h.