]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Filters/RandomWalker.h
...
[FrontAlgorithms.git] / lib / fpa / Filters / RandomWalker.h
diff --git a/lib/fpa/Filters/RandomWalker.h b/lib/fpa/Filters/RandomWalker.h
new file mode 100644 (file)
index 0000000..5da8e7a
--- /dev/null
@@ -0,0 +1,77 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__RandomWalker__h__
+#define __fpa__Filters__RandomWalker__h__
+
+#include <itkFunctionBase.h>
+#include <fpa/Config.h>
+#include <fpa/Filters/PriorityQueueAlgorithm.h>
+#include <fpa/Functors/VertexFunction.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    /**
+     */
+    template< class _TDataInterface >
+    class RandomWalker
+      : public fpa::Filters::PriorityQueueAlgorithm< _TDataInterface >
+    {
+    public:
+      typedef _TDataInterface TDataInterface;
+      typedef fpa::Filters::PriorityQueueAlgorithm< TDataInterface > Superclass;
+      typedef RandomWalker                    Self;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename TDataInterface::TTraits TTraits;
+      fpaTraitsMacro( typename TTraits );
+      typedef TOutputValue TCost;
+      typedef TMark        TLabel;
+
+      typedef itk::FunctionBase< TCost, TCost >               TScalarWeight;
+      typedef fpa::Functors::VertexFunction< TVertex, TCost > TVertexWeight;
+
+    public:
+      itkTypeMacro(
+        fpa::Filters::RandomWalker, fpa::Filters::PriorityQueueAlgorithm
+        );
+
+      itkGetConstObjectMacro( ScalarWeight, TScalarWeight );
+      itkGetObjectMacro( ScalarWeight, TScalarWeight );
+
+      itkGetConstObjectMacro( VertexWeight, TVertexWeight );
+      itkGetObjectMacro( VertexWeight, TVertexWeight );
+
+    public:
+      void SetWeightFunction( TScalarWeight* p );
+      void SetWeightFunction( TVertexWeight* p );
+
+    protected:
+      RandomWalker( );
+      virtual ~RandomWalker( );
+
+      virtual void _PostComputeOutputValue( TNode& n ) override;
+      virtual void _PreComputeOutputValue( TNode& n ) override;
+
+    private:
+      RandomWalker( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      typename TScalarWeight::Pointer m_ScalarWeight;
+      typename TVertexWeight::Pointer m_VertexWeight;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/RandomWalker.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Filters__RandomWalker__h__
+// eof - $RCSfile$