+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
#ifndef __fpa__Base__Dijkstra__h__
#define __fpa__Base__Dijkstra__h__
-#include <fpa/Base/PriorityQueueAlgorithm.h>
+#include <itkFunctionBase.h>
+#include <fpa/Base/MinimumSpanningTree.h>
+#include <fpa/Base/Functors/VertexParentBase.h>
namespace fpa
{
{
/**
*/
- template< class _TSuperclass, class _TMST >
+ template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
class Dijkstra
- : public fpa::Base::PriorityQueueAlgorithm< _TSuperclass >
+ : public _TFilter,
+ public _TMarksInterface,
+ public _TSeedsInterface
{
public:
- typedef Dijkstra Self;
- typedef fpa::Base::PriorityQueueAlgorithm< _TSuperclass > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- typedef _TMST TMST;
- typedef typename Superclass::TOutput TOutput;
- typedef typename Superclass::TVertex TVertex;
+ typedef Dijkstra Self;
+ typedef _TFilter Superclass;
+ typedef _TMarksInterface TMarksInterface;
+ typedef _TSeedsInterface TSeedsInterface;
+ typedef _TMST TMST;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef typename Superclass::TInputValue TInputValue;
+ typedef typename Superclass::TOutputValue TOutputValue;
+ typedef typename Superclass::TVertex TVertex;
+ typedef typename Superclass::TVertices TVertices;
+
+ typedef itk::FunctionBase< TInputValue, TOutputValue > TIntensityFunctor;
+ typedef fpa::Base::Functors::VertexParentBase< TVertex, TOutputValue > TVertexFunctor;
protected:
- typedef typename Superclass::_TQueueNode _TQueueNode;
+ struct _TNode
+ {
+ TVertex Vertex;
+ TVertex Parent;
+ TOutputValue Cost;
+ unsigned long FrontId;
+ _TNode( const TVertex& v, const TVertex& p, const unsigned long& fId )
+ {
+ this->Vertex = v;
+ this->Parent = p;
+ this->FrontId = fId;
+ this->Cost = TOutputValue( 0 );
+ }
+ bool operator<( const _TNode& b ) const
+ {
+ return( b.Cost < this->Cost );
+ }
+ };
public:
- itkTypeMacro( Dijkstra, Algorithm );
+ itkTypeMacro( Dijkstra, TFilter );
public:
- _TMST* GetMinimumSpanningTree( );
- const _TMST* GetMinimumSpanningTree( ) const;
+ TMST* GetMinimumSpanningTree( );
+ const TMST* GetMinimumSpanningTree( ) const;
+
+ const TIntensityFunctor* GetIntensityFunctor( ) const;
+ const TVertexFunctor* GetVertexFunctor( ) const;
+
+ void SetFunctor( TIntensityFunctor* functor );
+ void SetFunctor( TVertexFunctor* functor );
protected:
Dijkstra( );
virtual ~Dijkstra( );
- virtual void _AfterGenerateData( ) override;
-
- virtual void _UpdateResult( const _TQueueNode& n ) override;
- virtual bool _UpdateValue(
- _TQueueNode& v, const _TQueueNode& p
- ) override;
+ virtual void GenerateData( ) override;
private:
- // Purposely not defined
Dijkstra( const Self& other );
Self& operator=( const Self& other );
protected:
+ typename TIntensityFunctor::Pointer m_IntensityFunctor;
+ typename TVertexFunctor::Pointer m_VertexFunctor;
unsigned long m_MSTIndex;
};