X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FDijkstraWithEndPointDetection.h;h=b32d68a2bbb5f8dc0cc6db563968a1321f8f654e;hb=f28d460c6d9ce93e55c073bd04dba8de16d55d3a;hp=ecf197d94be5acd803ab41196f4ef848f884e73e;hpb=6fcc9fc78c44fa789bf092e2897cb6b391259b42;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/DijkstraWithEndPointDetection.h b/lib/fpa/Image/DijkstraWithEndPointDetection.h index ecf197d..b32d68a 100644 --- a/lib/fpa/Image/DijkstraWithEndPointDetection.h +++ b/lib/fpa/Image/DijkstraWithEndPointDetection.h @@ -1,8 +1,11 @@ #ifndef __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__ #define __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__ +#include #include #include +#include +#include namespace fpa { @@ -22,14 +25,16 @@ namespace fpa typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; - typedef typename Superclass::TInputImage TInputImage; - typedef typename Superclass::TOutputImage TOutputImage; - typedef typename Superclass::TVertex TVertex; - typedef typename Superclass::TValue TValue; - typedef typename Superclass::TResult TResult; - typedef typename Superclass::TCostFunction TCostFunction; - typedef typename Superclass::TConversionFunction TConversionFunction; - typedef typename Superclass::_TVertices TVertices; + typedef typename Superclass::TInputImage TInputImage; + typedef typename Superclass::TOutputImage TOutputImage; + typedef typename Superclass::TVertex TVertex; + typedef typename Superclass::TVertexCompare TVertexCompare; + typedef typename Superclass::TValue TValue; + typedef typename Superclass::TResult TResult; + typedef typename Superclass::TMinimumSpanningTree TMinimumSpanningTree; + typedef typename Superclass::TCostFunction TCostFunction; + typedef typename Superclass::TConversionFunction TConversionFunction; + typedef typename Superclass::_TVertices TVertices; typedef typename Superclass::TStartEvent TStartEvent; typedef typename Superclass::TStartLoopEvent TStartLoopEvent; @@ -39,13 +44,19 @@ namespace fpa typedef typename Superclass::TFrontEvent TFrontEvent; typedef typename Superclass::TFreezeEvent TFreezeEvent; - typedef typename Superclass::TStartBacktrackingEvent TStartBacktrackingEvent; - typedef typename Superclass::TEndBacktrackingEvent TEndBacktrackingEvent; - typedef typename Superclass::TBacktrackingEvent TBacktrackingEvent; + typedef typename + Superclass::TStartBacktrackingEvent TStartBacktrackingEvent; + typedef typename + Superclass::TEndBacktrackingEvent TEndBacktrackingEvent; + typedef typename + Superclass::TBacktrackingEvent TBacktrackingEvent; typedef unsigned short TLabel; typedef itk::Image< TLabel, I::ImageDimension > TLabelImage; + typedef fpa::Base::UniqueValuesContainer< TVertex, TVertexCompare > TUniqueVertices; + typedef fpa::Base::MatrixValuesContainer< TVertex, TLabel, TVertexCompare > TBranches; + protected: typedef typename Superclass::_TVertices _TVertices; typedef typename Superclass::_TCollision _TCollision; @@ -65,15 +76,36 @@ namespace fpa itkNewMacro( Self ); itkTypeMacro( DijkstraWithEndPointDetection, Dijkstra ); - itkGetConstMacro( EndPoints, TVertices ); - itkGetConstMacro( BifurcationPoints, TVertices ); + itkBooleanMacro( CorrectSeeds ); + itkBooleanMacro( CorrectEndPoints ); + + itkGetConstMacro( CorrectSeeds, bool ); + itkGetConstMacro( CorrectEndPoints, bool ); + itkGetConstMacro( SafetyNeighborhoodSize, unsigned int ); + itkGetConstMacro( NumberOfBranches, unsigned long ); + itkSetMacro( CorrectSeeds, bool ); + itkSetMacro( CorrectEndPoints, bool ); + itkSetMacro( SafetyNeighborhoodSize, unsigned int ); + public: TLabelImage* GetLabelImage( ); const TLabelImage* GetLabelImage( ) const; void GraftLabelImage( itk::DataObject* obj ); + TUniqueVertices* GetEndPoints( ); + const TUniqueVertices* GetEndPoints( ) const; + void GraftEndPoints( itk::DataObject* obj ); + + TUniqueVertices* GetBifurcations( ); + const TUniqueVertices* GetBifurcations( ) const; + void GraftBifurcations( itk::DataObject* obj ); + + TBranches* GetBranches( ); + const TBranches* GetBranches( ) const; + void GraftBranches( itk::DataObject* obj ); + protected: DijkstraWithEndPointDetection( ); virtual ~DijkstraWithEndPointDetection( ); @@ -82,8 +114,17 @@ namespace fpa virtual void _AfterGenerateData( ); virtual void _SetResult( const TVertex& v, const _TNode& n ); + void _EndPointsAndBifurcations( ); + void _FindBranches( ); + void _LabelAll( ); + _TRegion _Region( const TVertex& c, const double& r ); + template< class _T > + TVertex _MaxInRegion( + const _T* image, const TVertex& v, const double& r + ); + private: // Purposely not implemented DijkstraWithEndPointDetection( const Self& other ); @@ -91,10 +132,15 @@ namespace fpa protected: unsigned int m_LabelImageIndex; + unsigned int m_BifurcationsIndex; + unsigned int m_EndPointsIndex; + unsigned int m_BranchesIndex; + + bool m_CorrectSeeds; + bool m_CorrectEndPoints; + unsigned int m_SafetyNeighborhoodSize; _TCandidates m_Candidates; - TVertices m_BifurcationPoints; - TVertices m_EndPoints; unsigned long m_NumberOfBranches; };