]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Functors/BaseVertexFunction.h
...
[FrontAlgorithms.git] / lib / fpa / Functors / BaseVertexFunction.h
diff --git a/lib/fpa/Functors/BaseVertexFunction.h b/lib/fpa/Functors/BaseVertexFunction.h
new file mode 100644 (file)
index 0000000..a29fc4d
--- /dev/null
@@ -0,0 +1,110 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Functors__BaseVertexFunction__h__
+#define __fpa__Functors__BaseVertexFunction__h__
+
+#include <itkDataObject.h>
+#include <itkObject.h>
+
+namespace fpa
+{
+  namespace Functors
+  {
+    /**
+     */
+    template< class _TVertex >
+    class LightBaseVertexFunction
+      : public itk::Object
+    {
+    public:
+      typedef _TVertex TVertex;
+      typedef itk::Object                     Superclass;
+      typedef LightBaseVertexFunction         Self;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+    public:
+      itkTypeMacro( fpa::Functors::LightBaseVertexFunction, itk::Object );
+
+      itkSetConstObjectMacro( DataObject, itk::DataObject );
+
+    public:
+      template< class _TDataObject = itk::DataObject >
+      const _TDataObject* GetDataObject( ) const
+        {
+          return(
+            dynamic_cast< const _TDataObject* >(
+              this->m_DataObject.GetPointer( )
+              )
+            );
+        }
+
+    protected:
+      LightBaseVertexFunction( )
+        : Superclass( ),
+          m_DataObject( NULL )
+        {
+        }
+
+      virtual ~LightBaseVertexFunction( )
+        {
+        }
+
+    private:
+      // Purposely not implemented.
+      LightBaseVertexFunction( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      itk::DataObject::ConstPointer m_DataObject;
+    };
+
+    /**
+     */
+    template< class _TVertex, class _TValue >
+    class BaseVertexFunction
+      : public LightBaseVertexFunction< _TVertex >
+    {
+    public:
+      typedef _TVertex TVertex;
+      typedef _TValue  TValue;
+      typedef LightBaseVertexFunction< _TVertex > Superclass;
+      typedef BaseVertexFunction                  Self;
+      typedef itk::SmartPointer< Self >           Pointer;
+      typedef itk::SmartPointer< const Self >     ConstPointer;
+
+    public:
+      itkTypeMacro(
+        fpa::Functors::RegionGrow::BaseVertexFunction,
+        fpa::Functors::RegionGrow::LightBaseVertexFunction
+        );
+
+    public:
+      virtual TValue Evaluate(
+        const TVertex& vertex, const TVertex& parent
+        ) const = 0;
+
+    protected:
+      BaseVertexFunction( )
+        : Superclass( )
+        {
+        }
+
+      virtual ~BaseVertexFunction( )
+        {
+        }
+
+    private:
+      // Purposely not implemented.
+      BaseVertexFunction( const Self& other );
+      Self& operator=( const Self& other );
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Functors__BaseVertexFunction__h__
+// eof - $RCSfile$