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)
123 for (
unsigned int i = 0; i < VDimension; ++i)
134 for (
unsigned int i = 0; i < VDimension; ++i)
147 for (
unsigned int i = 0; i < VDimension; ++i)
158 for (
unsigned int i = 0; i < VDimension; ++i)
171 return m_InternalArray;
181 std::copy_n(val, VDimension, m_InternalArray);
193 m_InternalArray[element] = val;
205 return m_InternalArray[element];
213 std::fill_n(begin(), size(), value);
243 static_assert(VDimension > 0,
"Error: Only positive value sized VDimension allowed");
270 std::fill_n(begin(), size(), newValue);
279 constexpr const_iterator
282 return &m_InternalArray[0];
288 return &m_InternalArray[0];
291 constexpr const_iterator
294 return &m_InternalArray[0];
297 constexpr const_iterator
300 return &m_InternalArray[VDimension];
306 return &m_InternalArray[VDimension];
309 constexpr const_iterator
312 return &m_InternalArray[VDimension];
321 const_reverse_iterator
333 const_reverse_iterator
364 ExceptionThrowingBoundsCheck(pos);
365 return m_InternalArray[pos];
371 ExceptionThrowingBoundsCheck(pos);
372 return m_InternalArray[pos];
381 constexpr const_reference
390 return VDimension ? *(end() - 1) : *end();
393 constexpr const_reference
396 return VDimension ? *(end() - 1) : *end();
402 return &m_InternalArray[0];
408 return &m_InternalArray[0];
415 if (pos >= VDimension)
417 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
424 static constexpr Self
427 return MakeFilled<Self>(value);
433template <
unsigned int VDimension>
438 for (
unsigned int i = 0; i + 1 < VDimension; ++i)
440 os << obj[i] <<
", ";
442 if constexpr (VDimension >= 1)
444 os << obj[VDimension - 1];
452template <
unsigned int VDimension>
459template <
unsigned int VDimension>
463 return !(one == two);
466template <
unsigned int VDimension>
470 return std::lexicographical_compare(one.
begin(), one.
end(), two.
begin(), two.
end());
473template <
unsigned int VDimension>
480template <
unsigned int VDimension>
487template <
unsigned int VDimension>
495template <
unsigned int VDimension>
504template <
typename... T>
508 const auto toValueType = [](
const auto value) {
509 static_assert(std::is_integral_v<
decltype(value)>,
"Each value must have an integral type!");
512 return Size<
sizeof...(T)>{ { toValueType(values)... } };
Pixel-wise addition of two images.
constexpr unsigned int Dimension
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
void swap(Size< VDimension > &one, Size< VDimension > &two)
void swap(Array< T > &a, Array< T > &b) noexcept
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)
unsigned long SizeValueType
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 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()
const_reverse_iterator rend() const