18 #ifndef __itkNeighborhood_h
19 #define __itkNeighborhood_h
25 #include "vnl/vnl_vector.h"
55 template<
class TPixel,
unsigned int VDimension = 2,
56 class TAllocator = NeighborhoodAllocator< TPixel > >
67 itkStaticConstMacro(NeighborhoodDimension,
unsigned int, VDimension);
105 m_StrideTable[i] = 0;
117 Self & operator=(
const Self & other);
121 operator==(
const Self & other)
const
137 const SizeType GetRadius()
const
143 {
return m_Radius[n]; }
148 {
return m_Size[n]; }
151 SizeType GetSize()
const
158 {
return ( axis < VDimension ) ? m_StrideTable[axis] : 0; }
162 {
return m_DataBuffer.end(); }
164 {
return m_DataBuffer.begin(); }
166 {
return m_DataBuffer.end(); }
168 {
return m_DataBuffer.begin(); }
173 {
return m_DataBuffer.size(); }
177 {
return m_DataBuffer[i]; }
179 {
return m_DataBuffer[i]; }
181 {
return m_DataBuffer[i]; }
185 TPixel GetCenterValue()
const
186 {
return ( this->
operator[]( ( this->
Size() ) >> 1 ) ); }
190 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"