68template <
unsigned int VDimension = 2>
69struct ITK_TEMPLATE_EXPORT
Size final
83 static constexpr unsigned int Dimension = VDimension;
86 static constexpr unsigned int
98 for (
unsigned int i = 0; i < VDimension; ++i)
109 for (
unsigned int i = 0; i < VDimension; ++i)
122 for (
unsigned int i = 0; i < VDimension; ++i)
133 for (
unsigned int i = 0; i < VDimension; ++i)
146 for (
unsigned int i = 0; i < VDimension; ++i)
157 for (
unsigned int i = 0; i < VDimension; ++i)
241 static_assert(VDimension > 0,
"Error: Only positive value sized VDimension allowed");
276 constexpr const_iterator
288 constexpr const_iterator
294 constexpr const_iterator
306 constexpr const_iterator
318 const_reverse_iterator
330 const_reverse_iterator
360 constexpr const_reference
386 constexpr const_reference
395 return VDimension ? *(
end() - 1) : *
end();
398 constexpr const_reference
401 return VDimension ? *(
end() - 1) : *
end();
420 if (pos >= VDimension)
422 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
429 static constexpr Self
438template <
unsigned int VDimension>
443 for (
unsigned int i = 0; i + 1 < VDimension; ++i)
445 os << obj[i] <<
", ";
447 if constexpr (VDimension >= 1)
449 os << obj[VDimension - 1];
457template <
unsigned int VDimension>
464template <
unsigned int VDimension>
468 return !(one == two);
471template <
unsigned int VDimension>
475 return std::lexicographical_compare(one.
begin(), one.
end(), two.
begin(), two.
end());
478template <
unsigned int VDimension>
485template <
unsigned int VDimension>
492template <
unsigned int VDimension>
500template <
unsigned int VDimension>
504 std::swap(one.m_InternalArray, two.m_InternalArray);
509template <
typename... T>
513 const auto toValueType = [](
const auto value) {
514 static_assert(std::is_integral_v<
decltype(value)>,
"Each value must have an integral type!");
517 return Size<
sizeof...(T)>{ { toValueType(values)... } };
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
constexpr TContainer MakeFilled(typename TContainer::const_reference value)
void swap(Array< T > &a, Array< T > &b) noexcept
unsigned long SizeValueType
bool operator>(const Index< VDimension > &one, const Index< VDimension > &two)
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
bool operator<=(const Index< VDimension > &one, const Index< VDimension > &two)
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
auto MakeSize(const T... values)
bool operator!=(const Index< VDimension > &one, const Index< VDimension > &two)
bool operator<(const Index< VDimension > &one, const Index< VDimension > &two)
bool operator>=(const Index< VDimension > &one, const Index< VDimension > &two)
Represent a n-dimensional size (bounds) of a n-dimensional image.
constexpr const_iterator end() const
const value_type * const_iterator
constexpr iterator begin()
std::reverse_iterator< const_iterator > const_reverse_iterator
constexpr const_reference back() const
const Self operator-(const Self &vec) const
constexpr size_type max_size() const
constexpr size_type size() const
const_reference at(size_type pos) const
constexpr const_iterator cend() const
itk::SizeValueType SizeValueType
const SizeValueType * GetSize() const
const Self & operator-=(const Self &vec)
void SetSize(const SizeValueType val[VDimension])
SizeValueType GetElement(unsigned long element) const
constexpr const_reference front() const
const SizeValueType * data() const
constexpr reference operator[](size_type pos)
constexpr const_iterator begin() const
const Self & operator*=(const Self &vec)
void Fill(SizeValueType value)
const Self operator*(const Self &vec) const
void swap(Size &other) noexcept
static constexpr unsigned int Dimension
void assign(const value_type &newValue)
constexpr reference back()
const Self operator+(const Self &vec) const
void SetElement(unsigned long element, SizeValueType val)
constexpr const_iterator cbegin() const
static constexpr unsigned int GetSizeDimension()
std::reverse_iterator< iterator > reverse_iterator
constexpr SizeValueType CalculateProductOfElements() const
constexpr const_reference operator[](size_type pos) const
constexpr bool empty() const
constexpr reference front()
const value_type & const_reference
itk::SizeValueType value_type
void ExceptionThrowingBoundsCheck(size_type pos) const
ptrdiff_t difference_type
const Self & operator+=(const Self &vec)
SizeValueType m_InternalArray[VDimension]
reference at(size_type pos)
static constexpr Self Filled(const SizeValueType value)
const_reverse_iterator rbegin() const
reverse_iterator rbegin()
Size< VDimension > SizeType
const_reverse_iterator rend() const