ITK
6.0.0
Insight Toolkit
|
#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 = typename OptionalPixelAccessParameter< TImageNeighborhoodPixelAccessPolicy >::Type |
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 639 of file itkShapedImageNeighborhoodRange.h.
using itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 642 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 640 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 151 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 143 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 585 of file itkShapedImageNeighborhoodRange.h.
using itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::reverse_iterator = std::reverse_iterator<iterator> |
Definition at line 641 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 658 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 695 of file itkShapedImageNeighborhoodRange.h.
|
inlinenoexcept |
Returns an iterator to the first neighborhood pixel.
Definition at line 709 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_BufferedRegionData, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_ImageBufferPointer, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_NeighborhoodAccessor, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_OffsetTable, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_OptionalPixelAccessParameter, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_RelativeLocation, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_ShapeOffsets, and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::RegionData::m_Size.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::cbegin(), itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::operator[](), and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::rend().
|
inlinenoexcept |
Returns a const iterator to the first neighborhood pixel. Provides only read-only access to the pixel data.
Definition at line 731 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::begin().
|
inlinenoexcept |
Returns a const 'end iterator' for this range.
Definition at line 738 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::end().
|
inlinenoexcept |
Returns a const reverse 'begin iterator' for this range.
Definition at line 759 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::rbegin().
|
inlinenoexcept |
Returns a const reverse 'end iterator' for this range.
Definition at line 766 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::rend().
|
inlinenoexcept |
Tells whether the range is empty.
Definition at line 782 of file itkShapedImageNeighborhoodRange.h.
|
inlinenoexcept |
Returns an 'end iterator' for this range.
Definition at line 717 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_BufferedRegionData, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_ImageBufferPointer, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_NeighborhoodAccessor, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_NumberOfNeighborhoodPixels, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_OffsetTable, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_OptionalPixelAccessParameter, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_RelativeLocation, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_ShapeOffsets, and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::RegionData::m_Size.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::cend(), and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::rbegin().
|
inlinenoexcept |
Subscript operator. Allows random access, to the nth neighbor pixel.
Definition at line 793 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::begin(), and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::size().
|
inlinenoexcept |
Returns a reverse 'begin iterator' for this range.
Definition at line 745 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::end().
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::crbegin().
|
inlinenoexcept |
Returns a reverse 'end iterator' for this range.
Definition at line 752 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::begin().
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::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 807 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_BufferedRegionData, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::RegionData::m_Index, itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::m_RelativeLocation, and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::SubtractIndex().
|
inlinenoexcept |
Returns the size of the range, that is the number of neighborhood pixels.
Definition at line 774 of file itkShapedImageNeighborhoodRange.h.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::operator[]().
|
inlineprivate |
Definition at line 604 of file itkShapedImageNeighborhoodRange.h.
References itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::ImageDimension.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::SetLocation().
|
staticconstexprprivate |
Definition at line 146 of file itkShapedImageNeighborhoodRange.h.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::SubtractIndex().
|
staticconstexprprivate |
Definition at line 583 of file itkShapedImageNeighborhoodRange.h.
|
private |
Definition at line 618 of file itkShapedImageNeighborhoodRange.h.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::begin(), itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::end(), and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::SetLocation().
|
private |
Definition at line 615 of file itkShapedImageNeighborhoodRange.h.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::begin(), itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::end(), itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::PixelProxy< true, TDummy >::operator PixelType(), itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::PixelProxy< false, TDummy >::operator PixelType(), and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::PixelProxy< false, TDummy >::operator=().
|
private |
|
private |
Definition at line 634 of file itkShapedImageNeighborhoodRange.h.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::empty(), itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::end(), and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::size().
|
private |
|
private |
|
private |
Definition at line 628 of file itkShapedImageNeighborhoodRange.h.
Referenced by itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::begin(), itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::end(), and itk::ShapedImageNeighborhoodRange< TImage, TImageNeighborhoodPixelAccessPolicy >::SetLocation().
|
private |