|
ITK
5.3.0
Insight Toolkit
|
Go to the documentation of this file.
19 #ifndef itkImageBufferRange_h
20 #define itkImageBufferRange_h
26 #include <type_traits>
72 template <
typename TImage>
86 std::is_same<PixelType, InternalPixelType>::value &&
87 std::is_same<typename TImage::AccessorType, DefaultPixelAccessor<PixelType>>::value &&
88 std::is_same<AccessorFunctorType, DefaultPixelAccessorFunctor<std::remove_const_t<TImage>>>::value;
97 std::conditional_t<SupportsDirectPixelAccess, EmptyAccessorFunctor, AccessorFunctorType>;
106 template <
bool VIsConst,
typename TDummy =
void>
112 template <
typename TDummy>
134 : m_InternalPixel{ internalPixel }
135 , m_AccessorFunctor(accessorFunctor)
140 : m_InternalPixel{ pixelProxy.m_InternalPixel }
141 , m_AccessorFunctor{ pixelProxy.m_AccessorFunctor }
145 operator PixelType() const noexcept {
return m_AccessorFunctor.Get(m_InternalPixel); }
151 template <
typename TDummy>
175 : m_InternalPixel{ internalPixel }
176 , m_AccessorFunctor(accessorFunctor)
180 operator PixelType() const noexcept {
return m_AccessorFunctor.Get(m_InternalPixel); }
186 m_AccessorFunctor.Set(m_InternalPixel, pixelValue);
205 const auto lhsPixelValue = lhs.m_AccessorFunctor.Get(lhs.m_InternalPixel);
206 const auto rhsPixelValue = rhs.m_AccessorFunctor.Get(rhs.m_InternalPixel);
209 lhs.m_AccessorFunctor.Set(lhs.m_InternalPixel, rhsPixelValue);
210 rhs.m_AccessorFunctor.Set(rhs.m_InternalPixel, lhsPixelValue);
227 template <
bool VIsConst>
294 using reference = std::conditional_t<SupportsDirectPixelAccess, QualifiedPixelType &, PixelProxy<IsImageTypeConst>>;
327 using PixelWrapper = std::conditional_t<SupportsDirectPixelAccess, PixelReferenceWrapper, reference>;
385 return lhs.m_InternalPixelPointer == rhs.m_InternalPixelPointer;
394 return !(lhs == rhs);
402 return lhs.m_InternalPixelPointer < rhs.m_InternalPixelPointer;
455 return lhs.m_InternalPixelPointer - rhs.m_InternalPixelPointer;
511 result.SetPixelAccessor(
m_Image.GetPixelAccessor());
512 result.SetBegin(
m_Image.ImageType::GetBufferPointer());
534 template <
bool VIsConst>
557 using const_iterator = std::conditional_t<UsingPointerAsIterator, const InternalPixelType *, QualifiedIterator<true>>;
559 std::conditional_t<UsingPointerAsIterator, QualifiedInternalPixelType *, QualifiedIterator<IsImageTypeConst>>;
579 ,
m_NumberOfPixels{ image.ImageType::GetBufferedRegion().GetNumberOfPixels() }
606 return this->
begin();
667 assert(n < this->
size());
668 assert(n <= static_cast<size_t>(std::numeric_limits<ptrdiff_t>::max()));
671 return this->
begin()[static_cast<ptrdiff_t>(n)];
679 template <
typename TImage>
680 ImageBufferRange<TImage>
683 if (image ==
nullptr)
bool empty() const noexcept
PixelProxy(const InternalPixelType &internalPixel, const AccessorFunctorType &accessorFunctor) noexcept
QualifiedIterator()=default
vcl_size_t size() const noexcept
InternalPixelType & m_InternalPixel
QualifiedInternalPixelType * m_ImageBufferPointer
friend bool operator>(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
IteratorInitializer(OptionalAccessorFunctorType optionalAccessorFunctor, QualifiedInternalPixelType *internalPixelPointer) noexcept
reverse_iterator rend() const noexcept
typename TImage::InternalPixelType InternalPixelType
QualifiedIterator(const QualifiedIterator< false > &arg) noexcept
OptionalAccessorFunctorType m_OptionalAccessorFunctor
friend bool operator>=(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
const_reverse_iterator crend() const noexcept
reference operator[](const difference_type n) const noexcept
QualifiedIterator & operator=(const QualifiedIterator &) noexcept=default
friend QualifiedIterator operator+(QualifiedIterator it, const difference_type n) noexcept
SizeValueType m_NumberOfPixels
QualifiedInternalPixelType * m_InternalPixelPointer
PixelProxy(const PixelProxy< false > &pixelProxy) noexcept
QualifiedIterator(const OptionalAccessorFunctorType &accessorFunctor, QualifiedInternalPixelType *const internalPixelPointer) noexcept
QualifiedIterator & operator--() noexcept
std::conditional_t< SupportsDirectPixelAccess, EmptyAccessorFunctor, AccessorFunctorType > OptionalAccessorFunctorType
friend void swap(PixelProxy lhs, PixelProxy rhs) noexcept
std::conditional_t< UsingPointerAsIterator, const InternalPixelType *, QualifiedIterator< true > > const_iterator
friend QualifiedIterator operator-(QualifiedIterator it, const difference_type n) noexcept
typename TImage::PixelType PixelType
const AccessorFunctorType m_AccessorFunctor
static constexpr bool IsImageTypeConst
iterator end() const noexcept
PixelProxy & operator=(const PixelProxy &pixelProxy) noexcept
friend QualifiedIterator & operator+=(QualifiedIterator &it, const difference_type n) noexcept
OptionalAccessorFunctorType m_OptionalAccessorFunctor
ImageBufferRange< TImage > MakeImageBufferRange(TImage *const image)
QualifiedIterator operator++(int) noexcept
std::reverse_iterator< const_iterator > const_reverse_iterator
ptrdiff_t difference_type
QualifiedIterator< false >::reference operator[](const vcl_size_t n) const noexcept
friend bool operator<=(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
iterator begin() const noexcept
std::reverse_iterator< iterator > reverse_iterator
ImageBufferRange()=default
std::conditional_t< IsImageTypeConst, const InternalPixelType, InternalPixelType > QualifiedInternalPixelType
QualifiedInternalPixelType * m_InternalPixelPointer
friend QualifiedIterator & operator-=(QualifiedIterator &it, const difference_type n) noexcept
QualifiedPixelType * pointer
PixelProxy(InternalPixelType &internalPixel, const AccessorFunctorType &accessorFunctor) noexcept
friend bool operator<(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
static constexpr bool SupportsDirectPixelAccess
const AccessorFunctorType m_AccessorFunctor
std::conditional_t< IsImageTypeConst, const PixelType, PixelType > QualifiedPixelType
friend difference_type operator-(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
QualifiedIterator operator--(int) noexcept
std::conditional_t< IsImageTypeConst, const InternalPixelType, InternalPixelType > QualifiedInternalPixelType
static constexpr bool IsImageTypeConst
friend bool operator==(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
const_iterator cend() const noexcept
const InternalPixelType & m_InternalPixel
reverse_iterator rbegin() const noexcept
AccessorFunctorInitializer(ImageType &image) noexcept
QualifiedIterator & operator++() noexcept
std::conditional_t< SupportsDirectPixelAccess, QualifiedPixelType &, PixelProxy< IsImageTypeConst > > reference
reference operator*() const noexcept
static constexpr bool UsingPointerAsIterator
std::random_access_iterator_tag iterator_category
PixelReferenceWrapper(QualifiedPixelType &pixel, EmptyAccessorFunctor) noexcept
PixelProxy & operator=(const PixelType &pixelValue) noexcept
typename TImage::AccessorFunctorType AccessorFunctorType
std::conditional_t< VIsConst, const ImageType, ImageType > QualifiedImageType
const_reverse_iterator crbegin() const noexcept
const_iterator cbegin() const noexcept
friend bool operator!=(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
std::conditional_t< UsingPointerAsIterator, QualifiedInternalPixelType *, QualifiedIterator< IsImageTypeConst > > iterator
QualifiedPixelType & m_Pixel
ImageBufferRange(ImageType &image)
unsigned long SizeValueType
friend QualifiedIterator operator+(const difference_type n, QualifiedIterator it) noexcept
OptionalAccessorFunctorType m_OptionalAccessorFunctor