18#ifndef itkNeighborhood_h
19#define itkNeighborhood_h
25#include "vnl/vnl_vector.h"
53template <
typename TPixel,
unsigned int VDimension = 2,
typename TAllocator = NeighborhoodAllocator<TPixel>>
64 static constexpr unsigned int NeighborhoodDimension = VDimension;
75 using Iterator =
typename AllocatorType::iterator;
139 return m_Radius.at(n);
163 return (axis < VDimension) ? m_StrideTable[axis] : 0;
170 return m_DataBuffer.end();
175 return m_DataBuffer.begin();
180 return m_DataBuffer.end();
185 return m_DataBuffer.begin();
193 return m_DataBuffer.size();
202 return m_DataBuffer[i];
210 return (this->
operator[]((this->
Size()) >> 1));
239 this->PrintSelf(os,
Indent(0));
248 const AllocatorType &
265 return m_OffsetTable[i];
268 virtual NeighborIndexType
287 m_Size[i] = m_Radius[i] * 2 + 1;
296 m_DataBuffer.set_size(i);
329 std::vector<OffsetType> m_OffsetTable{};
332template <
typename TPixel,
unsigned int VDimension,
typename TContainer>
336 os <<
"Neighborhood: " << std::endl;
337 os <<
" Radius: " << neighborhood.
GetRadius() << std::endl;
338 os <<
" Size: " << neighborhood.
GetSize() << std::endl;
345#ifndef ITK_MANUAL_INSTANTIATION
346# include "itkNeighborhood.hxx"
Control indentation during Print() invocation.
A light-weight container object for storing an N-dimensional neighborhood of values.
typename AllocatorType::iterator Iterator
ConstIterator Begin() const
virtual void PrintSelf(std::ostream &, Indent) const
virtual void Allocate(NeighborIndexType i)
void SetRadius(const SizeValueType)
Neighborhood(Self &&)=default
virtual ~Neighborhood()=default
AllocatorType & GetBufferReference()
TPixel & operator[](const OffsetType &o)
Neighborhood(const Self &)=default
const TPixel & operator[](const OffsetType &o) const
TPixel GetCenterValue() const
TPixel & GetElement(NeighborIndexType i)
virtual void ComputeNeighborhoodOffsetTable()
OffsetType GetOffset(NeighborIndexType i) const
Self & operator=(Self &&)=default
virtual void ComputeNeighborhoodStrideTable()
void Print(std::ostream &os) const
SizeValueType GetSize(DimensionValueType n) const
virtual NeighborIndexType GetNeighborhoodIndex(const OffsetType &) const
unsigned int DimensionValueType
SizeValueType GetRadius(DimensionValueType n) const
const TPixel & operator[](NeighborIndexType i) const
NeighborIndexType GetCenterNeighborhoodIndex() const
const AllocatorType & GetBufferReference() const
void SetRadius(const SizeValueType *rad)
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Self)
void SetRadius(const SizeType &)
SizeValueType NeighborIndexType
typename AllocatorType::const_iterator ConstIterator
const SizeType GetRadius() const
TPixel & operator[](NeighborIndexType i)
NeighborIndexType Size() const
ConstIterator End() const
OffsetValueType GetStride(DimensionValueType axis) const
bool operator==(const Self &other) const
Self & operator=(const Self &)=default
typename SizeType::SizeValueType SizeValueType
AllocatorType m_DataBuffer
std::slice GetSlice(unsigned int) const
A flexible iterator for itk containers(i.e. itk::Neighborhood) that support pixel access through oper...
ImageBaseType::SizeType SizeType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
unsigned long SizeValueType
SizeValueType m_InternalArray[VDimension]