 |
ITK
5.3.0
Insight Toolkit
|
Go to the documentation of this file.
25 #include <type_traits>
69 template <
unsigned int VDimension = 2>
70 struct ITK_TEMPLATE_EXPORT
Size final
84 static constexpr
unsigned int Dimension = VDimension;
87 static constexpr
unsigned int
99 for (
unsigned int i = 0; i < VDimension; ++i)
110 for (
unsigned int i = 0; i < VDimension; ++i)
124 for (
unsigned int i = 0; i < VDimension; ++i)
135 for (
unsigned int i = 0; i < VDimension; ++i)
148 for (
unsigned int i = 0; i < VDimension; ++i)
159 for (
unsigned int i = 0; i < VDimension; ++i)
172 return m_InternalArray;
182 std::copy_n(val, VDimension, m_InternalArray);
194 m_InternalArray[element] = val;
206 return m_InternalArray[element];
214 std::fill_n(begin(), size(), value);
231 static_assert(VDimension > 0,
"Error: Only positive value sized VDimension allowed");
258 std::fill_n(begin(), size(), newValue);
267 constexpr const_iterator
270 return &m_InternalArray[0];
276 return &m_InternalArray[0];
279 constexpr const_iterator
282 return &m_InternalArray[0];
285 constexpr const_iterator
288 return &m_InternalArray[VDimension];
294 return &m_InternalArray[VDimension];
297 constexpr const_iterator
300 return &m_InternalArray[VDimension];
309 const_reverse_iterator
321 const_reverse_iterator
352 ExceptionThrowingBoundsCheck(pos);
353 return m_InternalArray[pos];
359 ExceptionThrowingBoundsCheck(pos);
360 return m_InternalArray[pos];
378 return VDimension ? *(end() - 1) : *end();
384 return VDimension ? *(end() - 1) : *end();
390 return &m_InternalArray[0];
396 return &m_InternalArray[0];
403 if (pos >= VDimension)
405 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
412 static constexpr
Self
415 return MakeFilled<Self>(value);
421 template <
unsigned int VDimension>
426 for (
unsigned int i = 0; i + 1 < VDimension; ++i)
428 os << obj[i] <<
", ";
432 os << obj[VDimension - 1];
440 template <
unsigned int VDimension>
447 template <
unsigned int VDimension>
451 return !(one == two);
454 template <
unsigned int VDimension>
458 return std::lexicographical_compare(one.
begin(), one.
end(), two.
begin(), two.
end());
461 template <
unsigned int VDimension>
468 template <
unsigned int VDimension>
475 template <
unsigned int VDimension>
483 template <
unsigned int VDimension>
492 template <
typename... T>
496 const auto toValueType = [](
const auto value) {
497 static_assert(std::is_integral<decltype(value)>::value,
"Each value must have an integral type!");
498 return static_cast<SizeValueType>(value);
500 return Size<
sizeof...(T)>{ { toValueType(values)... } };
506 template <
unsigned int VDimension>
void SetElement(unsigned long element, SizeValueType val)
reverse_iterator rbegin()
bool operator<(const Index< VDimension > &one, const Index< VDimension > &two)
ptrdiff_t difference_type
bool operator<=(const Index< VDimension > &one, const Index< VDimension > &two)
Represent a n-dimensional size (bounds) of a n-dimensional image.
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
void ExceptionThrowingBoundsCheck(size_type pos) const
auto MakeSize(const T... values)
void swap(Array< T > &a, Array< T > &b)
itk::SizeValueType SizeValueType
std::reverse_iterator< iterator > reverse_iterator
static constexpr Self Filled(const SizeValueType value)
constexpr iterator begin()
const Self & operator+=(const Self &vec)
const_reference back() const
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]
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 front() const
const_reference at(size_type pos) const
constexpr const_iterator end() const
constexpr unsigned int Dimension
constexpr size_type max_size() const
reference at(size_type pos)
static constexpr unsigned int Dimension
unsigned long SizeValueType
const SizeValueType * GetSize() const