1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Filters__RegionGrow__hxx__
6 #define __fpa__Filters__RegionGrow__hxx__
8 // -------------------------------------------------------------------------
9 template< class _TTraits >
10 void fpa::Filters::RegionGrow< _TTraits >::
11 SetPredicate( TScalarPredicate* p )
13 if( this->m_ScalarPredicate.GetPointer( ) != p )
15 this->_Deassociate( this->m_ScalarPredicate );
16 this->m_ScalarPredicate = p;
17 this->_Associate( this->m_ScalarPredicate );
23 // -------------------------------------------------------------------------
24 template< class _TTraits >
25 void fpa::Filters::RegionGrow< _TTraits >::
26 SetPredicate( TVertexPredicate* p )
28 if( this->m_VertexPredicate.GetPointer( ) != p )
30 this->_Deassociate( this->m_VertexPredicate );
31 this->m_VertexPredicate = p;
32 this->_Associate( this->m_VertexPredicate );
38 // -------------------------------------------------------------------------
39 template< class _TTraits >
40 typename fpa::Filters::RegionGrow< _TTraits >::
41 TOutputValue fpa::Filters::RegionGrow< _TTraits >::
42 GetOutsideValue( ) const
44 return( this->GetInitValue( ) );
47 // -------------------------------------------------------------------------
48 template< class _TTraits >
49 void fpa::Filters::RegionGrow< _TTraits >::
50 SetOutsideValue( const TOutputValue& v )
52 this->SetInitValue( v );
55 // -------------------------------------------------------------------------
56 template< class _TTraits >
57 fpa::Filters::RegionGrow< _TTraits >::
60 m_InsideValue( TOutputValue( 1 ) )
62 this->SetOutsideValue( 0 );
65 // -------------------------------------------------------------------------
66 template< class _TTraits >
67 fpa::Filters::RegionGrow< _TTraits >::
72 // -------------------------------------------------------------------------
73 template< class _TTraits >
74 void fpa::Filters::RegionGrow< _TTraits >::
75 _UpdateOutputValue( TNode& n )
77 TInputValue value = this->_GetInputValue( n );
79 if( this->m_ScalarPredicate.IsNotNull( ) )
80 inside = this->m_ScalarPredicate->Evaluate( value );
81 if( this->m_VertexPredicate.IsNotNull( ) )
82 inside &= this->m_VertexPredicate->Evaluate( n.Vertex, n.Parent );
85 n.Value = this->GetOutsideValue( );
89 n.Value = this->GetInsideValue( );
92 // -------------------------------------------------------------------------
93 template< class _TTraits >
94 void fpa::Filters::RegionGrow< _TTraits >::
97 this->m_Queue.clear( );
100 // -------------------------------------------------------------------------
101 template< class _TTraits >
102 typename fpa::Filters::RegionGrow< _TTraits >::
103 TNode fpa::Filters::RegionGrow< _TTraits >::
106 TNode n = this->m_Queue.front( );
107 this->m_Queue.pop_front( );
111 // -------------------------------------------------------------------------
112 template< class _TTraits >
113 void fpa::Filters::RegionGrow< _TTraits >::
114 _QueuePush( const TNode& n )
116 this->m_Queue.push_back( n );
119 // -------------------------------------------------------------------------
120 template< class _TTraits >
121 unsigned long fpa::Filters::RegionGrow< _TTraits >::
124 return( this->m_Queue.size( ) );
127 // -------------------------------------------------------------------------
128 template< class _TTraits >
129 void fpa::Filters::RegionGrow< _TTraits >::
130 _ComputeOutputValue( TNode& n )
135 #endif // __fpa__Filters__RegionGrow__hxx__