|
ITK
6.0.0
Insight Toolkit
|
Go to the documentation of this file.
26 #include <type_traits>
68 template <
unsigned int VDimension = 2>
69 struct 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);
433 template <
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];
452 template <
unsigned int VDimension>
459 template <
unsigned int VDimension>
463 return !(one == two);
466 template <
unsigned int VDimension>
470 return std::lexicographical_compare(one.
begin(), one.
end(), two.
begin(), two.
end());
473 template <
unsigned int VDimension>
480 template <
unsigned int VDimension>
487 template <
unsigned int VDimension>
495 template <
unsigned int VDimension>
504 template <
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!");
510 return static_cast<SizeValueType>(value);
512 return Size<
sizeof...(T)>{ { toValueType(values)... } };
constexpr const_reference front() const
constexpr SizeValueType CalculateProductOfElements() const
void SetElement(unsigned long element, SizeValueType val)
reverse_iterator rbegin()
bool operator<(const Index< VDimension > &one, const Index< VDimension > &two)
ptrdiff_t difference_type
constexpr const_reference back() const
bool operator<=(const Index< VDimension > &one, const Index< VDimension > &two)
Represent a n-dimensional size (bounds) of a n-dimensional image.
void ExceptionThrowingBoundsCheck(size_type pos) const
auto MakeSize(const T... values)
itk::SizeValueType SizeValueType
std::reverse_iterator< iterator > reverse_iterator
static constexpr Self Filled(const SizeValueType value)
constexpr iterator begin()
constexpr reference front()
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
const Self & operator+=(const Self &vec)
const value_type & const_reference
void Fill(SizeValueType value)
constexpr const_iterator begin() const
const_reverse_iterator rbegin() const
const_reverse_iterator rend() const
static constexpr unsigned int GetSizeDimension()
const value_type * const_iterator
constexpr reference operator[](size_type pos)
constexpr const_iterator cend() const
std::reverse_iterator< const_iterator > const_reverse_iterator
const Self & operator*=(const Self &vec)
void assign(const value_type &newValue)
const Self & operator-=(const Self &vec)
constexpr const_iterator cbegin() const
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)
const Self operator-(const Self &vec) const
constexpr const_reference operator[](size_type pos) const
void SetSize(const SizeValueType val[VDimension])
SizeValueType GetElement(unsigned long element) const
const Self operator*(const Self &vec) const
bool operator!=(const Index< VDimension > &one, const Index< VDimension > &two)
constexpr size_type size() const
SizeValueType m_InternalArray[VDimension]
void swap(Array< T > &a, Array< T > &b) noexcept
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
void swap(Size< VDimension > &one, Size< VDimension > &two)
const SizeValueType * data() const
constexpr bool empty() const
const Self operator+(const Self &vec) const
itk::SizeValueType value_type
const_reference at(size_type pos) const
constexpr reference back()
constexpr const_iterator end() const
constexpr unsigned int Dimension
constexpr size_type max_size() const
reference at(size_type pos)
unsigned long SizeValueType
const SizeValueType * GetSize() const