 |
ITK
5.4.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;
115 for (
unsigned int i = 0; i < (VDimension - 1); ++i)
117 auto & indexValue =
m_Index[i];
150 for (
unsigned int i = 0; i < (VDimension - 1); ++i)
152 auto & indexValue =
m_Index[i];
186 assert(lhs.m_MaxIndex == rhs.m_MaxIndex);
188 return lhs.m_Index == rhs.m_Index;
197 return !(lhs == rhs);
205 for (
unsigned int i = VDimension; i > 0; --i)
207 const auto difference = lhs.m_Index[i - 1] - rhs.m_Index[i - 1];
266 using MinIndexType = std::conditional_t<VBeginAtZero, ZeroIndex, IndexType>;
316 template <
bool VIsSubstitutionFailure = VBeginAtZero,
317 typename TVoid = std::enable_if_t<!VIsSubstitutionFailure>>
325 static_assert(!VIsSubstitutionFailure,
326 "This template should (of course) be instantiated without substitution failure.");
327 static_assert(std::is_same_v<TVoid, void>,
328 "std::enable_if<!VIsSubstitutionFailure> should yield void, by definition.");
329 static_assert(!VBeginAtZero,
"This constructor should only be is available when VBeginAtZero is false.");
356 return this->
begin();
401 for (
unsigned int i = 0; i < VDimension; ++i)
427 const bool sizeHasZeroValue = [&
size] {
428 for (
const auto sizeValue :
size)
443 for (
unsigned int i = 0; i < VDimension; ++i)
445 index[i] = minIndex[i] + static_cast<IndexValueType>(normalizedSize[i]) - 1;
460 template <
unsigned int VDimension>
463 template <
unsigned int VDimension>
Represent a n-dimensional index in a n-dimensional image.
reverse_iterator rbegin() const noexcept
const_iterator cend() const noexcept
Represent a n-dimensional size (bounds) of a n-dimensional image.
std::conditional_t< VBeginAtZero, ZeroIndex, IndexType > MinIndexType
static IndexType CalculateMaxIndex(const MinIndexType &minIndex, const SizeType &size)
bool empty() const noexcept
pointer operator->() const noexcept
ptrdiff_t difference_type
friend bool operator>(const const_iterator &lhs, const const_iterator &rhs) noexcept
friend bool operator<=(const const_iterator &lhs, const const_iterator &rhs) noexcept
const_iterator operator--(int) noexcept
const_reverse_iterator crend() const noexcept
friend bool operator>=(const const_iterator &lhs, const const_iterator &rhs) noexcept
Index< VDimension > IndexType
iterator end() const noexcept
const_iterator cbegin() const noexcept
vcl_size_t size() 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
reference operator*() const noexcept
friend bool operator!=(const const_iterator &lhs, const const_iterator &rhs) noexcept
const_iterator(const IndexType &index, const MinIndexType &minIndex, const IndexType &maxIndex) noexcept
const_iterator & operator++() noexcept
static constexpr Self Filled(const IndexValueType value)
const_iterator operator++(int) noexcept
reverse_iterator rend() const noexcept
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
std::bidirectional_iterator_tag iterator_category
friend bool operator==(const const_iterator &lhs, const const_iterator &rhs) noexcept
typename iterator::MinIndexType MinIndexType
constexpr IndexValueType operator[](unsigned int) const
iterator begin() const noexcept
IndexRange(const SizeType &gridSize)
const_iterator & operator--() noexcept
friend bool operator<(const const_iterator &lhs, const const_iterator &rhs) noexcept
static constexpr unsigned int Dimension