ITK  6.0.0
Insight Toolkit
Classes | Public Types | Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
itk::ImageRegionRange< TImage > Class Template Referencefinal

#include <itkImageRegionRange.h>

Detailed Description

template<typename TImage>
class itk::ImageRegionRange< TImage >

Modern C++11 range to iterate over the pixels of an image region. 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:

ImageRegionRange range{ *image, imageRegion };
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
ImageRegionIterator
ImageRegionIndexRange
ImageBufferRange
ShapedImageNeighborhoodRange

Definition at line 72 of file itkImageRegionRange.h.

+ Collaboration diagram for itk::ImageRegionRange< TImage >:

Classes

class  QualifiedIterator
 

Public Types

using const_iterator = QualifiedIterator< true >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using iterator = QualifiedIterator< IsImageTypeConst >
 
using reverse_iterator = std::reverse_iterator< iterator >
 

Public Member Functions

const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
const_reverse_iterator crend () const noexcept
 
 ImageRegionRange () noexcept=default
 
 ImageRegionRange (TImage &image)
 
 ~ImageRegionRange ()=default
 
 ImageRegionRange (TImage &image, const RegionType &iterationRegion)
 
iterator begin () const noexcept
 
iterator end () const noexcept
 
reverse_iterator rbegin () const noexcept
 
reverse_iterator rend () const noexcept
 
vcl_size_t size () const noexcept
 
bool empty () const noexcept
 

Private Types

using BufferIteratorType = typename ImageBufferRange< TImage >::iterator
 
using ImageDimensionType = typename TImage::ImageDimensionType
 
using IndexType = typename RegionType::IndexType
 
using OffsetTableType = Offset< ImageDimension+1 >
 
using OffsetType = typename TImage::OffsetType
 
using PixelType = typename TImage::PixelType
 
using RegionType = typename TImage::RegionType
 
using Self = ImageRegionRange
 
using SizeType = typename TImage::SizeType
 

Static Private Member Functions

static OffsetValueType ComputeOffset (const OffsetTableType &offsetTable, const IndexType &bufferedRegionIndex, const IndexType &index)
 

Private Attributes

BufferIteratorType m_BufferBegin {}
 
IndexType m_BufferedRegionIndex { {} }
 
IndexType m_IterationRegionIndex { {} }
 
SizeType m_IterationRegionSize { {} }
 
OffsetTableType m_OffsetTable { {} }
 

Static Private Attributes

static constexpr ImageDimensionType ImageDimension = TImage::ImageDimension
 
static constexpr bool IsImageTypeConst = std::is_const_v<TImage>
 

Member Typedef Documentation

◆ BufferIteratorType

template<typename TImage >
using itk::ImageRegionRange< TImage >::BufferIteratorType = typename ImageBufferRange<TImage>::iterator
private

Definition at line 82 of file itkImageRegionRange.h.

◆ const_iterator

template<typename TImage >
using itk::ImageRegionRange< TImage >::const_iterator = QualifiedIterator<true>

Definition at line 318 of file itkImageRegionRange.h.

◆ const_reverse_iterator

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

Definition at line 321 of file itkImageRegionRange.h.

◆ ImageDimensionType

template<typename TImage >
using itk::ImageRegionRange< TImage >::ImageDimensionType = typename TImage::ImageDimensionType
private

Definition at line 76 of file itkImageRegionRange.h.

◆ IndexType

template<typename TImage >
using itk::ImageRegionRange< TImage >::IndexType = typename RegionType::IndexType
private

Definition at line 87 of file itkImageRegionRange.h.

◆ iterator

template<typename TImage >
using itk::ImageRegionRange< TImage >::iterator = QualifiedIterator<IsImageTypeConst>

Definition at line 319 of file itkImageRegionRange.h.

◆ OffsetTableType

template<typename TImage >
using itk::ImageRegionRange< TImage >::OffsetTableType = Offset<ImageDimension + 1>
private

Definition at line 86 of file itkImageRegionRange.h.

◆ OffsetType

template<typename TImage >
using itk::ImageRegionRange< TImage >::OffsetType = typename TImage::OffsetType
private

Definition at line 85 of file itkImageRegionRange.h.

◆ PixelType

template<typename TImage >
using itk::ImageRegionRange< TImage >::PixelType = typename TImage::PixelType
private

Definition at line 77 of file itkImageRegionRange.h.

◆ RegionType

template<typename TImage >
using itk::ImageRegionRange< TImage >::RegionType = typename TImage::RegionType
private

Definition at line 83 of file itkImageRegionRange.h.

◆ reverse_iterator

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

Definition at line 320 of file itkImageRegionRange.h.

◆ Self

template<typename TImage >
using itk::ImageRegionRange< TImage >::Self = ImageRegionRange
private

Definition at line 75 of file itkImageRegionRange.h.

◆ SizeType

template<typename TImage >
using itk::ImageRegionRange< TImage >::SizeType = typename TImage::SizeType
private

Definition at line 84 of file itkImageRegionRange.h.

Constructor & Destructor Documentation

◆ ImageRegionRange() [1/3]

template<typename TImage >
itk::ImageRegionRange< TImage >::ImageRegionRange ( )
defaultnoexcept

Constructs an empty range

◆ ImageRegionRange() [2/3]

template<typename TImage >
itk::ImageRegionRange< TImage >::ImageRegionRange ( TImage &  image,
const RegionType iterationRegion 
)
inlineexplicit

Constructs an object, representing the range of pixels of the specified region, within the specified image.

Note
This constructor supports class template argument deduction (CTAD).

Definition at line 333 of file itkImageRegionRange.h.

◆ ImageRegionRange() [3/3]

template<typename TImage >
itk::ImageRegionRange< TImage >::ImageRegionRange ( TImage &  image)
inlineexplicit

Constructs a range of the pixels of the requested region of an image.

Note
This constructor supports class template argument deduction (CTAD).

Definition at line 366 of file itkImageRegionRange.h.

◆ ~ImageRegionRange()

template<typename TImage >
itk::ImageRegionRange< TImage >::~ImageRegionRange ( )
default

Explicitly-defaulted destructor.

Member Function Documentation

◆ begin()

template<typename TImage >
iterator itk::ImageRegionRange< TImage >::begin ( ) const
inlinenoexcept

◆ cbegin()

template<typename TImage >
const_iterator itk::ImageRegionRange< TImage >::cbegin ( ) const
inlinenoexcept

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

Definition at line 402 of file itkImageRegionRange.h.

References itk::ImageRegionRange< TImage >::begin().

◆ cend()

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

Returns a const 'end iterator' for this range.

Definition at line 409 of file itkImageRegionRange.h.

References itk::ImageRegionRange< TImage >::end().

◆ ComputeOffset()

template<typename TImage >
static OffsetValueType itk::ImageRegionRange< TImage >::ComputeOffset ( const OffsetTableType offsetTable,
const IndexType bufferedRegionIndex,
const IndexType index 
)
inlinestaticprivate

◆ crbegin()

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

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

Definition at line 432 of file itkImageRegionRange.h.

References itk::ImageRegionRange< TImage >::rbegin().

◆ crend()

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

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

Definition at line 439 of file itkImageRegionRange.h.

References itk::ImageRegionRange< TImage >::rend().

◆ empty()

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

Tells whether the range is empty.

Definition at line 457 of file itkImageRegionRange.h.

References itk::ImageRegionRange< TImage >::m_IterationRegionSize.

◆ end()

template<typename TImage >
iterator itk::ImageRegionRange< TImage >::end ( ) const
inlinenoexcept

◆ rbegin()

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

Returns a reverse 'begin iterator' for this range.

Definition at line 416 of file itkImageRegionRange.h.

References itk::ImageRegionRange< TImage >::end().

Referenced by itk::ImageRegionRange< TImage >::crbegin().

◆ rend()

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

Returns a reverse 'end iterator' for this range.

Definition at line 424 of file itkImageRegionRange.h.

References itk::ImageRegionRange< TImage >::begin().

Referenced by itk::ImageRegionRange< TImage >::crend().

◆ size()

template<typename TImage >
vcl_size_t itk::ImageRegionRange< TImage >::size ( ) const
inlinenoexcept

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

Definition at line 447 of file itkImageRegionRange.h.

References itk::ImageRegionRange< TImage >::m_IterationRegionSize.

Member Data Documentation

◆ ImageDimension

template<typename TImage >
constexpr ImageDimensionType itk::ImageRegionRange< TImage >::ImageDimension = TImage::ImageDimension
staticconstexprprivate

◆ IsImageTypeConst

template<typename TImage >
constexpr bool itk::ImageRegionRange< TImage >::IsImageTypeConst = std::is_const_v<TImage>
staticconstexprprivate

Definition at line 79 of file itkImageRegionRange.h.

◆ m_BufferBegin

template<typename TImage >
BufferIteratorType itk::ImageRegionRange< TImage >::m_BufferBegin {}
private

◆ m_BufferedRegionIndex

template<typename TImage >
IndexType itk::ImageRegionRange< TImage >::m_BufferedRegionIndex { {} }
private

◆ m_IterationRegionIndex

template<typename TImage >
IndexType itk::ImageRegionRange< TImage >::m_IterationRegionIndex { {} }
private

◆ m_IterationRegionSize

template<typename TImage >
SizeType itk::ImageRegionRange< TImage >::m_IterationRegionSize { {} }
private

◆ m_OffsetTable

template<typename TImage >
OffsetTableType itk::ImageRegionRange< TImage >::m_OffsetTable { {} }
private

The documentation for this class was generated from the following file:
itk::ImageRegionRange::ImageRegionRange
ImageRegionRange() noexcept=default