]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Dijkstra.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / Dijkstra.hxx
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Image__Dijkstra__hxx__
7 #define __fpa__Image__Dijkstra__hxx__
8
9 // -------------------------------------------------------------------------
10 template< class _TInputImage, class _TOutputImage, class _TFrontId >
11 fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >::
12 Dijkstra( )
13   : Superclass( )
14 {
15 }
16
17 // -------------------------------------------------------------------------
18 template< class _TInputImage, class _TOutputImage, class _TFrontId >
19 fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >::
20 ~Dijkstra( )
21 {
22 }
23
24 // -------------------------------------------------------------------------
25 template< class _TInputImage, class _TOutputImage, class _TFrontId >
26 void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >::
27 _BeforeGenerateData( )
28 {
29   this->Superclass::_BeforeGenerateData( );
30   TWeightFunction* wf =
31     dynamic_cast< TWeightFunction* >( this->GetWeightFunction( ) );
32   if( wf != NULL )
33     wf->SetImage( this->GetInput( ) );
34 }
35
36 // -------------------------------------------------------------------------
37 template< class _TInputImage, class _TOutputImage, class _TFrontId >
38 void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >::
39 _ConfigureOutput( const TOutputValue& v )
40 {
41   this->Superclass::_ConfigureOutput( v );
42
43   const TInputImage* in = this->GetInput( );
44   TMST* mst = this->GetMinimumSpanningTree( );
45   mst->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
46   mst->SetRequestedRegion( in->GetRequestedRegion( ) );
47   mst->SetBufferedRegion( in->GetBufferedRegion( ) );
48   mst->SetSpacing( in->GetSpacing( ) );
49   mst->SetOrigin( in->GetOrigin( ) );
50   mst->SetDirection( in->GetDirection( ) );
51   mst->Allocate( );
52
53   typename TVertex::OffsetType o;
54   o.Fill( 0 );
55   mst->FillBuffer( o );
56 }
57
58 #endif // __fpa__Image__Dijkstra__hxx__
59
60 // eof - $RCSfile$