00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNeighborhoodOperator_h
00018 #define __itkNeighborhoodOperator_h
00019
00020 #include "itkNeighborhood.h"
00021 #include "itkExceptionObject.h"
00022 #include "itkNumericTraits.h"
00023 #include <vector>
00024
00025 namespace itk {
00062 template< class TPixel, unsigned int VDimension,
00063 class TAllocator = NeighborhoodAllocator<TPixel> >
00064 class ITK_EXPORT NeighborhoodOperator
00065 : public Neighborhood<TPixel, VDimension, TAllocator>
00066 {
00067 public:
00069 typedef NeighborhoodOperator Self;
00070 typedef Neighborhood<TPixel, VDimension, TAllocator> Superclass;
00071
00073 typedef typename Superclass::SizeType SizeType;
00074
00076 typedef TPixel PixelType;
00077
00079 typedef SliceIterator<TPixel, Self> SliceIteratorType;
00080
00082 NeighborhoodOperator()
00083 { m_Direction = 0; }
00084
00086 NeighborhoodOperator(const Self &orig)
00087 : Neighborhood<TPixel, VDimension, TAllocator>(orig)
00088 { m_Direction = orig.m_Direction; }
00089
00091 Self &operator=( const Self &orig )
00092 {
00093 Superclass::operator=(orig);
00094 m_Direction = orig.m_Direction;
00095 return *this;
00096 }
00097
00099 void SetDirection(const unsigned long &direction)
00100 { m_Direction = direction; }
00101
00103 unsigned long GetDirection() const
00104 { return m_Direction; }
00105
00110 virtual void CreateDirectional();
00111
00116 virtual void CreateToRadius(const SizeType &);
00117
00122 virtual void CreateToRadius(const unsigned long);
00123
00126 virtual void FlipAxes();
00127
00129 virtual void PrintSelf(std::ostream& os, Indent i) const
00130 {
00131 os << i << "NeighborhoodOperator { this=" << this
00132 << " Direction = " << m_Direction << " }" << std::endl;
00133 Superclass::PrintSelf( os, i.GetNextIndent() );
00134 }
00135
00136 typedef typename NumericTraits< TPixel >::RealType PixelRealType;
00137
00139 void ScaleCoefficients( PixelRealType );
00140
00141 protected:
00144 typedef std::vector<double> CoefficientVector;
00145
00148 virtual CoefficientVector GenerateCoefficients() = 0;
00149
00152 virtual void Fill(const CoefficientVector &) = 0;
00153
00159 virtual void FillCenteredDirectional(const CoefficientVector &);
00160
00162 void InitializeToZero()
00163 {
00164 for (unsigned int i = 0; i< this->Size(); ++i)
00165 { this->operator[](i) = NumericTraits<PixelType>::Zero; }
00166 }
00167
00168 private:
00170 unsigned long m_Direction;
00171 };
00172
00173 }
00174
00175 #ifndef ITK_MANUAL_INSTANTIATION
00176 #include "itkNeighborhoodOperator.txx"
00177 #endif
00178
00179 #endif
00180