]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Dijkstra.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / Dijkstra.hxx
index 1f21dc4335cddbe310c8fe5ef0e9d6ee65c1f9f2..f3c6a7216a47090a3fb10c23205422c91eb12f3c 100644 (file)
@@ -1,26 +1,60 @@
+// =========================================================================
+// @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$