 |
ITK
5.4.0
Insight Toolkit
|
Go to the documentation of this file.
23 #include "vnl/vnl_vector_ref.h"
61 template <
typename T,
unsigned int VVectorDimension = 3>
75 static constexpr
unsigned int Dimension = VVectorDimension;
90 return VVectorDimension;
95 SetVnlVector(
const vnl_vector<T> &);
103 GetVnlVector()
const;
109 #if !defined(ITK_LEGACY_REMOVE)
114 Vector(
const ValueType & r);
119 explicit Vector(
const ValueType & r);
122 Vector(std::nullptr_t) =
delete;
126 template <
typename TVectorValueType>
133 template <
typename TVectorValueType>
140 explicit Vector(
const std::array<ValueType, VVectorDimension> & stdArray)
145 template <
typename TVectorValueType>
149 BaseArray::operator=(r);
155 operator=(
const ValueType r[VVectorDimension]);
158 template <
typename Tt>
162 for (
unsigned int i = 0; i < VVectorDimension; ++i)
164 (*this)[i] = static_cast<ValueType>((*
this)[i] * value);
171 template <
typename Tt>
175 for (
unsigned int i = 0; i < VVectorDimension; ++i)
177 (*this)[i] = static_cast<ValueType>((*
this)[i] / value);
185 operator+=(
const Self & vec);
189 operator-=(
const Self & vec);
214 for (
unsigned int i = 0; i < VVectorDimension; ++i)
216 result[i] = static_cast<ValueType>((*
this)[i] * value);
223 template <
typename Tt>
229 for (
unsigned int i = 0; i < VVectorDimension; ++i)
231 result[i] = static_cast<ValueType>((*
this)[i] / value);
246 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(
Self);
254 GetSquaredNorm()
const;
260 return VVectorDimension;
271 this->operator[](c) = v;
276 template <
typename TCoordRepB>
280 for (
unsigned int i = 0; i < VVectorDimension; ++i)
282 (*this)[i] = static_cast<T>(pa[i]);
287 template <
typename TCoordRepB>
291 for (
unsigned int i = 0; i < VVectorDimension; ++i)
293 r[i] = static_cast<TCoordRepB>((*
this)[i]);
301 template <
typename T,
unsigned int VVectorDimension>
304 return v.operator*(scalar);
308 template <
typename T,
unsigned int VVectorDimension>
310 operator<<(std::ostream & os,
const Vector<T, VVectorDimension> & vct);
313 template <
typename T,
unsigned int VVectorDimension>
315 operator>>(std::istream & is, Vector<T, VVectorDimension> & vct);
317 ITKCommon_EXPORT Vector<double, 3>
318 CrossProduct(
const Vector<double, 3> &,
const Vector<double, 3> &);
320 ITKCommon_EXPORT Vector<float, 3>
321 CrossProduct(
const Vector<float, 3> &,
const Vector<float, 3> &);
323 ITKCommon_EXPORT Vector<int, 3>
324 CrossProduct(
const Vector<int, 3> &,
const Vector<int, 3> &);
327 template <
typename T,
unsigned int VVectorDimension>
336 template <
typename TValue,
typename... TVariadic>
338 MakeVector(
const TValue firstValue,
const TVariadic... otherValues)
341 const auto assertSameType = [](
const auto value) {
342 static_assert(std::is_same_v<decltype(value),
const TValue>,
"Each value must have the same type!");
345 const bool assertions[] = {
true, assertSameType(otherValues)... };
347 (void)assertSameType;
350 constexpr
unsigned int dimension{ 1 +
sizeof...(TVariadic) };
351 const std::array<TValue, dimension> stdArray{ { firstValue, otherValues... } };
357 #ifndef ITK_MANUAL_INSTANTIATION
358 # include "itkVector.hxx"
const Self & operator/=(const Tt &value)
void CastFrom(const Vector< TCoordRepB, VVectorDimension > &pa)
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
const Self & operator*=(const Tt &value)
CovariantVector< T, VVectorDimension > operator*(const T &scalar, const CovariantVector< T, VVectorDimension > &v)
auto MakeVector(const TValue firstValue, const TVariadic... otherValues)
Self operator*(const ValueType &value) const
void swap(Array< T > &a, Array< T > &b)
A templated class holding a n-Dimensional vector.
ConstNeighborhoodIterator< TImage > operator-(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
Vector(const std::array< ValueType, VVectorDimension > &stdArray)
Vector(const ValueType r[Dimension])
Self operator/(const Tt &value) const
typename NumericTraits< ValueType >::RealType RealValueType
static unsigned int GetNumberOfComponents()
void SetNthComponent(int c, const ComponentType &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)
Simulate a standard C array with copy semantics.
static unsigned int GetVectorDimension()
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Vector & operator=(const Vector< TVectorValueType, VVectorDimension > &r)
void swap(FixedArray &other)
ConstNeighborhoodIterator< TImage > operator+(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
Vector(const Vector< TVectorValueType, VVectorDimension > &r)
bool operator==(const Self &v) const
Vector(const TVectorValueType r[Dimension])
constexpr unsigned int Dimension
std::istream & operator>>(std::istream &is, Point< T, VPointDimension > &vct)