|
ITK
5.4.0
Insight Toolkit
|
Go to the documentation of this file.
26 #include <type_traits>
70 template <
unsigned int VDimension = 2>
71 struct ITK_TEMPLATE_EXPORT
Size final
85 static constexpr
unsigned int Dimension = VDimension;
88 static constexpr
unsigned int
100 for (
unsigned int i = 0; i < VDimension; ++i)
111 for (
unsigned int i = 0; i < VDimension; ++i)
125 for (
unsigned int i = 0; i < VDimension; ++i)
136 for (
unsigned int i = 0; i < VDimension; ++i)
149 for (
unsigned int i = 0; i < VDimension; ++i)
160 for (
unsigned int i = 0; i < VDimension; ++i)
173 return m_InternalArray;
183 std::copy_n(val, VDimension, m_InternalArray);
195 m_InternalArray[element] = val;
207 return m_InternalArray[element];
215 std::fill_n(begin(), size(), value);
245 static_assert(VDimension > 0,
"Error: Only positive value sized VDimension allowed");
272 std::fill_n(begin(), size(), newValue);
281 constexpr const_iterator
284 return &m_InternalArray[0];
290 return &m_InternalArray[0];
293 constexpr const_iterator
296 return &m_InternalArray[0];
299 constexpr const_iterator
302 return &m_InternalArray[VDimension];
308 return &m_InternalArray[VDimension];
311 constexpr const_iterator
314 return &m_InternalArray[VDimension];
323 const_reverse_iterator
335 const_reverse_iterator
366 ExceptionThrowingBoundsCheck(pos);
367 return m_InternalArray[pos];
373 ExceptionThrowingBoundsCheck(pos);
374 return m_InternalArray[pos];
392 return VDimension ? *(end() - 1) : *end();
398 return VDimension ? *(end() - 1) : *end();
404 return &m_InternalArray[0];
410 return &m_InternalArray[0];
417 if (pos >= VDimension)
419 throw std::out_of_range(
"array::ExceptionThrowingBoundsCheck");
426 static constexpr
Self
429 return MakeFilled<Self>(value);
435 template <
unsigned int VDimension>
440 for (
unsigned int i = 0; i + 1 < VDimension; ++i)
442 os << obj[i] <<
", ";
446 os << obj[VDimension - 1];
454 template <
unsigned int VDimension>
461 template <
unsigned int VDimension>
465 return !(one == two);
468 template <
unsigned int VDimension>
472 return std::lexicographical_compare(one.
begin(), one.
end(), two.
begin(), two.
end());
475 template <
unsigned int VDimension>
482 template <
unsigned int VDimension>
489 template <
unsigned int VDimension>
497 template <
unsigned int VDimension>
506 template <
typename... T>
510 const auto toValueType = [](
const auto value) {
511 static_assert(std::is_integral_v<decltype(value)>,
"Each value must have an integral type!");
512 return static_cast<SizeValueType>(value);
514 return Size<
sizeof...(T)>{ { toValueType(values)... } };
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
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)
unsigned long SizeValueType
const SizeValueType * GetSize() const