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 itkStaticConstMacro(NeighborhoodDimension,
unsigned int, VDimension);
106 m_StrideTable[i] = 0;
118 Self & operator=(
const Self & other);
144 {
return m_Radius[n]; }
149 {
return m_Size[n]; }
159 {
return ( axis < VDimension ) ? m_StrideTable[axis] : 0; }
163 {
return m_DataBuffer.end(); }
165 {
return m_DataBuffer.begin(); }
167 {
return m_DataBuffer.end(); }
169 {
return m_DataBuffer.begin(); }
174 {
return m_DataBuffer.size(); }
178 {
return m_DataBuffer[i]; }
180 {
return m_DataBuffer[i]; }
182 {
return m_DataBuffer[i]; }
187 {
return ( this->
operator[]( ( this->
Size() ) >> 1 ) ); }
212 { this->PrintSelf( os,
Indent(0) ); }
216 {
return m_DataBuffer; }
218 {
return m_DataBuffer; }
223 {
return this->operator[]( this->GetNeighborhoodIndex(o) ); }
225 {
return this->operator[]( this->GetNeighborhoodIndex(o) ); }
231 {
return m_OffsetTable[i]; }
233 virtual NeighborIndexType GetNeighborhoodIndex(
const OffsetType &)
const;
240 std::slice GetSlice(
unsigned int)
const;
248 m_Size[i] = m_Radius[i] * 2 + 1;
255 { m_DataBuffer.set_size(i); }
258 virtual void PrintSelf(std::ostream &,
Indent)
const;
261 virtual void ComputeNeighborhoodStrideTable();
265 virtual void ComputeNeighborhoodOffsetTable();
287 template<
typename TPixel,
unsigned int VDimension,
typename TContainer >
288 std::ostream & operator<<(std::ostream & os, const Neighborhood< TPixel, VDimension, TContainer > & neighborhood)
290 os <<
"Neighborhood:" << std::endl;
291 os <<
" Radius:" << neighborhood.GetRadius() << std::endl;
292 os <<
" Size:" << neighborhood.GetSize() << std::endl;
293 os <<
" DataBuffer:" << neighborhood.GetBufferReference() << std::endl;
299 #ifndef ITK_MANUAL_INSTANTIATION
300 #include "itkNeighborhood.hxx"
typedef::itk::Size< VDimension > RadiusType
ConstIterator Begin() const
Represent the size (bounds) of a n-dimensional image.
signed long OffsetValueType
A light-weight container object for storing an N-dimensional neighborhood of values.
TPixel & operator[](NeighborIndexType i)
OffsetValueType GetStride(DimensionValueType axis) const
SizeValueType GetSize(DimensionValueType n) const
const AllocatorType & GetBufferReference() const
virtual void Allocate(NeighborIndexType i)
const char * const_iterator
unsigned long SizeValueType
unsigned int DimensionValueType
NeighborIndexType Size() const
OffsetType GetOffset(NeighborIndexType i) const
Offset< VDimension > OffsetType
TPixel & GetElement(NeighborIndexType i)
typedef::itk::Size< VDimension > SizeType
const SizeType GetRadius() const
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::iterator Iterator
AllocatorType m_DataBuffer
void SetRadius(const SizeValueType *rad)
NeighborIndexType GetCenterNeighborhoodIndex() const
Control indentation during Print() invocation.
AllocatorType::const_iterator ConstIterator
ImageBaseType::SizeType SizeType
bool operator!=(const Self &other) const
SizeType::SizeValueType SizeValueType
std::vector< OffsetType > m_OffsetTable
SizeValueType GetRadius(DimensionValueType n) const
void Print(std::ostream &os) const
ConstIterator End() const
TPixel & operator[](const OffsetType &o)
AllocatorType & GetBufferReference()
SliceIterator< TPixel, Self > SliceIteratorType
SizeValueType NeighborIndexType