|
ITK
5.3.0
Insight Toolkit
|
Go to the documentation of this file.
19 #ifndef itkShapedImageNeighborhoodRange_h
20 #define itkShapedImageNeighborhoodRange_h
27 #include <type_traits>
90 template <
typename TImage,
91 typename TImageNeighborhoodPixelAccessPolicy = ZeroFluxNeumannImageNeighborhoodPixelAccessPolicy<TImage>>
108 template <
typename T>
110 Test(
typename T::PixelAccessParameterType *);
112 template <
typename T>
119 !std::is_same<decltype(Test<TImageNeighborhoodPixelAccessPolicy>(
nullptr)),
120 decltype(Test<TImageNeighborhoodPixelAccessPolicy>())>::value;
124 template <
typename TPolicy,
bool VPolicyHasPixelAccessParameterType = CheckPolicy::HasPixelAccessParameterType>
127 using Type =
typename TPolicy::PixelAccessParameterType;
131 template <
typename TPolicy>
161 template <
bool VIsConst,
typename TDummy =
void>
167 template <
typename TDummy>
189 const TImageNeighborhoodPixelAccessPolicy & pixelAccessPolicy) noexcept
191 , m_PixelAccessPolicy{ pixelAccessPolicy }
197 , m_PixelAccessPolicy{ pixelProxy.m_PixelAccessPolicy }
207 template <
typename TDummy>
231 const TImageNeighborhoodPixelAccessPolicy & pixelAccessPolicy) noexcept
233 , m_PixelAccessPolicy{ pixelAccessPolicy }
262 const auto lhsPixelValue = lhs.m_PixelAccessPolicy.GetPixelValue(lhs.m_ImageBufferPointer);
263 const auto rhsPixelValue = rhs.m_PixelAccessPolicy.GetPixelValue(rhs.m_ImageBufferPointer);
266 lhs.m_PixelAccessPolicy.SetPixelValue(lhs.m_ImageBufferPointer, rhsPixelValue);
267 rhs.m_PixelAccessPolicy.SetPixelValue(rhs.m_ImageBufferPointer, lhsPixelValue);
284 template <
bool VIsConst>
352 return TImageNeighborhoodPixelAccessPolicy{
357 template <
typename TPixelAccessParameter>
358 TImageNeighborhoodPixelAccessPolicy
361 static_assert(std::is_same<TPixelAccessParameter, OptionalPixelAccessParameterType>::value,
362 "This helper function should only be used for OptionalPixelAccessParameterType!");
363 static_assert(!std::is_same<TPixelAccessParameter, EmptyPixelAccessParameter>::value,
364 "EmptyPixelAccessParameter indicates that there is no pixel access parameter specified!");
365 return TImageNeighborhoodPixelAccessPolicy{
468 assert(lhs.m_ImageBufferPointer == rhs.m_ImageBufferPointer);
469 assert(lhs.m_ImageSize == rhs.m_ImageSize);
470 assert(lhs.m_OffsetTable == rhs.m_OffsetTable);
473 return lhs.m_CurrentOffset == rhs.m_CurrentOffset;
482 return !(lhs == rhs);
490 assert(lhs.m_ImageBufferPointer == rhs.m_ImageBufferPointer);
491 assert(lhs.m_ImageSize == rhs.m_ImageSize);
492 assert(lhs.m_OffsetTable == rhs.m_OffsetTable);
495 return lhs.m_CurrentOffset < rhs.m_CurrentOffset;
548 assert(lhs.m_ImageBufferPointer == rhs.m_ImageBufferPointer);
549 assert(lhs.m_ImageSize == rhs.m_ImageSize);
550 assert(lhs.m_OffsetTable == rhs.m_OffsetTable);
553 return lhs.m_CurrentOffset - rhs.m_CurrentOffset;
604 :
m_Index(imageRegion.GetIndex())
605 ,
m_Size(imageRegion.GetSize())
615 index1[i] -= index2[i];
668 const size_t numberOfNeigborhoodPixels,
683 assert(offsetTable !=
nullptr);
701 template <
typename TContainerOfOffsets>
704 const TContainerOfOffsets & shapeOffsets,
710 optionalPixelAccessParameter }
740 return this->
begin();
802 assert(n < this->
size());
803 assert(n <= static_cast<size_t>(std::numeric_limits<ptrdiff_t>::max()));
806 return this->
begin()[static_cast<ptrdiff_t>(n)];
QualifiedIterator(QualifiedInternalPixelType *const imageBufferPointer, const ImageSizeType &imageSize, const OffsetType &offsetTable, const NeighborhoodAccessorFunctorType &neighborhoodAccessor, const OptionalPixelAccessParameterType optionalPixelAccessParameter, const IndexType &relativeLocation, const OffsetType *const offset) noexcept
const_iterator cend() const noexcept
QualifiedIterator< false >::reference operator[](const vcl_size_t n) const noexcept
RegionData m_BufferedRegionData
const_reverse_iterator crbegin() const noexcept
typename TImage::IndexValueType IndexValueType
PixelProxy(InternalPixelType *const imageBufferPointer, const TImageNeighborhoodPixelAccessPolicy &pixelAccessPolicy) noexcept
typename TImage::SizeType ImageSizeType
constexpr iterator begin()
static constexpr bool IsImageTypeConst
QualifiedIterator operator++(int) noexcept
const_reverse_iterator crend() const noexcept
QualifiedPixelType * pointer
PixelProxy & operator=(const PixelType &pixelValue) noexcept
std::conditional_t< IsImageTypeConst, const PixelType, PixelType > QualifiedPixelType
std::conditional_t< IsImageTypeConst, const InternalPixelType, InternalPixelType > QualifiedInternalPixelType
QualifiedIterator operator--(int) noexcept
iterator begin() const noexcept
IndexType m_RelativeLocation
friend bool operator==(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
typename TImage::RegionType ImageRegionType
QualifiedIterator< true > const_iterator
friend QualifiedIterator operator+(const difference_type n, QualifiedIterator it) noexcept
NeighborhoodAccessorFunctorType m_NeighborhoodAccessor
typename TImage::PixelType PixelType
friend bool operator!=(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
ImageBaseType::SizeType SizeType
void SetLocation(const IndexType &location) noexcept
InternalPixelType *const m_ImageBufferPointer
std::reverse_iterator< iterator > reverse_iterator
PixelProxy(const PixelProxy< false > &pixelProxy) noexcept
QualifiedIterator()=default
const_iterator cbegin() const noexcept
static int Test(typename T::PixelAccessParameterType *)
friend difference_type operator-(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
OptionalPixelAccessParameterType m_OptionalPixelAccessParameter
friend bool operator<(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
friend QualifiedIterator operator-(QualifiedIterator it, const difference_type n) noexcept
friend void swap(PixelProxy lhs, PixelProxy rhs) noexcept
QualifiedIterator & operator=(const QualifiedIterator &) noexcept=default
ImageBaseType::IndexType IndexType
const TImageNeighborhoodPixelAccessPolicy m_PixelAccessPolicy
static constexpr bool HasPixelAccessParameterType
IndexType m_RelativeLocation
const TImageNeighborhoodPixelAccessPolicy m_PixelAccessPolicy
OptionalPixelAccessParameterType m_OptionalPixelAccessParameter
reference operator*() const noexcept
PixelProxy & operator=(const PixelProxy &pixelProxy) noexcept
const InternalPixelType *const m_ImageBufferPointer
const OffsetType * m_ShapeOffsets
friend QualifiedIterator & operator+=(QualifiedIterator &it, const difference_type n) noexcept
friend bool operator>(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
typename TImage::NeighborhoodAccessorFunctorType NeighborhoodAccessorFunctorType
typename TImage::SizeValueType ImageSizeValueType
QualifiedInternalPixelType * m_ImageBufferPointer
static constexpr bool IsImageTypeConst
ImageBaseType::RegionType RegionType
QualifiedIterator(const QualifiedIterator< false > &arg) noexcept
QualifiedIterator & operator--() noexcept
ptrdiff_t difference_type
RegionData() noexcept=default
vcl_size_t size() const noexcept
friend bool operator<=(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
reverse_iterator rend() const noexcept
QualifiedIterator & operator++() noexcept
QualifiedInternalPixelType * m_ImageBufferPointer
std::reverse_iterator< const_iterator > const_reverse_iterator
ImageSizeType m_ImageSize
void SubtractIndex(IndexType &index1, const IndexType &index2)
std::conditional_t< IsImageTypeConst, const InternalPixelType, InternalPixelType > QualifiedInternalPixelType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
friend bool operator>=(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
QualifiedIterator< IsImageTypeConst > iterator
friend QualifiedIterator & operator-=(QualifiedIterator &it, const difference_type n) noexcept
ShapedImageNeighborhoodRange(ImageType &image, const IndexType &location, const TContainerOfOffsets &shapeOffsets, const OptionalPixelAccessParameterType optionalPixelAccessParameter={})
bool empty() const noexcept
ShapedImageNeighborhoodRange()=default
typename OptionalPixelAccessParameter< TImageNeighborhoodPixelAccessPolicy >::Type OptionalPixelAccessParameterType
TImageNeighborhoodPixelAccessPolicy CreatePixelAccessPolicy(EmptyPixelAccessParameter) const
TImageNeighborhoodPixelAccessPolicy CreatePixelAccessPolicy(const TPixelAccessParameter pixelAccessParameter) const
std::random_access_iterator_tag iterator_category
NeighborhoodAccessorFunctorType m_NeighborhoodAccessor
typename TImage::ImageDimensionType ImageDimensionType
typename TImage::IndexType IndexType
reverse_iterator rbegin() const noexcept
iterator end() const noexcept
reference operator[](const difference_type n) const noexcept
PixelProxy(const InternalPixelType *const imageBufferPointer, const TImageNeighborhoodPixelAccessPolicy &pixelAccessPolicy) noexcept
std::conditional_t< VIsConst, const ImageType, ImageType > QualifiedImageType
const OffsetType * m_CurrentOffset
vcl_size_t m_NumberOfNeighborhoodPixels
static constexpr ImageDimensionType ImageDimension
friend QualifiedIterator operator+(QualifiedIterator it, const difference_type n) noexcept
typename TImageNeighborhoodPixelAccessPolicy ::PixelAccessParameterType Type
typename TImage::InternalPixelType InternalPixelType
unsigned long SizeValueType
ShapedImageNeighborhoodRange(ImageType &image, const IndexType &location, const OffsetType *const shapeOffsets, const vcl_size_t numberOfNeigborhoodPixels, const OptionalPixelAccessParameterType optionalPixelAccessParameter={})