23#include "vnl/vnl_vector_ref.h"
61template <
typename T,
unsigned int VVectorDimension = 3>
75 static constexpr unsigned int Dimension = VVectorDimension;
90 return VVectorDimension;
110#if !defined(ITK_LEGACY_REMOVE)
127 template <
typename TVectorValueType>
134 template <
typename TVectorValueType>
141 explicit Vector(
const std::array<ValueType, VVectorDimension> & stdArray)
146 template <
typename TVectorValueType>
150 BaseArray::operator=(r);
159 template <
typename Tt>
163 for (
unsigned int i = 0; i < VVectorDimension; ++i)
165 (*this)[i] =
static_cast<ValueType>((*this)[i] * value);
172 template <
typename Tt>
176 for (
unsigned int i = 0; i < VVectorDimension; ++i)
178 (*this)[i] =
static_cast<ValueType>((*this)[i] / value);
215 for (
unsigned int i = 0; i < VVectorDimension; ++i)
217 result[i] =
static_cast<ValueType>((*this)[i] * value);
224 template <
typename Tt>
230 for (
unsigned int i = 0; i < VVectorDimension; ++i)
232 result[i] =
static_cast<ValueType>((*this)[i] / value);
261 return VVectorDimension;
272 this->operator[](c) = v;
277 template <
typename TCoordRepB>
281 for (
unsigned int i = 0; i < VVectorDimension; ++i)
283 (*this)[i] =
static_cast<T
>(pa[i]);
288 template <
typename TCoordRepB>
292 for (
unsigned int i = 0; i < VVectorDimension; ++i)
294 r[i] =
static_cast<TCoordRepB
>((*this)[i]);
302template <
typename T,
unsigned int VVectorDimension>
305 return v.operator*(scalar);
309template <
typename T,
unsigned int VVectorDimension>
314template <
typename T,
unsigned int VVectorDimension>
328template <
typename T,
unsigned int VVectorDimension>
337template <
typename TValue,
typename... TVariadic>
339MakeVector(
const TValue firstValue,
const TVariadic... otherValues)
341 static_assert(std::conjunction_v<std::is_same<TVariadic, TValue>...>,
342 "The other values should have the same type as the first value.");
344 constexpr unsigned int dimension{ 1 +
sizeof...(TVariadic) };
345 const std::array<TValue, dimension> stdArray{ { firstValue, otherValues... } };
351#ifndef ITK_MANUAL_INSTANTIATION
352# include "itkVector.hxx"
Pixel-wise addition of two images.
Simulate a standard C array with copy semantics.
void swap(FixedArray &other)
A templated class holding a n-Dimensional vector.
vnl_vector_ref< T > GetVnlVector()
Vector(const std::array< ValueType, VVectorDimension > &stdArray)
Vector(const ValueType r[Dimension])
Self operator/(const Tt &value) const
bool operator==(const Self &v) const
Vector(std::nullptr_t)=delete
const Self & operator-=(const Self &vec)
ValueType operator*(const Self &other) const
Vector & operator=(const ValueType r[VVectorDimension])
static unsigned int GetVectorDimension()
Vector(const TVectorValueType r[Dimension])
vnl_vector< T > GetVnlVector() const
RealValueType Normalize()
RealValueType GetSquaredNorm() const
Self operator+(const Self &vec) const
void SetVnlVector(const vnl_vector< T > &)
Vector & operator=(const Vector< TVectorValueType, VVectorDimension > &r)
const Self & operator*=(const Tt &value)
static unsigned int GetNumberOfComponents()
void SetNthComponent(int c, const ComponentType &v)
const Self & operator+=(const Self &vec)
RealValueType GetNorm() const
Vector(const Vector< TVectorValueType, VVectorDimension > &r)
void CastFrom(const Vector< TCoordRepB, VVectorDimension > &pa)
Vector(const ValueType &r)
typename NumericTraits< ValueType >::RealType RealValueType
Self operator-(const Self &vec) const
Self operator*(const ValueType &value) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Self)
const Self & operator/=(const Tt &value)
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
std::istream & operator>>(std::istream &is, Point< T, VPointDimension > &vct)
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
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 > &)
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
auto MakeVector(const TValue firstValue, const TVariadic... otherValues)