|
ITK
5.2.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 VDimension,
bool VBeginAtZero>
115 for (
unsigned i = 0; i < (VDimension - 1); ++i)
117 auto & indexValue =
m_Index[i];
150 for (
unsigned 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 i = VDimension; i > 0; --i)
207 const auto difference = lhs.m_Index[i - 1] - rhs.m_Index[i - 1];
266 using MinIndexType =
typename std::conditional<VBeginAtZero, ZeroIndex, IndexType>::type;
317 template <
bool VIsSubstitutionFailure = VBeginAtZero,
318 typename TVoid =
typename std::enable_if<!VIsSubstitutionFailure>::type>
326 static_assert(!VIsSubstitutionFailure,
327 "This template should (of course) be instantiated without substitution failure.");
328 static_assert(std::is_same<TVoid, void>::value,
329 "std::enable_if<!VIsSubstitutionFailure> should yield void, by definition.");
330 static_assert(!VBeginAtZero,
"This constructor should only be is available when VBeginAtZero is false.");
357 return this->
begin();
400 std::size_t result = 1;
402 for (
unsigned i = 0; i < VDimension; ++i)
428 const bool sizeHasZeroValue = [&
size] {
429 for (
const auto sizeValue :
size)
444 for (
unsigned i = 0; i < VDimension; ++i)
446 index[i] = minIndex[i] + static_cast<IndexValueType>(normalizedSize[i]) - 1;
461 template <
unsigned VDimension>
464 template <
unsigned 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.
constexpr IndexValueType operator[](unsigned) const
static IndexType CalculateMaxIndex(const MinIndexType &minIndex, const SizeType &size)
bool empty() const noexcept
pointer operator->() 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
constexpr static unsigned Dimension
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
std::reverse_iterator< const_iterator > const_reverse_iterator
const_reverse_iterator crbegin() const noexcept
std::vcl_size_t size() const noexcept
IndexRange(const ImageRegion< VDimension > &imageRegion)
std::ptrdiff_t difference_type
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
const_iterator operator++(int) noexcept
reverse_iterator rend() const noexcept
static Self Filled(const IndexValueType value)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
typename std::conditional< VBeginAtZero, ZeroIndex, IndexType >::type MinIndexType
std::bidirectional_iterator_tag iterator_category
friend bool operator==(const const_iterator &lhs, const const_iterator &rhs) noexcept
typename iterator::MinIndexType MinIndexType
signed long IndexValueType
iterator begin() const noexcept
IndexRange(const SizeType &gridSize)
const_iterator & operator--() noexcept
friend bool operator<(const const_iterator &lhs, const const_iterator &rhs) noexcept