]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/Algorithm.h
...
[FrontAlgorithms.git] / lib / fpa / Base / Algorithm.h
index 785b818ea8be76bdf3290896cf8c95f63b41bf55..051d61b346b6ded0ca6fc192473059c826a9b23e 100644 (file)
@@ -7,9 +7,8 @@
 #define __fpa__Base__Algorithm__h__
 
 #include <fpa/Config.h>
-
+#include <itkConceptChecking.h>
 #include <itkObject.h>
-#include <itkEventObject.h>
 
 namespace fpa
 {
@@ -17,66 +16,36 @@ namespace fpa
   {
     /**
      */
-    template< class _TTraits >
+    template< class _TFilter, class _TMarks, class _TSeeds >
     class Algorithm
-      : public _TTraits::TFilter,
-        public _TTraits::TMarksInterface,
-        public _TTraits::TSeedsInterface
+      : public _TFilter, public _TMarks, public _TSeeds
     {
     public:
-      typedef _TTraits                          TTraits;
-      typedef typename TTraits::TFilter         Superclass;
-      typedef typename TTraits::TMarksInterface TMarksInterface;
-      typedef typename TTraits::TSeedsInterface TSeedsInterface;
-      typedef Algorithm                         Self;
-      typedef itk::SmartPointer< Self >         Pointer;
-      typedef itk::SmartPointer< const Self >   ConstPointer;
-
-      typedef typename TTraits::TInputValue   TInputValue;
-      typedef typename TTraits::TOutputValue  TOutputValue;
-      typedef typename TTraits::TNeighborhood TNeighborhood;
-      typedef typename TTraits::TNode         TNode;
-      typedef typename TTraits::TNodes        TNodes;
-      typedef typename TTraits::TSeeds        TSeeds;
-      typedef typename TTraits::TVertex       TVertex;
-
-      /**
-       */
-      class TEvent
-        : public itk::EventObject
-      {
-      public:
-        typedef TEvent           Self;
-        typedef itk::EventObject Superclass;
-
-      public:
-        TEvent( );
-        TEvent( const TVertex& v, unsigned long fid, bool intoq );
-        virtual ~TEvent( );
-        virtual const char* GetEventName( ) const override;
-        virtual bool CheckEvent( const itk::EventObject* e ) const override;
-        virtual itk::EventObject* MakeObject( ) const override;
-
-      private:
-        // Purposely not implemented.
-        Self& operator=( const Self& other );
-
-      public:
-        TVertex       Vertex;
-        unsigned long FrontId;
-        bool          IntoQueue;
-      };
+      typedef _TMarks                         TMarksInterface;
+      typedef _TSeeds                         TSeedsInterface;
+      typedef _TFilter                        Superclass;
+      typedef Algorithm                       Self;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename _TMarks::TTraits TTraits;
+      fpa_Base_TraitTypes( typename TTraits );
+
+    private:
+      itkConceptMacro(
+        Marks_and_Seeds_SameTraits,
+        ( itk::Concept::SameType< typename _TSeeds::TTraits, TTraits > )
+        );
 
     public:
       itkTypeMacro( fpa::Base::Algorithm, _TFilter );
 
       itkBooleanMacro( VisualDebug );
-
-      itkGetConstMacro( InitValue, TOutputValue );
       itkGetConstMacro( VisualDebug, bool );
+      itkSetMacro( VisualDebug, bool );
 
+      itkGetConstMacro( InitValue, TOutputValue );
       itkSetMacro( InitValue, TOutputValue );
-      itkSetMacro( VisualDebug, bool );
 
     public:
       virtual void InvokeEvent( const itk::EventObject& e );