|
ITK
5.1.0
Insight Toolkit
|
Go to the documentation of this file.
19 #ifndef itkIndexRange_h
20 #define itkIndexRange_h
25 #include <type_traits>
33 namespace Experimental
79 template <
unsigned VDimension,
bool VBeginAtZero>
117 for (
unsigned i = 0; i < (VDimension - 1); ++i)
119 auto & indexValue =
m_Index[i];
152 for (
unsigned i = 0; i < (VDimension - 1); ++i)
154 auto & indexValue =
m_Index[i];
188 assert(lhs.m_MaxIndex == rhs.m_MaxIndex);
190 return lhs.m_Index == rhs.m_Index;
199 return !(lhs == rhs);
207 for (
unsigned i = VDimension; i > 0; --i)
209 const auto difference = lhs.m_Index[i - 1] - rhs.m_Index[i - 1];
268 using MinIndexType =
typename std::conditional<VBeginAtZero, ZeroIndex, IndexType>::type;
319 template <
bool VIsSubstitutionFailure = VBeginAtZero,
320 typename TVoid =
typename std::enable_if<!VIsSubstitutionFailure>::type>
328 static_assert(!VIsSubstitutionFailure,
329 "This template should (of course) be instantiated without substitution failure.");
330 static_assert(std::is_same<TVoid, void>::value,
331 "std::enable_if<!VIsSubstitutionFailure> should yield void, by definition.");
332 static_assert(!VBeginAtZero,
"This constructor should only be is available when VBeginAtZero is false.");
359 return this->
begin();
402 std::size_t result = 1;
404 for (
unsigned i = 0; i < VDimension; ++i)
430 const bool sizeHasZeroValue = [&
size] {
431 for (
const auto sizeValue :
size)
446 for (
unsigned i = 0; i < VDimension; ++i)
448 index[i] = minIndex[i] + static_cast<IndexValueType>(normalizedSize[i]) - 1;
463 template <
unsigned VDimension>
466 template <
unsigned VDimension>
const_iterator & operator++() noexcept
const_reverse_iterator crbegin() const noexcept
const_iterator operator--(int) noexcept
std::reverse_iterator< iterator > reverse_iterator
iterator end() const noexcept
std::vcl_size_t size() const noexcept
Represent a n-dimensional index in a n-dimensional image.
IndexRange(const ImageRegion< VDimension > &imageRegion)
typename std::conditional< VBeginAtZero, ZeroIndex, IndexType >::type MinIndexType
friend bool operator==(const const_iterator &lhs, const const_iterator &rhs) noexcept
Represent a n-dimensional size (bounds) of a n-dimensional image.
std::ptrdiff_t difference_type
const_iterator(const IndexType &index, const MinIndexType &minIndex, const IndexType &maxIndex) noexcept
std::bidirectional_iterator_tag iterator_category
typename iterator::MinIndexType MinIndexType
Index< VDimension > IndexType
reference operator*() const noexcept
friend bool operator>(const const_iterator &lhs, const const_iterator &rhs) noexcept
IndexRange(const SizeType &gridSize)
const_iterator operator++(int) noexcept
friend bool operator<(const const_iterator &lhs, const const_iterator &rhs) noexcept
const_iterator & operator--() noexcept
const_iterator cend() const noexcept
constexpr static unsigned Dimension
iterator begin() const noexcept
constexpr IndexValueType operator[](unsigned) const
reverse_iterator rend() const noexcept
bool empty() const noexcept
static IndexType CalculateMaxIndex(const MinIndexType &minIndex, const SizeType &size)
const_iterator cbegin() const noexcept
static Self Filled(const IndexValueType value)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
std::reverse_iterator< const_iterator > const_reverse_iterator
signed long IndexValueType
const_reverse_iterator crend() const noexcept
friend bool operator<=(const const_iterator &lhs, const const_iterator &rhs) noexcept
friend bool operator>=(const const_iterator &lhs, const const_iterator &rhs) noexcept
reverse_iterator rbegin() const noexcept
friend bool operator!=(const const_iterator &lhs, const const_iterator &rhs) noexcept
pointer operator->() const noexcept