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: 2006/03/18 20:14:09 $
00007   Version:   $Revision: 1.9 $
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 __itkChainCodePath_h
00018 #define __itkChainCodePath_h
00019 
00020 #include "itkPath.h"
00021 #include "itkIndex.h"
00022 #include "itkOffset.h"
00023 
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   // Functions inherited from Path
00078   
00080   virtual OutputType Evaluate( const InputType & input ) const
00081     {
00082     return m_Chain[input];
00083     }
00084 
00086   virtual IndexType EvaluateToIndex( const InputType & input ) const;
00087 
00092   virtual OffsetType IncrementInput(InputType & input) const;
00093 
00095   virtual inline InputType EndOfInput() const
00096     {
00097     return NumberOfSteps();  // 0 is before the first step, 1 is after it
00098     }
00099 
00100 
00101 
00102   // Functions specific to ChainCodePath
00103 
00105   itkNewMacro( Self );
00106 
00108   itkSetMacro( Start, IndexType );
00109   itkGetConstReferenceMacro( Start, IndexType );
00111 
00113   virtual inline void InsertStep( InputType position, OffsetType step )
00114     {
00115     m_Chain.insert( m_Chain.begin()+position, step );
00116     this->Modified();
00117     }
00119 
00121   virtual inline void ChangeStep( InputType position, OffsetType step )
00122     {
00123     m_Chain[position]=step;
00124     this->Modified();
00125     }
00127 
00129   virtual inline void Clear()
00130     {
00131     m_Chain.clear();
00132     this->Modified();
00133     }
00135 
00137   virtual inline unsigned int NumberOfSteps() const
00138     {
00139     return m_Chain.size();
00140     }
00141 
00143   virtual void Initialize(void)
00144     {
00145     m_Start = this->GetZeroIndex();
00146     this->Clear();
00147     }
00149 
00150 protected:
00151   ChainCodePath();
00152   ~ChainCodePath() {}
00153   void PrintSelf(std::ostream& os, Indent indent) const;
00154 
00155 
00156 private:
00157   ChainCodePath(const Self&); //purposely not implemented
00158   void operator=(const Self&); //purposely not implemented
00159   
00160   IndexType     m_Start;            // origin image index for the path
00161   ChainCodeType m_Chain;            // the chain code (vector of offsets)
00162 };
00163 
00164 } // end namespace itk
00165 
00166 #ifndef ITK_MANUAL_INSTANTIATION
00167 #include "itkChainCodePath.txx"
00168 #endif
00169 
00170 #endif
00171 

Generated at Fri Sep 8 02:49:24 2006 for ITK by doxygen 1.4.7 written by Dimitri van Heesch, © 1997-2000