00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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();
00100 }
00101
00102
00103
00104
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 = m_ZeroIndex;
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&);
00157
void operator=(
const Self&);
00158
00159
IndexType m_Start;
00160
ChainCodeType m_Chain;
00161 };
00162
00163 }
00164
00165
#ifndef ITK_MANUAL_INSTANTIATION
00166
#include "itkChainCodePath.txx"
00167
#endif
00168
00169
#endif