#include <itkIndexRange.h>
Modern C++11 range, supporting efficient iteration over the indices of an image grid space.
The following example prints all indices of an 2-D grid space of size 2x3.
The indices from IndexRange can also be used as consecutive locations of a ShapedImageNeighborhoodRange, for example:
IndexRange is designed to conform to Standard C++ Iterator requirements, so that it can be used in range-based for loop, and its iterators can be passed to Standard C++ algorithms.
Definition at line 78 of file itkIndexRange.h.
Collaboration diagram for itk::IndexRange< VDimension, VBeginAtZero >:Classes | |
| class | const_iterator |
Public Types | |
| using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
| using | IndexType = Index<VDimension> |
| using | iterator = const_iterator |
| using | reverse_iterator = std::reverse_iterator<iterator> |
| using | SizeType = Size<VDimension> |
Public Member Functions | |
| constexpr iterator | begin () const noexcept |
| constexpr const_iterator | cbegin () const noexcept |
| constexpr const_iterator | cend () const noexcept |
| const_reverse_iterator | crbegin () const noexcept |
| const_reverse_iterator | crend () const noexcept |
| constexpr bool | empty () const noexcept |
| constexpr iterator | end () const noexcept |
| IndexRange ()=default | |
| template<bool VIsSubstitutionFailure = VBeginAtZero, typename TVoid = std::enable_if_t<!VIsSubstitutionFailure>> | |
| IndexRange (const ImageRegion< VDimension > &imageRegion) | |
| constexpr | IndexRange (const SizeType &gridSize) |
| reverse_iterator | rbegin () const noexcept |
| reverse_iterator | rend () const noexcept |
| constexpr vcl_size_t | size () const noexcept |
Static Public Attributes | |
| static constexpr unsigned int | Dimension = VDimension |
Private Types | |
| using | MinIndexType = typename iterator::MinIndexType |
Static Private Member Functions | |
| static constexpr IndexType | CalculateMaxIndex (const MinIndexType &minIndex, const SizeType &size) |
Private Attributes | |
| IndexType | m_MaxIndex = IndexType::Filled(-1) |
| MinIndexType | m_MinIndex {} |
| using itk::IndexRange< VDimension, VBeginAtZero >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 305 of file itkIndexRange.h.
| using itk::IndexRange< VDimension, VBeginAtZero >::IndexType = Index<VDimension> |
Definition at line 83 of file itkIndexRange.h.
| using itk::IndexRange< VDimension, VBeginAtZero >::iterator = const_iterator |
Definition at line 303 of file itkIndexRange.h.
|
private |
Definition at line 433 of file itkIndexRange.h.
| using itk::IndexRange< VDimension, VBeginAtZero >::reverse_iterator = std::reverse_iterator<iterator> |
Definition at line 304 of file itkIndexRange.h.
| using itk::IndexRange< VDimension, VBeginAtZero >::SizeType = Size<VDimension> |
Definition at line 82 of file itkIndexRange.h.
|
default |
Explicitly defaulted default-constructor. Constructs an empty range.
|
inlineexplicitconstexpr |
Constructs a range of indices for the specified grid size.
Definition at line 317 of file itkIndexRange.h.
|
inlineexplicit |
Constructs a range of indices for the specified image region.
Definition at line 331 of file itkIndexRange.h.
|
inlinenodiscardconstexprnoexcept |
Returns an iterator to the first index.
Definition at line 348 of file itkIndexRange.h.
Referenced by itk::IndexRange< VDimension, false >< InputImageType::ImageDimension >::cbegin(), and itk::IndexRange< VDimension, false >< InputImageType::ImageDimension >::rend().
|
inlinestaticconstexprprivate |
Definition at line 436 of file itkIndexRange.h.
|
inlinenodiscardconstexprnoexcept |
Returns a const iterator to the first index. Provides only read-only access to the index data.
Definition at line 365 of file itkIndexRange.h.
|
inlinenodiscardconstexprnoexcept |
Returns a const 'end iterator' for this range.
Definition at line 372 of file itkIndexRange.h.
|
inlinenodiscardnoexcept |
Returns a const reverse 'begin iterator' for this range.
Definition at line 393 of file itkIndexRange.h.
|
inlinenodiscardnoexcept |
Returns a const reverse 'end iterator' for this range.
Definition at line 400 of file itkIndexRange.h.
|
inlinenodiscardconstexprnoexcept |
Tells whether the range is empty.
Definition at line 422 of file itkIndexRange.h.
|
inlinenodiscardconstexprnoexcept |
Returns an 'end iterator' for this range.
Definition at line 355 of file itkIndexRange.h.
Referenced by itk::IndexRange< VDimension, false >< InputImageType::ImageDimension >::cend(), and itk::IndexRange< VDimension, false >< InputImageType::ImageDimension >::rbegin().
|
inlinenodiscardnoexcept |
Returns a reverse 'begin iterator' for this range.
Definition at line 379 of file itkIndexRange.h.
Referenced by itk::IndexRange< VDimension, false >< InputImageType::ImageDimension >::crbegin().
|
inlinenodiscardnoexcept |
Returns a reverse 'end iterator' for this range.
Definition at line 386 of file itkIndexRange.h.
Referenced by itk::IndexRange< VDimension, false >< InputImageType::ImageDimension >::crend().
|
inlinenodiscardconstexprnoexcept |
Returns the size of the range, that is the number of indices.
Definition at line 408 of file itkIndexRange.h.
|
staticconstexpr |
Definition at line 81 of file itkIndexRange.h.
|
private |
Definition at line 469 of file itkIndexRange.h.
|
private |
Definition at line 466 of file itkIndexRange.h.