]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Filters/RegionGrow.h
...
[FrontAlgorithms.git] / lib / fpa / Filters / RegionGrow.h
diff --git a/lib/fpa/Filters/RegionGrow.h b/lib/fpa/Filters/RegionGrow.h
new file mode 100644 (file)
index 0000000..edf77cf
--- /dev/null
@@ -0,0 +1,95 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__RegionGrow__h__
+#define __fpa__Filters__RegionGrow__h__
+
+#include <deque>
+#include <itkConceptChecking.h>
+#include <itkFunctionBase.h>
+#include <fpa/Filters/Algorithm.h>
+#include <fpa/Functors/BaseVertexFunction.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    /**
+     */
+    template< class _TTraits >
+    class RegionGrow
+      : public fpa::Filters::Algorithm< _TTraits >
+    {
+    public:
+      typedef _TTraits TTraits;
+      fpaTraitsMacro( typename, TTraits );
+
+      typedef fpa::Filters::Algorithm< TTraits > Superclass;
+      typedef RegionGrow                         Self;
+      typedef itk::SmartPointer< Self >          Pointer;
+      typedef itk::SmartPointer< const Self >    ConstPointer;
+
+      typedef std::deque< TNode >                    TQueue;
+      typedef itk::FunctionBase< TInputValue, bool > TScalarPredicate;
+      typedef fpa::Functors::BaseVertexFunction< TVertex, bool > TVertexPredicate;
+
+    protected:
+      itkConceptMacro(
+        Check_TOutputValue,
+        ( itk::Concept::IsUnsignedInteger< TOutputValue > )
+        );
+
+    public:
+      itkTypeMacro( fpa::Filters::RegionGrow, fpa::Filters::Algorithm );
+
+      itkGetConstObjectMacro( ScalarPredicate, TScalarPredicate );
+      itkGetObjectMacro( ScalarPredicate, TScalarPredicate );
+
+      itkGetConstObjectMacro( VertexPredicate, TVertexPredicate );
+      itkGetObjectMacro( VertexPredicate, TVertexPredicate );
+
+      itkGetConstMacro( InsideValue, TOutputValue );
+      itkSetMacro( InsideValue, TOutputValue );
+
+    public:
+      void SetPredicate( TScalarPredicate* p );
+      void SetPredicate( TVertexPredicate* p );
+
+      TOutputValue GetOutsideValue( ) const;
+      void SetOutsideValue( const TOutputValue& v );
+
+    protected:
+      RegionGrow( );
+      virtual ~RegionGrow( );
+
+      virtual void _UpdateOutputValue( TNode& n ) override;
+      virtual void _QueueClear( ) override;
+      virtual TNode _QueuePop( ) override;
+      virtual void _QueuePush( const TNode& n ) override;
+      virtual unsigned long _QueueSize( ) const override;
+      virtual void _ComputeOutputValue( TNode& n ) override;
+
+    private:
+      // Purposely not implemented.
+      RegionGrow( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      typename TScalarPredicate::Pointer m_ScalarPredicate;
+      typename TVertexPredicate::Pointer m_VertexPredicate;
+
+      TOutputValue m_InsideValue;
+      TQueue       m_Queue;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/RegionGrow.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Filters__RegionGrow__h__
+// eof - $RCSfile$