ITK  5.0.0
Insight Segmentation and Registration Toolkit
Classes | Public Types | Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
itk::Experimental::ImageBufferRange< TImage > Class Template Referencefinal

#include <itkImageBufferRange.h>

Detailed Description

template<typename TImage>
class itk::Experimental::ImageBufferRange< TImage >

Modern C++11 range to iterate over the pixels of an image. Designed to conform to Standard C++ Iterator requirements, so that it can be used in range-based for loop, and passed to Standard C++ algorithms.

The following example adds 42 to each pixel, using a range-based for loop:

ImageBufferRange<ImageType> range{ *image };
for (auto&& pixel : range)
{
pixel = pixel + 42;
}

The following example prints the values of the pixels:

for (const auto pixel : range)
{
std::cout << pixel << std::endl;
}
Author
Niels Dekker, LKEB, Leiden University Medical Center
See Also
ImageIterator
ImageConstIterator
IndexRange
ShapedImageNeighborhoodRange

Definition at line 75 of file itkImageBufferRange.h.

Classes

class  AccessorFunctorInitializer
 
struct  EmptyAccessorFunctor
 
class  IteratorInitializer
 
class  PixelProxy
 
class  PixelProxy< false, TDummy >
 
class  PixelProxy< true, TDummy >
 
class  QualifiedIterator
 

Public Types

using const_iterator = typename std::conditional< UsingPointerAsIterator, const InternalPixelType *, QualifiedIterator< true >>::type
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using iterator = typename std::conditional< UsingPointerAsIterator, QualifiedInternalPixelType *, QualifiedIterator< IsImageTypeConst >>::type
 
using reverse_iterator = std::reverse_iterator< iterator >
 

Public Member Functions

iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
const_reverse_iterator crend () const noexcept
 
bool empty () const noexcept
 
iterator end () const noexcept
 
 ImageBufferRange ()=default
 
reverse_iterator rbegin () const noexcept
 
reverse_iterator rend () const noexcept
 
std::vcl_size_t size () const noexcept
 
 ImageBufferRange (ImageType &image)
 
QualifiedIterator< false >
::reference 
operator[] (const std::vcl_size_t n) const noexcept
 

Private Types

using AccessorFunctorType = typename TImage::AccessorFunctorType
 
using ImageType = TImage
 
using InternalPixelType = typename TImage::InternalPixelType
 
using OptionalAccessorFunctorType = typename std::conditional< SupportsDirectPixelAccess, EmptyAccessorFunctor, AccessorFunctorType >::type
 
using PixelType = typename TImage::PixelType
 
using QualifiedInternalPixelType = typename std::conditional< IsImageTypeConst, const InternalPixelType, InternalPixelType >::type
 

Private Attributes

QualifiedInternalPixelTypem_ImageBufferPointer = nullptr
 
SizeValueType m_NumberOfPixels = 0
 
OptionalAccessorFunctorType m_OptionalAccessorFunctor
 

Static Private Attributes

static constexpr bool IsImageTypeConst = std::is_const<TImage>::value
 
static constexpr bool SupportsDirectPixelAccess
 
static constexpr bool UsingPointerAsIterator = SupportsDirectPixelAccess
 

Member Typedef Documentation

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::AccessorFunctorType = typename TImage::AccessorFunctorType
private

Definition at line 81 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::const_iterator = typename std::conditional<UsingPointerAsIterator, const InternalPixelType*, QualifiedIterator<true>>::type

Definition at line 577 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 581 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::ImageType = TImage
private

Definition at line 78 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::InternalPixelType = typename TImage::InternalPixelType
private

Definition at line 80 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::iterator = typename std::conditional<UsingPointerAsIterator, QualifiedInternalPixelType*, QualifiedIterator<IsImageTypeConst>>::type

Definition at line 579 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::OptionalAccessorFunctorType = typename std::conditional<SupportsDirectPixelAccess, EmptyAccessorFunctor, AccessorFunctorType>::type
private

Definition at line 98 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::PixelType = typename TImage::PixelType
private

Definition at line 79 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::QualifiedInternalPixelType = typename std::conditional<IsImageTypeConst, const InternalPixelType, InternalPixelType>::type
private

Definition at line 504 of file itkImageBufferRange.h.

template<typename TImage >
using itk::Experimental::ImageBufferRange< TImage >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 580 of file itkImageBufferRange.h.

Constructor & Destructor Documentation

template<typename TImage >
itk::Experimental::ImageBufferRange< TImage >::ImageBufferRange ( )
default

Explicitly-defaulted default-constructor. Constructs an empty range.

Note
The other five "special member functions" (copy-constructor, copy-assignment operator, move-constructor, move-assignment operator, and destructor) are defaulted implicitly, following the C++ "Rule of Zero".
template<typename TImage >
itk::Experimental::ImageBufferRange< TImage >::ImageBufferRange ( ImageType image)
inlineexplicit

Specifies a range of the pixels of an image.

Definition at line 594 of file itkImageBufferRange.h.

Member Function Documentation

template<typename TImage >
iterator itk::Experimental::ImageBufferRange< TImage >::begin ( ) const
inlinenoexcept
template<typename TImage >
const_iterator itk::Experimental::ImageBufferRange< TImage >::cbegin ( ) const
inlinenoexcept

Returns a const iterator to the first pixel. Provides only read-only access to the pixel data.

Definition at line 620 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::begin().

template<typename TImage >
const_iterator itk::Experimental::ImageBufferRange< TImage >::cend ( ) const
inlinenoexcept

Returns a const 'end iterator' for this range.

Definition at line 626 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::end().

template<typename TImage >
const_reverse_iterator itk::Experimental::ImageBufferRange< TImage >::crbegin ( ) const
inlinenoexcept

Returns a const reverse 'begin iterator' for this range.

Definition at line 644 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::rbegin().

template<typename TImage >
const_reverse_iterator itk::Experimental::ImageBufferRange< TImage >::crend ( ) const
inlinenoexcept

Returns a const reverse 'end iterator' for this range.

Definition at line 650 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::rend().

template<typename TImage >
bool itk::Experimental::ImageBufferRange< TImage >::empty ( ) const
inlinenoexcept

Tells whether the range is empty.

Definition at line 664 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::m_NumberOfPixels.

template<typename TImage >
iterator itk::Experimental::ImageBufferRange< TImage >::end ( ) const
inlinenoexcept
template<typename TImage >
QualifiedIterator<false>::reference itk::Experimental::ImageBufferRange< TImage >::operator[] ( const std::vcl_size_t  n) const
inlinenoexcept

Subscript operator. Allows random access, to the nth pixel.

Note
The return type QualifiedIterator<false>::reference is equivalent to iterator::reference.

Definition at line 674 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::begin(), and itk::Experimental::ImageBufferRange< TImage >::size().

template<typename TImage >
reverse_iterator itk::Experimental::ImageBufferRange< TImage >::rbegin ( ) const
inlinenoexcept

Returns a reverse 'begin iterator' for this range.

Definition at line 632 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::end().

Referenced by itk::Experimental::ImageBufferRange< TImage >::crbegin().

template<typename TImage >
reverse_iterator itk::Experimental::ImageBufferRange< TImage >::rend ( ) const
inlinenoexcept

Returns a reverse 'end iterator' for this range.

Definition at line 638 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::begin().

Referenced by itk::Experimental::ImageBufferRange< TImage >::crend().

template<typename TImage >
std::vcl_size_t itk::Experimental::ImageBufferRange< TImage >::size ( ) const
inlinenoexcept

Returns the size of the range, that is the number of pixels.

Definition at line 657 of file itkImageBufferRange.h.

References itk::Experimental::ImageBufferRange< TImage >::m_NumberOfPixels.

Referenced by itk::Experimental::ImageBufferRange< TImage >::operator[]().

Member Data Documentation

template<typename TImage >
constexpr bool itk::Experimental::ImageBufferRange< TImage >::IsImageTypeConst = std::is_const<TImage>::value
staticprivate

Definition at line 502 of file itkImageBufferRange.h.

template<typename TImage >
QualifiedInternalPixelType* itk::Experimental::ImageBufferRange< TImage >::m_ImageBufferPointer = nullptr
private
template<typename TImage >
SizeValueType itk::Experimental::ImageBufferRange< TImage >::m_NumberOfPixels = 0
private
template<typename TImage >
OptionalAccessorFunctorType itk::Experimental::ImageBufferRange< TImage >::m_OptionalAccessorFunctor
private

Definition at line 567 of file itkImageBufferRange.h.

template<typename TImage >
constexpr bool itk::Experimental::ImageBufferRange< TImage >::SupportsDirectPixelAccess
staticprivate
Initial value:
=
std::is_same<PixelType, InternalPixelType>::value &&
std::is_same<typename TImage::AccessorType, DefaultPixelAccessor<PixelType>>::value &&
std::is_same<AccessorFunctorType, DefaultPixelAccessorFunctor<typename std::remove_const<TImage>::type>>::value

Definition at line 87 of file itkImageBufferRange.h.

Referenced by itk::Experimental::ImageBufferRange< TImage >::QualifiedIterator< VIsConst >::operator*().

template<typename TImage >
constexpr bool itk::Experimental::ImageBufferRange< TImage >::UsingPointerAsIterator = SupportsDirectPixelAccess
staticprivate

Definition at line 93 of file itkImageBufferRange.h.


The documentation for this class was generated from the following file: