18 #ifndef itkNeighborhood_h
19 #define itkNeighborhood_h
25 #include "vnl/vnl_vector.h"
53 template<
typename TPixel,
unsigned int VDimension = 2,
54 typename TAllocator = NeighborhoodAllocator< TPixel > >
65 static constexpr
unsigned int NeighborhoodDimension = VDimension;
106 m_StrideTable[i] = 0;
121 Self & operator=(
const Self & other);
124 Self & operator=(Self&&) =
default;
150 {
return m_Radius[n]; }
155 {
return m_Size[n]; }
165 {
return ( axis < VDimension ) ? m_StrideTable[axis] : 0; }
169 {
return m_DataBuffer.end(); }
171 {
return m_DataBuffer.begin(); }
173 {
return m_DataBuffer.end(); }
175 {
return m_DataBuffer.begin(); }
180 {
return m_DataBuffer.size(); }
184 {
return m_DataBuffer[i]; }
186 {
return m_DataBuffer[i]; }
188 {
return m_DataBuffer[i]; }
193 {
return ( this->
operator[]( ( this->
Size() ) >> 1 ) ); }
218 { this->PrintSelf( os,
Indent(0) ); }
222 {
return m_DataBuffer; }
224 {
return m_DataBuffer; }
229 {
return this->operator[]( this->GetNeighborhoodIndex(o) ); }
231 {
return this->operator[]( this->GetNeighborhoodIndex(o) ); }
237 {
return m_OffsetTable[i]; }
239 virtual NeighborIndexType GetNeighborhoodIndex(
const OffsetType &)
const;
246 std::slice GetSlice(
unsigned int)
const;
254 m_Size[i] = m_Radius[i] * 2 + 1;
261 { m_DataBuffer.set_size(i); }
264 virtual void PrintSelf(std::ostream &,
Indent)
const;
267 virtual void ComputeNeighborhoodStrideTable();
271 virtual void ComputeNeighborhoodOffsetTable();
293 template<
typename TPixel,
unsigned int VDimension,
typename TContainer >
294 std::ostream & operator<<(std::ostream & os, const Neighborhood< TPixel, VDimension, TContainer > & neighborhood)
296 os <<
"Neighborhood:" << std::endl;
297 os <<
" Radius:" << neighborhood.GetRadius() << std::endl;
298 os <<
" Size:" << neighborhood.GetSize() << std::endl;
299 os <<
" DataBuffer:" << neighborhood.GetBufferReference() << std::endl;
305 #ifndef ITK_MANUAL_INSTANTIATION
306 #include "itkNeighborhood.hxx"
typename SizeType::SizeValueType SizeValueType
ConstIterator Begin() const
unsigned long SizeValueType
A light-weight container object for storing an N-dimensional neighborhood of values.
SizeValueType m_InternalArray[VDimension]
TPixel & operator[](NeighborIndexType i)
SizeValueType NeighborIndexType
typename AllocatorType::iterator Iterator
OffsetValueType GetStride(DimensionValueType axis) const
SizeValueType GetSize(DimensionValueType n) const
const AllocatorType & GetBufferReference() const
virtual void Allocate(NeighborIndexType i)
typename AllocatorType::const_iterator ConstIterator
NeighborIndexType Size() const
const char * const_iterator
OffsetType GetOffset(NeighborIndexType i) const
TPixel & GetElement(NeighborIndexType i)
ImageBaseType::SizeType SizeType
const SizeType GetRadius() const
Represent a n-dimensional size (bounds) of a n-dimensional image.
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image...
bool operator==(const Self &other) const
A flexible iterator for itk containers(i.e. itk::Neighborhood) that support pixel access through oper...
const TPixel & operator[](const OffsetType &o) const
TPixel GetCenterValue() const
const TPixel & operator[](NeighborIndexType i) const
AllocatorType m_DataBuffer
void SetRadius(const SizeValueType *rad)
NeighborIndexType GetCenterNeighborhoodIndex() const
Control indentation during Print() invocation.
unsigned int DimensionValueType
bool operator!=(const Self &other) const
std::vector< OffsetType > m_OffsetTable
SizeValueType GetRadius(DimensionValueType n) const
void Print(std::ostream &os) const
signed long OffsetValueType
ConstIterator End() const
TPixel & operator[](const OffsetType &o)
AllocatorType & GetBufferReference()