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

itkChainCodePath.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkChainCodePath.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/12/04 19:58:30 $
00007   Version:   $Revision: 1.7 $
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 
00018 #ifndef _itkChainCodePath_h
00019 #define _itkChainCodePath_h
00020 
00021 #include "itkPath.h"
00022 #include "itkIndex.h"
00023 #include "itkOffset.h"
00024 #include <vector>
00025 
00026 namespace itk
00027 {
00028 
00029 
00048 template <unsigned int VDimension>
00049 class ITK_EXPORT ChainCodePath : public
00050 Path< unsigned int, Offset< VDimension >, VDimension >
00051 {
00052 public:
00054   itkStaticConstMacro(Dimension, unsigned int, VDimension);
00055 
00057   typedef ChainCodePath<VDimension>                               Self;
00058   typedef Path< unsigned int, Offset< VDimension >, VDimension >  Superclass;
00059 
00060   typedef SmartPointer<Self>  Pointer;
00061   typedef SmartPointer<const Self>  ConstPointer;
00062   
00064   itkTypeMacro(ChainCodePath, Path);
00065 
00066   
00068   typedef typename Superclass::OutputType   OutputType;
00069   typedef typename Superclass::InputType    InputType;
00070 
00072   typedef OutputType               OffsetType;
00073   typedef Index<VDimension>        IndexType;
00074 
00075   typedef std::vector<OffsetType>  ChainCodeType;
00076 
00077 
00078 
00079   // Functions inherited from Path
00080   
00082   virtual OutputType Evaluate( const InputType & input ) const
00083     {
00084     return m_Chain[input];
00085     }
00086   
00088   virtual IndexType EvaluateToIndex( const InputType & input ) const;
00089   
00094   virtual OffsetType IncrementInput(InputType & input) const;
00095 
00097   virtual inline InputType EndOfInput() const
00098     {
00099     return NumberOfSteps();  // 0 is before the first step, 1 is after it
00100     }
00101   
00102 
00103 
00104   // Functions specific to ChainCodePath
00105 
00107   itkNewMacro( Self );
00108   
00110   itkSetMacro( Start, IndexType );
00111   itkGetConstReferenceMacro( Start, IndexType );
00112   
00114   virtual inline void InsertStep( InputType position, OffsetType step )
00115     {
00116     m_Chain.insert( m_Chain.begin()+position, step );
00117     this->Modified();
00118     }
00119   
00121   virtual inline void ChangeStep( InputType position, OffsetType step )
00122     {
00123     m_Chain[position]=step;
00124     this->Modified();
00125     }
00126   
00128   virtual inline void Clear()
00129     {
00130     m_Chain.clear();
00131     this->Modified();
00132     }
00133   
00135   virtual inline unsigned int NumberOfSteps() const
00136     {
00137     return m_Chain.size();
00138     }
00139 
00141   virtual void Initialize(void)
00142     {
00143     m_Start = this->GetZeroIndex();
00144     this->Clear();
00145     }
00146 
00147 
00148 
00149 protected:
00150   ChainCodePath();
00151   ~ChainCodePath() {}
00152   void PrintSelf(std::ostream& os, Indent indent) const;
00153 
00154 
00155 private:
00156   ChainCodePath(const Self&); //purposely not implemented
00157   void operator=(const Self&); //purposely not implemented
00158   
00159   IndexType     m_Start;            // origin image index for the path
00160   ChainCodeType m_Chain;            // the chain code (vector of offsets)
00161 };
00162 
00163 } // namespace itk
00164 
00165 #ifndef ITK_MANUAL_INSTANTIATION
00166 #include "itkChainCodePath.txx"
00167 #endif
00168 
00169 #endif

Generated at Wed May 24 22:55:43 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000