Orfeo Toolbox  3.16
itkNeighborhoodOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkNeighborhoodOperator.h,v $
5  Language: C++
6  Date: $Date: 2009-02-06 20:53:13 $
7  Version: $Revision: 1.29 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkNeighborhoodOperator_h
18 #define __itkNeighborhoodOperator_h
19 
20 #include "itkNeighborhood.h"
21 #include "itkExceptionObject.h"
22 #include "itkNumericTraits.h"
23 #include <vector>
24 
25 namespace itk {
62 template< class TPixel, unsigned int VDimension,
63  class TAllocator = NeighborhoodAllocator<TPixel> >
65  : public Neighborhood<TPixel, VDimension, TAllocator>
66 {
67 public:
71 
73  typedef typename Superclass::SizeType SizeType;
74 
76  typedef TPixel PixelType;
77 
80 
83  { m_Direction = 0; }
84 
87  : Neighborhood<TPixel, VDimension, TAllocator>(orig)
88  { m_Direction = orig.m_Direction; }
89 
91  Self &operator=( const Self &orig )
92  {
93  Superclass::operator=(orig);
94  m_Direction = orig.m_Direction;
95  return *this;
96  }
97 
99  void SetDirection(const unsigned long &direction)
100  { m_Direction = direction; }
101 
103  unsigned long GetDirection() const
104  { return m_Direction; }
105 
110  virtual void CreateDirectional();
111 
116  virtual void CreateToRadius(const SizeType &);
117 
122  virtual void CreateToRadius(const unsigned long);
123 
126  virtual void FlipAxes();
127 
129  virtual void PrintSelf(std::ostream& os, Indent i) const
130  {
131  os << i << "NeighborhoodOperator { this=" << this
132  << " Direction = " << m_Direction << " }" << std::endl;
133  Superclass::PrintSelf( os, i.GetNextIndent() );
134  }
135 
136  typedef typename NumericTraits< TPixel >::RealType PixelRealType;
137 
139  void ScaleCoefficients( PixelRealType );
140 
141 protected:
144  typedef std::vector<double> CoefficientVector;
145 
148  virtual CoefficientVector GenerateCoefficients() = 0;
149 
152  virtual void Fill(const CoefficientVector &) = 0;
153 
159  virtual void FillCenteredDirectional(const CoefficientVector &);
160 
162  void InitializeToZero()
163  {
164  for (unsigned int i = 0; i< this->Size(); ++i)
165  {
166  this->operator[](i) = NumericTraits<PixelType>::Zero;
167  }
168  }
169 
170 private:
172  unsigned long m_Direction;
173 };
174 
175 } // namespace itk
176 
177 // Define instantiation macro for this template.
178 #define ITK_TEMPLATE_NeighborhoodOperator(_, EXPORT, x, y) namespace itk { \
179  _(2(class EXPORT NeighborhoodOperator< ITK_TEMPLATE_2 x >)) \
180  namespace Templates { typedef NeighborhoodOperator< ITK_TEMPLATE_2 x > \
181  NeighborhoodOperator##y; } \
182  }
183 
184 #if ITK_TEMPLATE_EXPLICIT
185 # include "Templates/itkNeighborhoodOperator+-.h"
186 #endif
187 
188 #if ITK_TEMPLATE_TXX
189 # include "itkNeighborhoodOperator.txx"
190 #endif
191 
192 /*
193 #ifndef ITK_MANUAL_INSTANTIATION
194 #include "itkNeighborhoodOperator.txx"
195 #endif
196 */
197 #endif

Generated at Sat Feb 2 2013 23:56:14 for Orfeo Toolbox with doxygen 1.8.1.1