+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
#ifndef __fpa__Image__Dijkstra__hxx__
#define __fpa__Image__Dijkstra__hxx__
-#include <fpa/Image/Functors/VertexCost.h>
-
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
+template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits >
+fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >::
Dijkstra( )
: Superclass( )
{
- typedef fpa::Image::Functors::VertexCost< _TInputImage, TOutput > _TCost;
- typename _TCost::Pointer cost = _TCost::New( );
- this->SetVertexFunction( cost );
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
+template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits >
+fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >::
~Dijkstra( )
{
}
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits >
+void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >::
+_BeforeGenerateData( )
+{
+ this->Superclass::_BeforeGenerateData( );
+ TWeightFunction* wf =
+ dynamic_cast< TWeightFunction* >( this->GetWeightFunction( ) );
+ if( wf != NULL )
+ wf->SetImage( this->GetInput( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits >
+void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >::
+_ConfigureOutput( const TOutputValue& v )
+{
+ this->Superclass::_ConfigureOutput( v );
+
+ const TInputImage* in = this->GetInput( );
+ TMST* mst = this->GetMinimumSpanningTree( );
+ mst->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
+ mst->SetRequestedRegion( in->GetRequestedRegion( ) );
+ mst->SetBufferedRegion( in->GetBufferedRegion( ) );
+ mst->SetSpacing( in->GetSpacing( ) );
+ mst->SetOrigin( in->GetOrigin( ) );
+ mst->SetDirection( in->GetDirection( ) );
+ mst->Allocate( );
+
+ typename TVertex::OffsetType o;
+ o.Fill( 0 );
+ mst->FillBuffer( o );
+}
+
#endif // __fpa__Image__Dijkstra__hxx__
// eof - $RCSfile$