19#ifndef itkIndexRange_h
20#define itkIndexRange_h
76template <
unsigned int VDimension,
bool VBeginAtZero>
80 static constexpr unsigned int Dimension = VDimension;
124 for (
unsigned int i = 0; i < (VDimension - 1); ++i)
126 auto & indexValue =
m_Index[i];
159 for (
unsigned int i = 0; i < (VDimension - 1); ++i)
161 auto & indexValue =
m_Index[i];
193 assert(lhs.m_MaxIndex == rhs.m_MaxIndex);
197 return lhs.m_Position == rhs.m_Position;
206 return !(lhs == rhs);
211 friend constexpr bool
214 return lhs.m_Position < rhs.m_Position;
219 friend constexpr bool
228 friend constexpr bool
237 friend constexpr bool
269 using MinIndexType = std::conditional_t<VBeginAtZero, ZeroIndex, IndexType>;
275 const size_t position) noexcept
327 template <
bool VIsSubstitutionFailure = VBeginAtZero,
328 typename TVoid = std::enable_if_t<!VIsSubstitutionFailure>>
336 static_assert(!VIsSubstitutionFailure,
337 "This template should (of course) be instantiated without substitution failure.");
338 static_assert(std::is_same_v<TVoid, void>,
339 "std::enable_if<!VIsSubstitutionFailure> should yield void, by definition.");
340 static_assert(!VBeginAtZero,
"This constructor should only be is available when VBeginAtZero is false.");
362 [[nodiscard]]
constexpr const_iterator
365 return this->
begin();
369 [[nodiscard]]
constexpr const_iterator
405 [[nodiscard]]
constexpr size_t
410 for (
unsigned int i = 0; i < VDimension; ++i)
419 [[nodiscard]]
constexpr bool
436 const bool sizeHasZeroValue = [&
size] {
437 for (
const auto sizeValue :
size)
453 for (
unsigned int i = 0; i < VDimension; ++i)
455 index[i] = minIndex[i] +
static_cast<IndexValueType>(normalizedSize[i]) - 1;
470template <
unsigned int VDimension>
473template <
unsigned int VDimension>
477template <
unsigned int VDimension>
478[[nodiscard]]
constexpr auto
485template <
unsigned int VDimension>
493template <
unsigned int VDimension>
An image region represents a structured region of data.
friend bool operator!=(const const_iterator &lhs, const const_iterator &rhs) noexcept
friend constexpr bool operator>=(const const_iterator &lhs, const const_iterator &rhs) noexcept
friend constexpr bool operator<=(const const_iterator &lhs, const const_iterator &rhs) noexcept
constexpr const_iterator & operator--() noexcept
ptrdiff_t difference_type
std::bidirectional_iterator_tag iterator_category
friend constexpr bool operator<(const const_iterator &lhs, const const_iterator &rhs) noexcept
constexpr const_iterator(const IndexType &index, const MinIndexType &minIndex, const IndexType &maxIndex, const vcl_size_t position) noexcept
constexpr reference operator*() const noexcept
constexpr pointer operator->() const noexcept
const IndexType * pointer
friend bool operator==(const const_iterator &lhs, const const_iterator &rhs) noexcept
const IndexType & reference
std::conditional_t< VBeginAtZero, ZeroIndex, IndexType > MinIndexType
constexpr const_iterator & operator++() noexcept
constexpr const_iterator operator++(int) noexcept
constexpr const_iterator operator--(int) noexcept
friend constexpr bool operator>(const const_iterator &lhs, const const_iterator &rhs) noexcept
const_reverse_iterator crend() const noexcept
Index< VDimension > IndexType
std::reverse_iterator< const_iterator > const_reverse_iterator
constexpr bool empty() const noexcept
typename iterator::MinIndexType MinIndexType
Size< VDimension > SizeType
const_reverse_iterator crbegin() const noexcept
constexpr iterator end() const noexcept
constexpr vcl_size_t size() const noexcept
IndexRange(const ImageRegion< VDimension > &imageRegion)
std::reverse_iterator< iterator > reverse_iterator
static constexpr IndexType CalculateMaxIndex(const MinIndexType &minIndex, const SizeType &size)
constexpr const_iterator cend() const noexcept
static constexpr unsigned int Dimension
reverse_iterator rbegin() const noexcept
reverse_iterator rend() const noexcept
constexpr iterator begin() const noexcept
constexpr const_iterator cbegin() const noexcept
constexpr IndexRange(const SizeType &gridSize)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
IndexRange< VDimension, true > ZeroBasedIndexRange
IndexRange< VDimension, false > ImageRegionIndexRange
constexpr auto MakeIndexRange(const Size< VDimension > &gridSize)
constexpr IndexValueType operator[](unsigned int) const
Represent a n-dimensional index in a n-dimensional image.
static constexpr Self Filled(const IndexValueType value)
constexpr reference back()
Represent a n-dimensional size (bounds) of a n-dimensional image.