Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkNeighborhoodOperator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkNeighborhoodOperator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/02/07 13:58:41 $
00007   Version:   $Revision: 1.28 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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     }
00098 
00100   void SetDirection(const unsigned long &direction)
00101     {  m_Direction = direction;   }
00102 
00104   unsigned long GetDirection() const
00105     {  return m_Direction;  }
00106 
00111   virtual void CreateDirectional();
00112 
00117   virtual void CreateToRadius(const SizeType &);
00118 
00123   virtual void CreateToRadius(const unsigned long);
00124 
00127   virtual void FlipAxes();
00128 
00130   virtual void PrintSelf(std::ostream& os, Indent i) const
00131     {
00132       os << i << "NeighborhoodOperator { this=" << this
00133          << " Direction = " << m_Direction << " }" << std::endl;
00134       Superclass::PrintSelf( os, i.GetNextIndent() );
00135     }
00137 
00138   typedef typename NumericTraits< TPixel >::RealType  PixelRealType;
00139 
00141   void ScaleCoefficients( PixelRealType );
00142 
00143 protected:
00146   typedef std::vector<double>  CoefficientVector;
00147 
00150   virtual CoefficientVector GenerateCoefficients() = 0;
00151 
00154   virtual void Fill(const CoefficientVector &) = 0;
00155 
00161   virtual void FillCenteredDirectional(const CoefficientVector &);
00162 
00164   void InitializeToZero()
00165   {
00166     for (unsigned int i = 0; i< this->Size(); ++i)
00167       { this->operator[](i) = NumericTraits<PixelType>::Zero; }
00168   }
00170 
00171 private:
00173   unsigned long  m_Direction;
00174 };
00175 
00176 } // namespace itk
00177 
00178 // Define instantiation macro for this template.
00179 #define ITK_TEMPLATE_NeighborhoodOperator(_, EXPORT, x, y) namespace itk { \
00180   _(2(class EXPORT NeighborhoodOperator< ITK_TEMPLATE_2 x >)) \
00181   namespace Templates { typedef NeighborhoodOperator< ITK_TEMPLATE_2 x > \
00182                                                   NeighborhoodOperator##y; } \
00183   }
00184 
00185 #if ITK_TEMPLATE_EXPLICIT
00186 # include "Templates/itkNeighborhoodOperator+-.h"
00187 #endif
00188 
00189 #if ITK_TEMPLATE_TXX
00190 # include "itkNeighborhoodOperator.txx"
00191 #endif
00192 
00193 /*
00194 #ifndef ITK_MANUAL_INSTANTIATION
00195 #include "itkNeighborhoodOperator.txx"
00196 #endif
00197 */
00198 #endif
00199 
00200 

Generated at Tue Jul 29 21:30:49 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000