]> Creatis software - FrontAlgorithms.git/blob - appli/CTArteries/algorithms/DijkstraWithMeanAndVariance.hxx
...
[FrontAlgorithms.git] / appli / CTArteries / algorithms / DijkstraWithMeanAndVariance.hxx
1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4 #ifndef __DijkstraWithMeanAndVariance__hxx__
5 #define __DijkstraWithMeanAndVariance__hxx__
6
7 // -------------------------------------------------------------------------
8 template< class _TInput, class _TOutput >
9 double DijkstraWithMeanAndVariance< _TInput, _TOutput >::
10 GetMean( ) const
11 {
12   return( this->m_MeanAndVar.GetMean( ) );
13 }
14
15 // -------------------------------------------------------------------------
16 template< class _TInput, class _TOutput >
17 double DijkstraWithMeanAndVariance< _TInput, _TOutput >::
18 GetDeviation( ) const
19 {
20   return( this->m_MeanAndVar.GetDeviation( ) );
21 }
22
23 // -------------------------------------------------------------------------
24 template< class _TInput, class _TOutput >
25 double DijkstraWithMeanAndVariance< _TInput, _TOutput >::
26 GetVariance( ) const
27 {
28   return( this->m_MeanAndVar.GetVariance( ) );
29 }
30
31 // -------------------------------------------------------------------------
32 template< class _TInput, class _TOutput >
33 DijkstraWithMeanAndVariance< _TInput, _TOutput >::
34 DijkstraWithMeanAndVariance( )
35   : Superclass( )
36 {
37 }
38
39 // -------------------------------------------------------------------------
40 template< class _TInput, class _TOutput >
41 DijkstraWithMeanAndVariance< _TInput, _TOutput >::
42 ~DijkstraWithMeanAndVariance( )
43 {
44 }
45
46 // -------------------------------------------------------------------------
47 template< class _TInput, class _TOutput >
48 void DijkstraWithMeanAndVariance< _TInput, _TOutput >::
49 _BeforeGenerateData( )
50 {
51   this->Superclass::_BeforeGenerateData( );
52   this->m_MeanAndVar.Clear( );
53
54   typename _TInput::RegionType r = this->GetInput( )->GetRequestedRegion( );
55   this->m_MaxVertex = r.GetIndex( );
56   this->m_MinVertex = r.GetIndex( ) + r.GetSize( );
57 }
58
59 // -------------------------------------------------------------------------
60 template< class _TInput, class _TOutput >
61 void DijkstraWithMeanAndVariance< _TInput, _TOutput >::
62 _PostComputeOutputValue( TNode& n )
63 {
64   this->Superclass::_PostComputeOutputValue( n );
65   if( n.FrontId > 0 )
66   {
67     this->m_MeanAndVar.AddValue( this->_GetInputValue( n.Vertex ) );
68     for( unsigned int i = 0; i < TTraits::Dimension; ++i )
69     {
70       this->m_MinVertex[ i ] =
71         ( n.Vertex[ i ] < this->m_MinVertex[ i ] )?
72         n.Vertex[ i ]: this->m_MinVertex[ i ];
73       this->m_MaxVertex[ i ] =
74         ( this->m_MaxVertex[ i ] < n.Vertex[ i ] )?
75         n.Vertex[ i ]: this->m_MaxVertex[ i ];
76
77     } // rof
78
79   } // fi
80 }
81
82 #endif // __DijkstraWithMeanAndVariance__hxx__
83
84 // eof - $RCSfile$