#include <itkShapedImageNeighborhoodRange.h>
Modern C++11 range to iterate over a neighborhood of pixels. 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 creates a 3 x 5 neighborhood around pixel [10, 20] and adds 42 to each neighborhood pixel, using a range-based for loop:
The following example prints the values of the neighborhood pixels:
The inner product of the neighborhood with a kernel can be produced with std::inner_product (from the Standard C++ header "numeric"), as follows:
Definition at line 92 of file itkShapedImageNeighborhoodRange.h.
Classes | |
class | CheckPolicy |
struct | EmptyPixelAccessParameter |
struct | OptionalPixelAccessParameter |
struct | OptionalPixelAccessParameter< TPolicy, false > |
class | PixelProxy |
class | PixelProxy< false, TDummy > |
class | PixelProxy< true, TDummy > |
class | QualifiedIterator |
struct | RegionData |
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 | |
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 |
reverse_iterator | rbegin () const noexcept |
reverse_iterator | rend () const noexcept |
ShapedImageNeighborhoodRange ()=default | |
vcl_size_t | size () const noexcept |
ShapedImageNeighborhoodRange (ImageType &image, const IndexType &location, const OffsetType *const shapeOffsets, const vcl_size_t numberOfNeigborhoodPixels, const OptionalPixelAccessParameterType optionalPixelAccessParameter={}) | |
template<typename TContainerOfOffsets> | |
ShapedImageNeighborhoodRange (ImageType &image, const IndexType &location, const TContainerOfOffsets &shapeOffsets, const OptionalPixelAccessParameterType optionalPixelAccessParameter={}) | |
QualifiedIterator< false >::reference | operator[] (const vcl_size_t n) const noexcept |
void | SetLocation (const IndexType &location) noexcept |
Private Types | |
using | ImageDimensionType = typename TImage::ImageDimensionType |
using | ImageRegionType = typename TImage::RegionType |
using | ImageSizeType = typename TImage::SizeType |
using | ImageSizeValueType = typename TImage::SizeValueType |
using | ImageType = TImage |
using | IndexType = typename TImage::IndexType |
using | IndexValueType = typename TImage::IndexValueType |
using | InternalPixelType = typename TImage::InternalPixelType |
using | NeighborhoodAccessorFunctorType = typename TImage::NeighborhoodAccessorFunctorType |
using | OffsetType = Offset<ImageDimension> |
using | OptionalPixelAccessParameterType |
using | PixelType = typename TImage::PixelType |
using | QualifiedInternalPixelType = std::conditional_t<IsImageTypeConst, const InternalPixelType, InternalPixelType> |
Private Member Functions | |
void | SubtractIndex (IndexType &index1, const IndexType &index2) |
Private Attributes | |
RegionData | m_BufferedRegionData {} |
QualifiedInternalPixelType * | m_ImageBufferPointer { nullptr } |
NeighborhoodAccessorFunctorType | m_NeighborhoodAccessor {} |
vcl_size_t | m_NumberOfNeighborhoodPixels { 0 } |
OffsetType | m_OffsetTable { {} } |
OptionalPixelAccessParameterType | m_OptionalPixelAccessParameter {} |
IndexType | m_RelativeLocation { {} } |
const OffsetType * | m_ShapeOffsets { nullptr } |
Static Private Attributes | |
static constexpr ImageDimensionType | ImageDimension = TImage::ImageDimension |
static constexpr bool | IsImageTypeConst = std::is_const_v<TImage> |
using itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::const_iterator = QualifiedIterator<true> |
Definition at line 646 of file itkShapedImageNeighborhoodRange.h.
using itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 649 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 139 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 142 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 140 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 141 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 138 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 147 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 148 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 144 of file itkShapedImageNeighborhoodRange.h.
using itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::iterator = QualifiedIterator<IsImageTypeConst> |
Definition at line 647 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 145 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 149 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 150 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 143 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 592 of file itkShapedImageNeighborhoodRange.h.
using itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::reverse_iterator = std::reverse_iterator<iterator> |
Definition at line 648 of file itkShapedImageNeighborhoodRange.h.
|
default |
Explicitly-defaulted default-constructor. Constructs an empty range.
|
inline |
Specifies a range for the neighborhood of a pixel at the specified location. The shape of the neighborhood is specified by a pointer to a contiguous sequence of offsets, relative to the location index.
Definition at line 665 of file itkShapedImageNeighborhoodRange.h.
|
inline |
Specifies a range for the neighborhood of a pixel at the specified location. The shape of the neighborhood is specified by a container of offsets, relative to the location index. This container of offsets must be a contiguous container, for example std::vector<OffsetType> or std::array<OffsetType>.
Definition at line 702 of file itkShapedImageNeighborhoodRange.h.
|
inlinenoexcept |
Returns an iterator to the first neighborhood pixel.
Definition at line 716 of file itkShapedImageNeighborhoodRange.h.
References m_BufferedRegionData, m_ImageBufferPointer, m_NeighborhoodAccessor, m_OffsetTable, m_OptionalPixelAccessParameter, m_RelativeLocation, and m_ShapeOffsets.
Referenced by cbegin(), operator[](), and rend().
|
inlinenoexcept |
Returns a const iterator to the first neighborhood pixel. Provides only read-only access to the pixel data.
Definition at line 738 of file itkShapedImageNeighborhoodRange.h.
References begin().
|
inlinenoexcept |
Returns a const 'end iterator' for this range.
Definition at line 745 of file itkShapedImageNeighborhoodRange.h.
References end().
|
inlinenoexcept |
Returns a const reverse 'begin iterator' for this range.
Definition at line 766 of file itkShapedImageNeighborhoodRange.h.
References rbegin().
|
inlinenoexcept |
Returns a const reverse 'end iterator' for this range.
Definition at line 773 of file itkShapedImageNeighborhoodRange.h.
References rend().
|
inlinenoexcept |
Tells whether the range is empty.
Definition at line 789 of file itkShapedImageNeighborhoodRange.h.
References m_NumberOfNeighborhoodPixels.
|
inlinenoexcept |
Returns an 'end iterator' for this range.
Definition at line 724 of file itkShapedImageNeighborhoodRange.h.
References m_BufferedRegionData, m_ImageBufferPointer, m_NeighborhoodAccessor, m_NumberOfNeighborhoodPixels, m_OffsetTable, m_OptionalPixelAccessParameter, m_RelativeLocation, and m_ShapeOffsets.
|
inlinenoexcept |
Subscript operator. Allows random access, to the nth neighbor pixel.
Definition at line 801 of file itkShapedImageNeighborhoodRange.h.
|
inlinenoexcept |
Returns a reverse 'begin iterator' for this range.
Definition at line 752 of file itkShapedImageNeighborhoodRange.h.
References end().
Referenced by crbegin().
|
inlinenoexcept |
Returns a reverse 'end iterator' for this range.
Definition at line 759 of file itkShapedImageNeighborhoodRange.h.
References begin().
Referenced by crend().
|
inlinenoexcept |
Sets the location of this neighborhood by specifying its pixel index. Typically, this is the index of the center pixel of the neighborhood.
Definition at line 815 of file itkShapedImageNeighborhoodRange.h.
References m_BufferedRegionData, m_RelativeLocation, and SubtractIndex().
|
inlinenoexcept |
Returns the size of the range, that is the number of neighborhood pixels.
Definition at line 781 of file itkShapedImageNeighborhoodRange.h.
References m_NumberOfNeighborhoodPixels.
Referenced by operator[]().
|
inlineprivate |
Definition at line 611 of file itkShapedImageNeighborhoodRange.h.
References ImageDimension.
Referenced by SetLocation().
|
staticconstexprprivate |
Definition at line 146 of file itkShapedImageNeighborhoodRange.h.
Referenced by SubtractIndex().
|
staticconstexprprivate |
Definition at line 590 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 625 of file itkShapedImageNeighborhoodRange.h.
Referenced by begin(), end(), and SetLocation().
|
private |
Definition at line 622 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 630 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 641 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 628 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 643 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 635 of file itkShapedImageNeighborhoodRange.h.
Referenced by begin(), end(), and SetLocation().
|
private |
Definition at line 638 of file itkShapedImageNeighborhoodRange.h.