18 #ifndef __itkNeighborhood_h
19 #define __itkNeighborhood_h
25 #include "vnl/vnl_vector.h"
53 template<
class TPixel,
unsigned int VDimension = 2,
54 class TAllocator = NeighborhoodAllocator< TPixel > >
65 itkStaticConstMacro(NeighborhoodDimension,
unsigned int, VDimension);
103 m_StrideTable[i] = 0;
115 Self & operator=(
const Self & other);
119 operator==(
const Self & other)
const
135 const SizeType GetRadius()
const
141 {
return m_Radius[n]; }
146 {
return m_Size[n]; }
149 SizeType GetSize()
const
156 {
return ( axis < VDimension ) ? m_StrideTable[axis] : 0; }
160 {
return m_DataBuffer.end(); }
162 {
return m_DataBuffer.begin(); }
164 {
return m_DataBuffer.end(); }
166 {
return m_DataBuffer.begin(); }
171 {
return m_DataBuffer.size(); }
175 {
return m_DataBuffer[i]; }
177 {
return m_DataBuffer[i]; }
179 {
return m_DataBuffer[i]; }
183 TPixel GetCenterValue()
const
184 {
return ( this->
operator[]( ( this->
Size() ) >> 1 ) ); }
188 void SetRadius(
const SizeType &);
208 void Print(std::ostream & os)
const
209 { this->PrintSelf( os,
Indent(0) ); }
213 {
return m_DataBuffer; }
215 {
return m_DataBuffer; }
220 {
return this->
operator[]( this->GetNeighborhoodIndex(o) ); }
222 {
return this->
operator[]( this->GetNeighborhoodIndex(o) ); }
228 {
return m_OffsetTable[i]; }
230 virtual NeighborIndexType GetNeighborhoodIndex(
const OffsetType &)
const;
237 std::slice GetSlice(
unsigned int)
const;
245 m_Size[i] = m_Radius[i] * 2 + 1;
252 { m_DataBuffer.set_size(i); }
255 virtual void PrintSelf(std::ostream &,
Indent)
const;
258 virtual void ComputeNeighborhoodStrideTable();
262 virtual void ComputeNeighborhoodOffsetTable();
284 template<
class TPixel,
unsigned int VDimension,
class TContainer >
285 std::ostream & operator<<(std::ostream & os, const Neighborhood< TPixel, VDimension, TContainer > & neighborhood)
287 os <<
"Neighborhood:" << std::endl;
288 os <<
" Radius:" << neighborhood.GetRadius() << std::endl;
289 os <<
" Size:" << neighborhood.GetSize() << std::endl;
290 os <<
" DataBuffer:" << neighborhood.GetBufferReference() << std::endl;
296 #ifndef ITK_MANUAL_INSTANTIATION
297 #include "itkNeighborhood.hxx"