1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
6 #ifndef __fpa__Image__Dijkstra__h__
7 #define __fpa__Image__Dijkstra__h__
9 #include <fpa/Base/Dijkstra.h>
10 #include <fpa/Base/SeedsInterface.h>
11 #include <fpa/Image/MarksInterface.h>
12 #include <fpa/Image/Filter.h>
13 #include <fpa/Image/MinimumSpanningTree.h>
14 #include <fpa/Image/Functors/VertexParentBase.h>
15 #include <fpa/Image/Functors/VertexIdentity.h>
23 template< class _TInputImage, class _TOutputImage >
25 : public fpa::Base::Dijkstra< fpa::Image::Filter< _TInputImage, _TOutputImage >, fpa::Image::MarksInterface< _TInputImage::ImageDimension >, fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare >, fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > >
29 typedef fpa::Image::Filter< _TInputImage, _TOutputImage > TFilter;
30 typedef fpa::Image::MarksInterface< _TInputImage::ImageDimension > TMarksInterface;
31 typedef fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare > TSeedsInterface;
32 typedef fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > TMST;
35 typedef Dijkstra Self;
36 typedef fpa::Base::Dijkstra< TFilter, TMarksInterface, TSeedsInterface, TMST > Superclass;
37 typedef itk::SmartPointer< Self > Pointer;
38 typedef itk::SmartPointer< const Self > ConstPointer;
40 typedef typename TFilter::TInputImage TInputImage;
41 typedef typename TFilter::TOutputValue TOutputValue;
42 typedef typename TFilter::TVertex TVertex;
46 itkTypeMacro( fpa::Image::Dijkstra, fpa::Base::Dijkstra );
53 fpa::Image::Functors::
54 VertexIdentity< _TInputImage, typename TFilter::TOutputValue >::
58 virtual ~Dijkstra( ) { }
60 virtual void _ConfigureOutputs( const TOutputValue& init_value ) override
62 this->Superclass::_ConfigureOutputs( init_value );
64 typename TVertex::OffsetType o;
66 const TInputImage* input = this->GetInput( );
67 TMST* mst = this->GetMinimumSpanningTree( );
68 mst->CopyInformation( input );
69 mst->SetBufferedRegion( input->GetRequestedRegion( ) );
74 virtual void GenerateData( ) override
76 // Configure functors with input image
77 typedef typename TFilter::TOutputValue _TOutputValue;
78 typedef fpa::Image::Functors::VertexParentBase< _TInputImage, _TOutputValue > _TVFunc;
80 dynamic_cast< _TVFunc* >( this->m_VertexFunctor.GetPointer( ) );
82 vfunc->SetImage( this->GetInput( ) );
85 this->Superclass::GenerateData( );
89 Dijkstra( const Self& other );
90 Self& operator=( const Self& other );
97 #endif // __fpa__Image__Dijkstra__h__