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);
217 for (
unsigned int i = 0; i < VVectorDimension; ++i)
219 result[i] =
static_cast<ValueType>((*this)[i] * value);
226 template <
typename Tt>
232 for (
unsigned int i = 0; i < VVectorDimension; ++i)
234 result[i] =
static_cast<ValueType>((*this)[i] / value);
263 return VVectorDimension;
274 this->operator[](c) = v;
279 template <
typename TCoordinateB>
283 for (
unsigned int i = 0; i < VVectorDimension; ++i)
285 (*this)[i] =
static_cast<T
>(pa[i]);
290 template <
typename TCoordinateB>
294 for (
unsigned int i = 0; i < VVectorDimension; ++i)
296 r[i] =
static_cast<TCoordinateB
>((*this)[i]);
304template <
typename T,
unsigned int VVectorDimension>
305inline Vector<T, VVectorDimension>
308 return v.operator*(scalar);
312template <
typename T,
unsigned int VVectorDimension>
317template <
typename T,
unsigned int VVectorDimension>
331template <
typename T,
unsigned int VVectorDimension>
340template <
typename TValue,
typename... TVariadic>
342MakeVector(
const TValue firstValue,
const TVariadic... otherValues)
344 static_assert(std::conjunction_v<std::is_same<TVariadic, TValue>...>,
345 "The other values should have the same type as the first value.");
347 constexpr unsigned int dimension{ 1 +
sizeof...(TVariadic) };
348 const std::array<TValue, dimension> stdArray{ { firstValue, otherValues... } };
354#ifndef ITK_MANUAL_INSTANTIATION
355# include "itkVector.hxx"
Pixel-wise addition of two images.
Simulate a standard C array with copy semantics.
A templated class holding a n-Dimensional vector.
vnl_vector_ref< T > GetVnlVector()
Vector(const std::array< ValueType, VVectorDimension > &stdArray)
void CastFrom(const Vector< TCoordinateB, VVectorDimension > &pa)
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)
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)