]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Filters/RandomWalker.hxx
...
[FrontAlgorithms.git] / lib / fpa / Filters / RandomWalker.hxx
diff --git a/lib/fpa/Filters/RandomWalker.hxx b/lib/fpa/Filters/RandomWalker.hxx
new file mode 100644 (file)
index 0000000..18b8d2b
--- /dev/null
@@ -0,0 +1,84 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__RandomWalker__hxx__
+#define __fpa__Filters__RandomWalker__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TDataInterface >
+void fpa::Filters::RandomWalker< _TDataInterface >::
+SetWeightFunction( TScalarWeight* p )
+{
+  if( this->m_ScalarWeight.GetPointer( ) != p )
+  {
+    this->_Deassociate( this->m_ScalarWeight );
+    this->m_ScalarWeight = p;
+    this->_Associate( this->m_ScalarWeight );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TDataInterface >
+void fpa::Filters::RandomWalker< _TDataInterface >::
+SetWeightFunction( TVertexWeight* p )
+{
+  if( this->m_VertexWeight.GetPointer( ) != p )
+  {
+    this->_Deassociate( this->m_VertexWeight );
+    this->m_VertexWeight = p;
+    this->_Associate( this->m_VertexWeight );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TDataInterface >
+fpa::Filters::RandomWalker< _TDataInterface >::
+RandomWalker( )
+  : Superclass( false )
+{
+  this->SetInitValue( TCost( 0 ) );
+  /* TODO
+     this->SetWeight(
+     fpa::Functors::RegionGrow::Tautology< TInputValue >::New( )
+     );
+  */
+}
+
+// -------------------------------------------------------------------------
+template< class _TDataInterface >
+fpa::Filters::RandomWalker< _TDataInterface >::
+~RandomWalker( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TDataInterface >
+void fpa::Filters::RandomWalker< _TDataInterface >::
+_PostComputeOutputValue( TNode& n )
+{
+  // Nothing to do with this algorithm
+}
+
+// -------------------------------------------------------------------------
+template< class _TDataInterface >
+void fpa::Filters::RandomWalker< _TDataInterface >::
+_PreComputeOutputValue( TNode& n )
+{
+  if( this->m_VertexWeight.IsNotNull( ) )
+  {
+    TCost c = this->m_VertexWeight->Evaluate( n.Vertex, n.Parent );
+    if( this->m_ScalarWeight.IsNotNull( ) )
+      c = this->m_ScalarWeight->Evaluate( c );
+    n.Value = c + this->_GetOutputValue( n.Parent );
+  }
+  else
+    n.Value = TCost( -1 );
+}
+
+#endif // __fpa__Filters__RandomWalker__hxx__
+// eof - $RCSfile$