|
ITK
6.0.0
Insight Toolkit
|
Go to the documentation of this file.
19 #ifndef itkIndexRange_h
20 #define itkIndexRange_h
25 #include <type_traits>
77 template <
unsigned int VDimension,
bool VBeginAtZero>
81 static constexpr
unsigned int Dimension = VDimension;
123 for (
unsigned int i = 0; i < (VDimension - 1); ++i)
125 auto & indexValue =
m_Index[i];
158 for (
unsigned int i = 0; i < (VDimension - 1); ++i)
160 auto & indexValue =
m_Index[i];
194 assert(lhs.m_MaxIndex == rhs.m_MaxIndex);
196 return lhs.m_Index == rhs.m_Index;
205 return !(lhs == rhs);
210 friend constexpr
bool
213 for (
unsigned int i = VDimension; i > 0; --i)
215 const auto difference = lhs.m_Index[i - 1] - rhs.m_Index[i - 1];
232 friend constexpr
bool
241 friend constexpr
bool
250 friend constexpr
bool
282 using MinIndexType = std::conditional_t<VBeginAtZero, ZeroIndex, IndexType>;
334 template <
bool VIsSubstitutionFailure = VBeginAtZero,
335 typename TVoid = std::enable_if_t<!VIsSubstitutionFailure>>
343 static_assert(!VIsSubstitutionFailure,
344 "This template should (of course) be instantiated without substitution failure.");
345 static_assert(std::is_same_v<TVoid, void>,
346 "std::enable_if<!VIsSubstitutionFailure> should yield void, by definition.");
347 static_assert(!VBeginAtZero,
"This constructor should only be is available when VBeginAtZero is false.");
371 constexpr const_iterator
374 return this->
begin();
378 constexpr const_iterator
419 for (
unsigned int i = 0; i < VDimension; ++i)
445 const bool sizeHasZeroValue = [&
size] {
446 for (
const auto sizeValue :
size)
462 for (
unsigned int i = 0; i < VDimension; ++i)
464 index[i] = minIndex[i] + static_cast<IndexValueType>(normalizedSize[i]) - 1;
479 template <
unsigned int VDimension>
482 template <
unsigned int VDimension>
Represent a n-dimensional index in a n-dimensional image.
constexpr vcl_size_t size() const noexcept
constexpr friend bool operator>(const const_iterator &lhs, const const_iterator &rhs) noexcept
reverse_iterator rbegin() const noexcept
constexpr const_iterator & operator--() noexcept
Represent a n-dimensional size (bounds) of a n-dimensional image.
constexpr reference back()
constexpr const_iterator operator--(int) noexcept
constexpr friend bool operator>=(const const_iterator &lhs, const const_iterator &rhs) noexcept
std::conditional_t< VBeginAtZero, ZeroIndex, IndexType > MinIndexType
constexpr const_iterator operator++(int) noexcept
constexpr iterator end() const noexcept
ptrdiff_t difference_type
const_reverse_iterator crend() const noexcept
Index< VDimension > IndexType
constexpr friend bool operator<(const const_iterator &lhs, const const_iterator &rhs) noexcept
constexpr const_iterator(const IndexType &index, const MinIndexType &minIndex, const IndexType &maxIndex) noexcept
constexpr iterator begin() const noexcept
constexpr const_iterator cend() const noexcept
std::reverse_iterator< const_iterator > const_reverse_iterator
const_reverse_iterator crbegin() const noexcept
IndexRange(const ImageRegion< VDimension > &imageRegion)
std::reverse_iterator< iterator > reverse_iterator
friend bool operator!=(const const_iterator &lhs, const const_iterator &rhs) noexcept
constexpr const_iterator cbegin() const noexcept
const IndexType * pointer
constexpr reference operator*() const noexcept
constexpr pointer operator->() const noexcept
constexpr IndexRange(const SizeType &gridSize)
static constexpr Self Filled(const IndexValueType value)
reverse_iterator rend() const noexcept
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
std::bidirectional_iterator_tag iterator_category
constexpr bool empty() const noexcept
friend bool operator==(const const_iterator &lhs, const const_iterator &rhs) noexcept
typename iterator::MinIndexType MinIndexType
constexpr IndexValueType operator[](unsigned int) const
constexpr const_iterator & operator++() noexcept
static constexpr IndexType CalculateMaxIndex(const MinIndexType &minIndex, const SizeType &size)
constexpr friend bool operator<=(const const_iterator &lhs, const const_iterator &rhs) noexcept
static constexpr unsigned int Dimension