]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Dijkstra.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / Dijkstra.hxx
diff --git a/lib/fpa/Image/Dijkstra.hxx b/lib/fpa/Image/Dijkstra.hxx
new file mode 100644 (file)
index 0000000..b0780de
--- /dev/null
@@ -0,0 +1,60 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__Dijkstra__hxx__
+#define __fpa__Image__Dijkstra__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TFrontId >
+fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >::
+Dijkstra( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TFrontId >
+fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >::
+~Dijkstra( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TFrontId >
+void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >::
+_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 >
+void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >::
+_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$