X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FSeedsInterface.h;h=e9c67c3306362f1af8883948445c342129c64654;hb=5c42def42121f822c3f6e482d0b4f193a95a8855;hp=a994125e3ef46445dd744a5257c0def6013dfe27;hpb=617f49bff4a6db5ed51b4f767c3634d1915fdced;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/SeedsInterface.h b/lib/fpa/Base/SeedsInterface.h index a994125..e9c67c3 100644 --- a/lib/fpa/Base/SeedsInterface.h +++ b/lib/fpa/Base/SeedsInterface.h @@ -6,23 +6,53 @@ #ifndef __fpa__Base__SeedsInterface__h__ #define __fpa__Base__SeedsInterface__h__ -#include +#include #include +#include +#include + namespace fpa { namespace Base { /** */ - template< class _TVertex, class _TCompare > + template< class _TVertex, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare = std::greater< _TVertex > > class SeedsInterface { public: - typedef _TVertex TVertex; - typedef _TCompare TCompare; + itkConceptMacro( + Check_TFrontId, + ( itk::Concept::IsUnsignedInteger< _TFrontId > ) + ); + + public: + typedef _TVertex TVertex; + typedef _TInputValue TInputValue; + typedef _TOutputValue TOutputValue; + typedef _TFrontId TFrontId; + typedef _TCompare TCompare; typedef SeedsInterface Self; - typedef std::set< TVertex, TCompare > TSeeds; + + struct TNode + { + TVertex Vertex; + TVertex Parent; + TFrontId FrontId; + + // Hack to hide the fact that seed values need to be initialized + mutable TOutputValue Value; + }; + struct TNodeCompare + { + bool operator()( const TNode& a, const TNode& b ) const + { + TCompare cmp; + return( cmp( a.Vertex, b.Vertex ) ); + } + }; + typedef std::set< TNode, TNodeCompare > TSeeds; public: unsigned int GetNumberOfSeeds( ) const; @@ -30,15 +60,15 @@ namespace fpa typename TSeeds::const_iterator BeginSeeds( ) const; typename TSeeds::const_iterator EndSeeds( ) const; - void AddSeed( const TVertex& seed ); - void RemoveSeed( const TVertex& seed ); - void ClearSeeds( ); + virtual void AddSeed( const TVertex& seed ); + virtual void RemoveSeed( const TVertex& seed ); + virtual void ClearSeeds( ); protected: SeedsInterface( itk::ProcessObject* filter ); virtual ~SeedsInterface( ); - private: + protected: TSeeds m_Seeds; itk::ProcessObject* m_Filter; };