1 #ifndef __FPA__IMAGE__ALGORITHM__H__
2 #define __FPA__IMAGE__ALGORITHM__H__
5 #include <fpa/Image/MinimumSpanningTree.h>
12 * A generic front propagation algorithm were vertices are image pixels.
14 * @param I Input image type
15 * @param O Output image type
16 * @param A Base algorithm (RegionGrow, Dijkstra or FastMarching)
18 template< class I, class O, class A >
23 /// Standard class typdedefs
24 typedef Algorithm Self;
26 typedef itk::SmartPointer< Self > Pointer;
27 typedef itk::SmartPointer< const Self > ConstPointer;
29 /// Template input values
30 typedef I TInputImage;
31 typedef O TOutputImage;
33 typedef typename Superclass::TVertex TVertex;
34 typedef typename Superclass::TValue TValue;
35 typedef typename Superclass::TResult TResult;
38 typedef typename Superclass::_TVertices _TVertices;
39 typedef typename Superclass::_TCollision _TCollision;
40 typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
41 typedef typename Superclass::_TCollisions _TCollisions;
42 typedef typename Superclass::_TNode _TNode;
43 typedef typename Superclass::_TNodes _TNodes;
45 typedef fpa::Image::MinimumSpanningTree< TVertex, _TNode, _TCollisions, I::ImageDimension, Self::AliveLabel > _TMarks;
48 typedef _TMarks TMinimumSpanningTree;
51 itkTypeMacro( Algorithm, TAlgorithm );
54 itkGetConstMacro( NeighborhoodOrder, unsigned int );
55 itkSetMacro( NeighborhoodOrder, unsigned int );
58 TMinimumSpanningTree* GetMinimumSpanningTree( );
59 const TMinimumSpanningTree* GetMinimumSpanningTree( ) const;
60 void GraftMinimumSpanningTree( itk::DataObject* obj );
64 virtual ~Algorithm( );
66 virtual void _BeforeGenerateData( );
67 virtual void _AfterGenerateData( );
69 // Graph-related abstract methods
70 virtual unsigned long _NumberOfVertices( ) const;
71 virtual const TValue& _VertexValue( const TVertex& v ) const;
72 virtual double _Distance(
73 const TVertex& a, const TVertex& b
75 virtual bool _HasEdge( const TVertex& a, const TVertex& b ) const;
76 virtual void _Neighborhood(
77 _TVertices& neighborhood, const TVertex& v
80 // Results-related abstract methods
81 virtual void _InitResults( );
82 virtual const TResult& _Result( const TVertex& v ) const;
83 virtual void _SetResult( const TVertex& v, const TResult& r );
85 // Marks-related abstract methods
86 virtual const _TNode& _Node( const TVertex& v ) const;
87 virtual void _InitMarks( );
88 virtual void _Mark( const _TNode& node );
91 // Purposely not implemented
92 Algorithm( const Self& other );
93 Self& operator=( const Self& other );
96 unsigned int m_NeighborhoodOrder;
103 #include <fpa/Image/Algorithm.hxx>
105 #endif // __FPA__IMAGE__ALGORITHM__H__