18#ifndef itkCovariantVector_h
19#define itkCovariantVector_h
23#include "vnl/vnl_vector_ref.h"
69template <
typename T,
unsigned int VVectorDimension = 3>
86 static constexpr unsigned int Dimension = VVectorDimension;
98 return VVectorDimension;
124 template <
typename TVectorValueType>
134 template <
typename TCovariantVectorValueType>
138 BaseArray::operator=(r);
148 template <
typename Tt>
152 for (
unsigned int i = 0; i < VVectorDimension; ++i)
154 (*this)[i] =
static_cast<ValueType>((*this)[i] * value);
161 template <
typename Tt>
165 for (
unsigned int i = 0; i < VVectorDimension; ++i)
167 (*this)[i] =
static_cast<ValueType>((*this)[i] / value);
210 for (
unsigned int i = 0; i < VVectorDimension; ++i)
212 result[i] =
static_cast<ValueType>((*this)[i] * val);
219 template <
typename Tt>
225 for (
unsigned int i = 0; i < VVectorDimension; ++i)
227 result[i] =
static_cast<ValueType>((*this)[i] / val);
240 return VVectorDimension;
253 template <
typename TCoordRepB>
257 for (
unsigned int i = 0; i < VVectorDimension; ++i)
259 (*this)[i] =
static_cast<T
>(pa[i]);
267template <
typename T,
unsigned int VVectorDimension>
270 return v.operator*(scalar);
275template <
typename T,
unsigned int VVectorDimension>
279 return covariant.operator*(contravariant);
292template <
typename T,
unsigned int VVectorDimension>
311#ifndef ITK_MANUAL_INSTANTIATION
312# include "itkCovariantVector.hxx"
Pixel-wise addition of two images.
A templated class holding a n-Dimensional covariant vector.
ValueType operator*(const Self &other) const
vnl_vector< T > GetVnlVector() const
RealValueType GetNorm() const
typename NumericTraits< ValueType >::RealType RealValueType
void CastFrom(const CovariantVector< TCoordRepB, VVectorDimension > &pa)
vnl_vector_ref< T > GetVnlVector()
Self operator+(const Self &vec) const
CovariantVector(const ValueType &r)
CovariantVector(const ValueType r[Dimension])
RealValueType Normalize()
const Self & operator*=(const Tt &value)
CovariantVector & operator=(const ValueType r[VVectorDimension])
void SetVnlVector(const vnl_vector< T > &)
CovariantVector(const CovariantVector< TVectorValueType, VVectorDimension > &r)
RealValueType GetSquaredNorm() const
static unsigned int GetNumberOfComponents()
ValueType operator*(const Vector< T, VVectorDimension > &other) const
CovariantVector()=default
Self operator-(const Self &vec) const
Self operator*(const ValueType &val) const
Self & operator=(const CovariantVector< TCovariantVectorValueType, VVectorDimension > &r)
Self operator/(const Tt &val) const
const Self & operator-=(const Self &vec)
const Self & operator/=(const Tt &value)
static unsigned int GetCovariantVectorDimension()
const Self & operator+=(const Self &vec)
Simulate a standard C array with copy semantics.
void swap(FixedArray &other)
A templated class holding a n-Dimensional vector.
constexpr unsigned int Dimension
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
void swap(Array< T > &a, Array< T > &b) noexcept
CovariantVector< T, VVectorDimension > operator*(const T &scalar, const CovariantVector< T, VVectorDimension > &v)
ITKCommon_EXPORT void CrossProduct(CovariantVector< double, 3 > &, const Vector< double, 3 > &, const Vector< double, 3 > &)