|
ITK
6.0.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>
85 std::is_same_v<PixelType, InternalPixelType> &&
86 std::is_same_v<typename TImage::AccessorType, DefaultPixelAccessor<PixelType>> &&
87 std::is_same_v<AccessorFunctorType, DefaultPixelAccessorFunctor<std::remove_const_t<TImage>>>;
96 std::conditional_t<SupportsDirectPixelAccess, EmptyAccessorFunctor, AccessorFunctorType>;
105 template <
bool VIsConst,
typename TDummy =
void>
111 template <
typename TDummy>
133 : m_InternalPixel{ internalPixel }
134 , m_AccessorFunctor(accessorFunctor)
139 : m_InternalPixel{ pixelProxy.m_InternalPixel }
140 , m_AccessorFunctor{ pixelProxy.m_AccessorFunctor }
144 operator PixelType() const noexcept {
return m_AccessorFunctor.Get(m_InternalPixel); }
150 template <
typename TDummy>
174 : m_InternalPixel{ internalPixel }
175 , m_AccessorFunctor(accessorFunctor)
179 operator PixelType() const noexcept {
return m_AccessorFunctor.Get(m_InternalPixel); }
185 m_AccessorFunctor.Set(m_InternalPixel, pixelValue);
204 const auto lhsPixelValue = lhs.m_AccessorFunctor.Get(lhs.m_InternalPixel);
205 const auto rhsPixelValue = rhs.m_AccessorFunctor.Get(rhs.m_InternalPixel);
208 lhs.m_AccessorFunctor.Set(lhs.m_InternalPixel, rhsPixelValue);
209 rhs.m_AccessorFunctor.Set(rhs.m_InternalPixel, lhsPixelValue);
226 template <
bool VIsConst>
294 using reference = std::conditional_t<SupportsDirectPixelAccess, QualifiedPixelType &, PixelProxy<IsImageTypeConst>>;
310 template <
bool VIsArgumentConst,
typename = std::enable_if_t<VIsConst && !VIsArgumentConst>>
326 using PixelWrapper = std::conditional_t<SupportsDirectPixelAccess, PixelReferenceWrapper, reference>;
384 return lhs.m_InternalPixelPointer == rhs.m_InternalPixelPointer;
393 return !(lhs == rhs);
401 return lhs.m_InternalPixelPointer < rhs.m_InternalPixelPointer;
454 return lhs.m_InternalPixelPointer - rhs.m_InternalPixelPointer;
510 result.SetPixelAccessor(
m_Image.GetPixelAccessor());
511 result.SetBegin(
m_Image.TImage::GetBufferPointer());
533 template <
bool VIsConst>
556 using const_iterator = std::conditional_t<UsingPointerAsIterator, const InternalPixelType *, QualifiedIterator<true>>;
558 std::conditional_t<UsingPointerAsIterator, QualifiedInternalPixelType *, QualifiedIterator<IsImageTypeConst>>;
606 return this->
begin();
668 assert(n < this->
size());
669 assert(n <= static_cast<size_t>(std::numeric_limits<ptrdiff_t>::max()));
672 return this->
begin()[static_cast<ptrdiff_t>(n)];
678 template <
typename TImage>
686 template <
typename TImage>
687 ImageBufferRange<TImage>
690 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
QualifiedIterator(const QualifiedIterator< VIsArgumentConst > &arg) noexcept
IteratorInitializer(OptionalAccessorFunctorType optionalAccessorFunctor, QualifiedInternalPixelType *internalPixelPointer) noexcept
reverse_iterator rend() const noexcept
typename TImage::InternalPixelType InternalPixelType
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
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< VIsConst, const TImage, TImage > QualifiedImageType
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
AccessorFunctorInitializer(TImage &image) noexcept
friend difference_type operator-(const QualifiedIterator &lhs, const QualifiedIterator &rhs) noexcept
ImageBufferRange(TImage &image)
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
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
const_reverse_iterator crbegin() const noexcept
ImageBufferRange(TImage &) -> ImageBufferRange< TImage >
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
unsigned long SizeValueType
friend QualifiedIterator operator+(const difference_type n, QualifiedIterator it) noexcept
OptionalAccessorFunctorType m_OptionalAccessorFunctor