]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/SingleSeedInterface.h
807d8d0552cb557818446b85d7941be37fad782e
[FrontAlgorithms.git] / lib / fpa / Base / SingleSeedInterface.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Base__SingleSeedInterface__h__
7 #define __fpa__Base__SingleSeedInterface__h__
8
9 #include <fpa/Config.h>
10 #include <itkConceptChecking.h>
11 #include <itkProcessObject.h>
12
13 namespace fpa
14 {
15   namespace Base
16   {
17     /**
18      */
19     template< class _TTraits >
20     class SingleSeedInterface
21     {
22     public:
23       typedef SingleSeedInterface Self;
24       typedef _TTraits            TTraits;
25       fpa_Base_TraitTypes( typename TTraits );
26
27       /* TODO
28          typedef _TVertex       TVertex;
29          typedef _TPoint        TPoint;
30          typedef _TInputValue   TInputValue;
31          typedef _TOutputValue  TOutputValue;
32          typedef _TFrontId      TFrontId;
33          typedef _TCompare      TCompare;
34          typedef SeedsInterface Self;
35
36          struct TSeed
37          {
38          TVertex Vertex;
39          TPoint  Point;
40          bool    IsPoint;
41          bool    IsUnified;
42          TFrontId FrontId;
43          TSeed( )
44          : IsUnified( false ),
45          FrontId( TFrontId( 0 ) )
46          { }
47          };
48          typedef std::vector< TSeed > TSeeds;
49
50          struct TNode
51          {
52          TVertex  Vertex;
53          TVertex  Parent;
54          TFrontId FrontId;
55
56          // Hack to hide the fact that seed values need to be initialized
57          mutable TOutputValue Value;
58          };
59          struct TNodeCompare
60          {
61          bool operator()( const TNode& a, const TNode& b ) const
62          {
63          TCompare cmp;
64          return( cmp( a.Vertex, b.Vertex ) );
65          }
66          };
67          typedef std::set< TNode, TNodeCompare > TNodes;
68       */
69
70     private:
71       itkConceptMacro(
72         Check_TFrontId,
73         ( itk::Concept::IsUnsignedInteger< _TFrontId > )
74         );
75
76     public:
77       TSeeds& GetSeeds( );
78       const TSeeds& GetSeeds( ) const;
79
80       virtual void SetSeed( const TVertex& seed );
81       virtual void SetSeed( const TPoint& seed );
82
83     protected:
84       SingleSeedInterface( itk::ProcessObject* filter );
85       virtual ~SingleSeedInterface( );
86
87       virtual TNodes _UnifySeeds( ) = 0;
88       virtual void _PrepareSeeds( TNodes& nodes ) = 0;
89
90     protected:
91       TSeeds m_Seeds;
92       itk::ProcessObject* m_Filter;
93     };
94
95   } // ecapseman
96
97 } // ecapseman
98
99 #ifndef ITK_MANUAL_INSTANTIATION
100 #  include <fpa/Base/SingleSeedInterface.hxx>
101 #endif // ITK_MANUAL_INSTANTIATION
102
103 #endif // __fpa__Base__SingleSeedInterface__h__
104
105 // eof - $RCSfile$