]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/RegionGrow.hxx
...
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrow.hxx
index 18bb1324518c0d637813e46cbc7b3dd8f7601773..bf0a862e23b36ee15e3bb512003c4d8f35a44245 100644 (file)
@@ -90,29 +90,31 @@ fpa::Base::RegionGrow< _TAlgorithm >::
 
 // -------------------------------------------------------------------------
 template< class _TAlgorithm >
-typename fpa::Base::RegionGrow< _TAlgorithm >::
-TOutputValue fpa::Base::RegionGrow< _TAlgorithm >::
-_ComputeOutputValue( const TNode& n )
+void fpa::Base::RegionGrow< _TAlgorithm >::
+_ComputeOutputValue( TNode& n )
 {
-  TInputValue value = this->_GetInputValue( n.Vertex );
-  bool inside = false;
-  if( this->m_ValuePredicate.IsNotNull( ) )
-    inside = this->m_ValuePredicate->Evaluate( value );
-  if( this->m_VertexPredicate.IsNotNull( ) )
-    inside &= this->m_VertexPredicate->Evaluate( n.Vertex );
-  return( ( inside )? this->m_InsideValue: this->m_InitValue );
+  // Do nothing!!!
 }
 
 // -------------------------------------------------------------------------
 template< class _TAlgorithm >
 void fpa::Base::RegionGrow< _TAlgorithm >::
-_QueueInit( )
+_UpdateOutputValue( TNode& n )
 {
-  typedef typename Superclass::TSeedsInterface::TSeeds::iterator _TIt;
-
-  this->Superclass::_QueueInit( );
-  for( _TIt sIt = this->BeginSeeds( ); sIt != this->EndSeeds( ); ++sIt )
-    sIt->Value = this->m_InsideValue;
+  TInputValue value = this->_GetInputValue( n.Vertex );
+  bool inside = false;
+  if( this->m_ValuePredicate.IsNotNull( ) )
+    inside = this->m_ValuePredicate->Evaluate( value );
+  if( this->m_VertexPredicate.IsNotNull( ) )
+    inside &= this->m_VertexPredicate->Evaluate( n.Vertex );
+  if( !inside )
+  {
+    n.Value = this->m_InitValue;
+    n.FrontId = 0;
+  }
+  else
+    n.Value = this->m_InsideValue;
+  this->Superclass::_UpdateOutputValue( n );
 }
 
 // -------------------------------------------------------------------------
@@ -150,6 +152,16 @@ _QueueSize( ) const
   return( this->m_Queue.size( ) );
 }
 
+// -------------------------------------------------------------------------
+template< class _TAlgorithm >
+void fpa::Base::RegionGrow< _TAlgorithm >::
+_PrepareSeeds( TNodes& nodes )
+{
+  typename TNodes::iterator nIt = nodes.begin( );
+  for( ; nIt != nodes.end( ); ++nIt )
+    nIt->Value = this->m_InitValue;
+}
+
 #endif // __fpa__Base__RegionGrow__hxx__
 
 // eof - $RCSfile$