]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 8 Aug 2017 21:21:33 +0000 (16:21 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 8 Aug 2017 21:21:33 +0000 (16:21 -0500)
21 files changed:
lib/fpa/Base/Algorithm.h
lib/fpa/Base/Algorithm.hxx
lib/fpa/Base/Dijkstra.h
lib/fpa/Base/DijkstraBase.h
lib/fpa/Base/Event.h [new file with mode: 0644]
lib/fpa/Base/Event.hxx [new file with mode: 0644]
lib/fpa/Base/MarksInterface.h
lib/fpa/Base/MarksInterface.hxx
lib/fpa/Base/MarksInterfaceWithCollisions.h
lib/fpa/Base/MarksInterfaceWithCollisions.hxx
lib/fpa/Base/Mori.h
lib/fpa/Base/RegionGrow.h
lib/fpa/Base/SeedsInterface.h
lib/fpa/Base/SeedsInterface.hxx
lib/fpa/Base/SingleSeedInterface.h
lib/fpa/Base/SingleSeedInterface.hxx
lib/fpa/Config.h.in
lib/fpa/Image/Algorithm.h
lib/fpa/Image/Algorithm.hxx
lib/fpa/Image/DefaultTraits.h
lib/fpa/Image/RegionGrow.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 );
index 68296bebba6393585839f81f02b9cfd2e4546548..888dc3801711dbc290299fedea9bc45cf10b5a79 100644 (file)
@@ -7,58 +7,8 @@
 #define __fpa__Base__Algorithm__hxx__
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::Algorithm< _TTraits >::TEvent::
-TEvent( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::Algorithm< _TTraits >::TEvent::
-TEvent( const TVertex& v, unsigned long fid, bool intoq )
-  : Superclass( ),
-    Vertex( v ),
-    FrontId( fid ),
-    IntoQueue( intoq )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::Algorithm< _TTraits >::TEvent::
-~TEvent( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-const char* fpa::Base::Algorithm< _TTraits >::TEvent::
-GetEventName( ) const
-{
-  return( "fpa::Base::Algorithm< _TTraits >::TEvent" );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-bool fpa::Base::Algorithm< _TTraits >::TEvent::
-CheckEvent( const itk::EventObject* e ) const
-{
-  return( dynamic_cast< const Self* >( e ) != NULL );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-itk::EventObject* fpa::Base::Algorithm< _TTraits >::TEvent::
-MakeObject( ) const
-{
-  return( new Self );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 InvokeEvent( const itk::EventObject& e )
 {
   TEvent a;
@@ -72,8 +22,8 @@ InvokeEvent( const itk::EventObject& e )
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 InvokeEvent( const itk::EventObject& e ) const
 {
   TEvent a;
@@ -87,26 +37,26 @@ InvokeEvent( const itk::EventObject& e ) const
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 Algorithm( )
-  : Superclass( ),
-    TMarksInterface( this ),
-    TSeedsInterface( this ),
+  : _TFilter( ),
+    _TMarks( this ),
+    _TSeeds( this ),
     m_VisualDebug( false )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 ~Algorithm( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 GenerateData( )
 {
   this->InvokeEvent( itk::StartEvent( ) );
@@ -187,29 +137,29 @@ GenerateData( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 _BeforeGenerateData( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 _AfterGenerateData( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 _FinishOneLoop( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::Algorithm< _TTraits >::
+template< class _TFilter, class _TMarks, class _TSeeds >
+void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
 _QueueInit( )
 {
   this->_QueueClear( );
index 11f553848b465cc8fa09ceb6a450c467a0d803fc..508b368cafd07bff3ad87760126f7e31085b880e 100644 (file)
@@ -26,6 +26,7 @@ namespace fpa
 
       typedef _TMST TMST;
 
+      typedef typename Superclass::TTraits      TTraits;
       typedef typename Superclass::TNode        TNode;
       typedef typename Superclass::TNodes       TNodes;
       typedef typename Superclass::TInputValue  TInputValue;
index 4f08eb94bf94a9ab1ae95c3b6d214c43c6cc1fcf..b5f214fe2a23d0c1c3e3b0499804235d8e8c6052 100644 (file)
@@ -7,8 +7,8 @@
 #define __fpa__Base__DijkstraBase__h__
 
 #include <vector>
-
 #include <itkConceptChecking.h>
+#include <fpa/Config.h>
 #include <fpa/Base/Functors/Dijkstra/Function.h>
 
 namespace fpa
@@ -27,11 +27,16 @@ namespace fpa
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
-      typedef typename _TAlgorithm::TNode        TNode;
-      typedef typename _TAlgorithm::TNodes       TNodes;
-      typedef typename _TAlgorithm::TInputValue  TInputValue;
-      typedef typename _TAlgorithm::TOutputValue TOutputValue;
-      typedef typename _TAlgorithm::TVertex      TVertex;
+      typedef typename _TAlgorithm::TTraits TTraits;
+      fpa_Base_TraitTypes( typename TTraits );
+
+      /* TODO
+         typedef typename _TAlgorithm::TNode        TNode;
+         typedef typename _TAlgorithm::TNodes       TNodes;
+         typedef typename _TAlgorithm::TInputValue  TInputValue;
+         typedef typename _TAlgorithm::TOutputValue TOutputValue;
+         typedef typename _TAlgorithm::TVertex      TVertex;
+      */
 
       typedef std::vector< TNode > TQueue;
       struct TQueueOrder
diff --git a/lib/fpa/Base/Event.h b/lib/fpa/Base/Event.h
new file mode 100644 (file)
index 0000000..dc4910d
--- /dev/null
@@ -0,0 +1,54 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__Event__h__
+#define __fpa__Base__Event__h__
+
+#include <itkEventObject.h>
+
+namespace fpa
+{
+  namespace Base
+  {
+    /**
+     */
+    template< class _TVertex >
+    class Event
+      : public itk::EventObject
+    {
+    public:
+      typedef Event            Self;
+      typedef itk::EventObject Superclass;
+      typedef _TVertex         TVertex;
+
+    public:
+      Event( );
+      Event( const TVertex& v, unsigned long fid, bool intoq );
+      virtual ~Event( );
+      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;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Base/Event.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Base__Event__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Base/Event.hxx b/lib/fpa/Base/Event.hxx
new file mode 100644 (file)
index 0000000..309bc81
--- /dev/null
@@ -0,0 +1,61 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__Event__hxx__
+#define __fpa__Base__Event__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+fpa::Base::Event< _TVertex >::
+Event( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+fpa::Base::Event< _TVertex >::
+Event( const TVertex& v, unsigned long fid, bool intoq )
+  : Superclass( ),
+    Vertex( v ),
+    FrontId( fid ),
+    IntoQueue( intoq )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+fpa::Base::Event< _TVertex >::
+~Event( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+const char* fpa::Base::Event< _TVertex >::
+GetEventName( ) const
+{
+  return( "fpa::Base::Event< _TVertex >" );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+bool fpa::Base::Event< _TVertex >::
+CheckEvent( const itk::EventObject* e ) const
+{
+  return( dynamic_cast< const Self* >( e ) != NULL );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+itk::EventObject* fpa::Base::Event< _TVertex >::
+MakeObject( ) const
+{
+  return( new Self );
+}
+
+#endif // __fpa__Base__Event__hxx__
+
+// eof - $RCSfile$
index 96444575d59e50bbbf27b1fa47752f6f8bc01669..b4a84234b0539a4bacd7ce626a1ef66d5c98089b 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef __fpa__Base__MarksInterface__h__
 #define __fpa__Base__MarksInterface__h__
 
+#include <fpa/Config.h>
 #include <itkProcessObject.h>
 
 namespace fpa
@@ -14,12 +15,13 @@ namespace fpa
   {
     /**
      */
-    template< class _TVertex >
+    template< class _TTraits >
     class MarksInterface
     {
     public:
-      typedef _TVertex       TVertex;
+      typedef _TTraits TTraits;
       typedef MarksInterface Self;
+      fpa_Base_TraitTypes( typename TTraits );
 
     protected:
       MarksInterface( itk::ProcessObject* filter );
index cd37eb58db7e157a1eff92f3b0568f1233b97a5a..08ad426d8ee8d138ad8ba0c60f3324a1f234ef04 100644 (file)
@@ -7,8 +7,8 @@
 #define __fpa__Base__MarksInterface__hxx__
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-fpa::Base::MarksInterface< _TVertex >::
+template< class _TTraits >
+fpa::Base::MarksInterface< _TTraits >::
 MarksInterface( itk::ProcessObject* filter )
   : m_NumberOfSeeds( 0 ),
     m_Filter( filter )
@@ -16,23 +16,23 @@ MarksInterface( itk::ProcessObject* filter )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-fpa::Base::MarksInterface< _TVertex >::
+template< class _TTraits >
+fpa::Base::MarksInterface< _TTraits >::
 ~MarksInterface( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-void fpa::Base::MarksInterface< _TVertex >::
+template< class _TTraits >
+void fpa::Base::MarksInterface< _TTraits >::
 _InitMarks( unsigned long nSeeds )
 {
   this->m_NumberOfSeeds = nSeeds;
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-bool fpa::Base::MarksInterface< _TVertex >::
+template< class _TTraits >
+bool fpa::Base::MarksInterface< _TTraits >::
 _Collisions( const TVertex& a, const TVertex& b )
 {
   return( false );
index 3d6f10eddc8dbd2533b530500a1f9c5921ee1905..767882a3c171a28258c74a740aa28a7f44ff1bca 100644 (file)
@@ -16,14 +16,15 @@ namespace fpa
   {
     /**
      */
-    template< class _TVertex >
+    template< class _TTraits >
     class MarksInterfaceWithCollisions
-      : public fpa::Base::MarksInterface< _TVertex >
+      : public fpa::Base::MarksInterface< _TTraits >
     {
     public:
-      typedef _TVertex                             TVertex;
+      typedef _TTraits                             TTraits;
       typedef MarksInterfaceWithCollisions         Self;
-      typedef fpa::Base::MarksInterface< TVertex > Superclass;
+      typedef fpa::Base::MarksInterface< TTraits > Superclass;
+      fpa_Base_TraitTypes( typename TTraits );
 
       // Minigraph to represent collisions
       typedef std::pair< TVertex, bool >    TCollision;
index 12309317bb63389ab4c445593e59095a5559e49b..b7fd33f9b9a4e3ac08c3b1ba12419fccf05d5fae 100644 (file)
@@ -9,32 +9,32 @@
 #include <queue>
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-bool fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+bool fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
 StopAtOneFront( ) const
 {
   return( this->m_StopAtOneFront );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-void fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+void fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
 StopAtOneFrontOn( )
 {
   this->SetStopAtOneFront( true );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-void fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+void fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
 StopAtOneFrontOff( )
 {
   this->SetStopAtOneFront( false );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-void fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+void fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
 SetStopAtOneFront( bool v )
 {
   if( this->m_StopAtOneFront != v )
@@ -47,8 +47,8 @@ SetStopAtOneFront( bool v )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
 MarksInterfaceWithCollisions( itk::ProcessObject* filter )
   : Superclass( filter ),
     m_StopAtOneFront( false ),
@@ -57,15 +57,15 @@ MarksInterfaceWithCollisions( itk::ProcessObject* filter )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
 ~MarksInterfaceWithCollisions( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-void fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+void fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
 _InitMarks( unsigned long nSeeds )
 {
   this->Superclass::_InitMarks( nSeeds );
@@ -77,8 +77,8 @@ _InitMarks( unsigned long nSeeds )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex >
-bool fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+bool fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
 _Collisions( const TVertex& a, const TVertex& b )
 {
   unsigned long ma = this->_GetMark( a );
index 27f6915a671a8893805afc193973e9eb491278fc..e7ea726eab3c61809d5c7f2b8f9e1cc878ee5b61 100644 (file)
@@ -10,8 +10,8 @@
 #include <set>
 #include <itkConceptChecking.h>
 #include <itkFunctionBase.h>
-
 #include <ivq/ITK/PeakDetector.h>
+#include <fpa/Config.h>
 #include <fpa/Base/Functors/RegionGrow/BinaryThreshold.h>
 
 namespace fpa
@@ -30,12 +30,17 @@ namespace fpa
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
-      typedef typename _TAlgorithm::TNode        TNode;
-      typedef typename _TAlgorithm::TNodes       TNodes;
-      typedef typename _TAlgorithm::TInputValue  TInputValue;
-      typedef typename _TAlgorithm::TOutputValue TOutputValue;
-      typedef typename _TAlgorithm::TFrontId     TFrontId;
-      typedef typename _TAlgorithm::TVertex      TVertex;
+      typedef typename _TAlgorithm::TTraits TTraits;
+      fpa_Base_TraitTypes( typename TTraits );
+
+      /* TODO
+         typedef typename _TAlgorithm::TNode        TNode;
+         typedef typename _TAlgorithm::TNodes       TNodes;
+         typedef typename _TAlgorithm::TInputValue  TInputValue;
+         typedef typename _TAlgorithm::TOutputValue TOutputValue;
+         typedef typename _TAlgorithm::TFrontId     TFrontId;
+         typedef typename _TAlgorithm::TVertex      TVertex;
+      */
 
       typedef std::deque< TNode >     TQueue;
       typedef std::set< TInputValue > TThresholds;
index 8d7439f74e8a6e065e9730e17588445b01885572..71479448ac4b1ae6d53dcc59f6013ce2b3e8cc26 100644 (file)
@@ -7,7 +7,7 @@
 #define __fpa__Base__RegionGrow__h__
 
 #include <deque>
-
+#include <fpa/Config.h>
 #include <itkConceptChecking.h>
 #include <itkFunctionBase.h>
 
@@ -27,28 +27,33 @@ namespace fpa
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
-      typedef typename _TAlgorithm::TNode        TNode;
-      typedef typename _TAlgorithm::TNodes       TNodes;
-      typedef typename _TAlgorithm::TInputValue  TInputValue;
-      typedef typename _TAlgorithm::TOutputValue TOutputValue;
-      typedef typename _TAlgorithm::TFrontId     TFrontId;
-      typedef typename _TAlgorithm::TVertex      TVertex;
+      typedef typename _TAlgorithm::TTraits TTraits;
+      fpa_Base_TraitTypes( typename TTraits );
+      /* TODO
+         typedef typename _TAlgorithm::TNode        TNode;
+         typedef typename _TAlgorithm::TNodes       TNodes;
+         typedef typename _TAlgorithm::TInputValue  TInputValue;
+         typedef typename _TAlgorithm::TOutputValue TOutputValue;
+         typedef typename _TAlgorithm::TFrontId     TFrontId;
+         typedef typename _TAlgorithm::TVertex      TVertex;
+      */
 
       typedef std::deque< TNode >                    TQueue;
       typedef itk::FunctionBase< TInputValue, bool > TValuePredicate;
       typedef itk::FunctionBase< TVertex, bool >     TVertexPredicate;
 
-    public:
+    private:
       itkConceptMacro(
         Check_TOutputValue,
         ( itk::Concept::IsUnsignedInteger< TOutputValue > )
         );
 
     public:
+
       itkGetObjectMacro( ValuePredicate, TValuePredicate );
       itkGetObjectMacro( VertexPredicate, TVertexPredicate );
-      itkGetConstMacro( InsideValue, TOutputValue );
 
+      itkGetConstMacro( InsideValue, TOutputValue );
       itkSetMacro( InsideValue, TOutputValue );
 
     public:
index 61860cc5fd66570b868ca351795248b1e736bfe3..8162675cf003469497f797b9c1cdd108e8dc7971 100644 (file)
@@ -6,70 +6,79 @@
 #ifndef __fpa__Base__SeedsInterface__h__
 #define __fpa__Base__SeedsInterface__h__
 
-#include <functional>
-#include <set>
-#include <vector>
-
+#include <fpa/Config.h>
 #include <itkConceptChecking.h>
 #include <itkProcessObject.h>
 
+/* TODO
+   #include <functional>
+   #include <set>
+   #include <vector>
+*/
+
 namespace fpa
 {
   namespace Base
   {
     /**
      */
-    template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare = std::greater< _TVertex > >
+    template< class _TTraits >
     class SeedsInterface
     {
     public:
+      typedef SeedsInterface Self;
+      typedef _TTraits       TTraits;
+      fpa_Base_TraitTypes( typename TTraits );
+
+      /* TODO
+         typedef _TVertex       TVertex;
+         typedef _TPoint        TPoint;
+         typedef _TInputValue   TInputValue;
+         typedef _TOutputValue  TOutputValue;
+         typedef _TFrontId      TFrontId;
+         typedef _TCompare      TCompare;
+         typedef SeedsInterface Self;
+
+         struct TSeed
+         {
+         TVertex Vertex;
+         TPoint  Point;
+         bool    IsPoint;
+         bool    IsUnified;
+         TFrontId FrontId;
+         TSeed( )
+         : IsUnified( false ),
+         FrontId( TFrontId( 0 ) )
+         { }
+         };
+         typedef std::vector< TSeed > TSeeds;
+
+         struct TNode
+         {
+         TVertex  Vertex;
+         TVertex  Parent;
+         TFrontId FrontId;
+
+         // Hack to hide the fact that seed values need to be initialized
+         mutable TOutputValue Value;
+         };
+         struct TNodeCompare
+         {
+         bool operator()( const TNode& a, const TNode& b ) const
+         {
+         TCompare cmp;
+         return( cmp( a.Vertex, b.Vertex ) );
+         }
+         };
+         typedef std::set< TNode, TNodeCompare > TNodes;
+      */
+
+    private:
       itkConceptMacro(
         Check_TFrontId,
         ( itk::Concept::IsUnsignedInteger< _TFrontId > )
         );
 
-    public:
-      typedef _TVertex       TVertex;
-      typedef _TPoint        TPoint;
-      typedef _TInputValue   TInputValue;
-      typedef _TOutputValue  TOutputValue;
-      typedef _TFrontId      TFrontId;
-      typedef _TCompare      TCompare;
-      typedef SeedsInterface Self;
-
-      struct TSeed
-      {
-        TVertex Vertex;
-        TPoint  Point;
-        bool    IsPoint;
-        bool    IsUnified;
-        TFrontId FrontId;
-        TSeed( )
-          : IsUnified( false ),
-            FrontId( TFrontId( 0 ) )
-          { }
-      };
-      typedef std::vector< TSeed > TSeeds;
-
-      struct TNode
-      {
-        TVertex  Vertex;
-        TVertex  Parent;
-        TFrontId FrontId;
-
-        // Hack to hide the fact that seed values need to be initialized
-        mutable TOutputValue Value;
-      };
-      struct TNodeCompare
-      {
-        bool operator()( const TNode& a, const TNode& b ) const
-          {
-            TCompare cmp;
-            return( cmp( a.Vertex, b.Vertex ) );
-          }
-      };
-      typedef std::set< TNode, TNodeCompare > TNodes;
-
     public:
       TSeeds& GetSeeds( );
       const TSeeds& GetSeeds( ) const;
index 5bfd16a45d8da329bcf6c377eb71f176ed03a50d..77b1600c2597dad3948afcba0941914e7c5b7a27 100644 (file)
@@ -7,31 +7,26 @@
 #define __fpa__Base__SeedsInterface__hxx__
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-typename
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
-TSeeds&
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+typename fpa::Base::SeedsInterface< _TTraits >::
+TSeeds& fpa::Base::SeedsInterface< _TTraits >::
 GetSeeds( )
 {
   return( this->m_Seeds );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-const typename
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
-TSeeds&
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+const typename fpa::Base::SeedsInterface< _TTraits >::
+TSeeds& fpa::Base::SeedsInterface< _TTraits >::
 GetSeeds( ) const
 {
   return( this->m_Seeds );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-void
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+void fpa::Base::SeedsInterface< _TTraits >::
 AddSeed( const TVertex& seed )
 {
   TSeed s;
@@ -43,9 +38,8 @@ AddSeed( const TVertex& seed )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-void
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+void fpa::Base::SeedsInterface< _TTraits >::
 AddSeed( const TPoint& seed )
 {
   TSeed s;
@@ -57,9 +51,8 @@ AddSeed( const TPoint& seed )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-void
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+void fpa::Base::SeedsInterface< _TTraits >::
 ClearSeeds( )
 {
   if( this->m_Seeds.size( ) > 0 )
@@ -72,16 +65,16 @@ ClearSeeds( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+fpa::Base::SeedsInterface< _TTraits >::
 SeedsInterface( itk::ProcessObject* filter )
   : m_Filter( filter )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+fpa::Base::SeedsInterface< _TTraits >::
 ~SeedsInterface( )
 {
   this->m_Seeds.clear( );
index 0b2147b24845172b402fa27457017d58f6acfada..807d8d0552cb557818446b85d7941be37fad782e 100644 (file)
@@ -6,10 +6,7 @@
 #ifndef __fpa__Base__SingleSeedInterface__h__
 #define __fpa__Base__SingleSeedInterface__h__
 
-#include <functional>
-#include <set>
-#include <vector>
-
+#include <fpa/Config.h>
 #include <itkConceptChecking.h>
 #include <itkProcessObject.h>
 
@@ -19,57 +16,63 @@ namespace fpa
   {
     /**
      */
-    template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare = std::greater< _TVertex > >
+    template< class _TTraits >
     class SingleSeedInterface
     {
     public:
+      typedef SingleSeedInterface Self;
+      typedef _TTraits            TTraits;
+      fpa_Base_TraitTypes( typename TTraits );
+
+      /* TODO
+         typedef _TVertex       TVertex;
+         typedef _TPoint        TPoint;
+         typedef _TInputValue   TInputValue;
+         typedef _TOutputValue  TOutputValue;
+         typedef _TFrontId      TFrontId;
+         typedef _TCompare      TCompare;
+         typedef SeedsInterface Self;
+
+         struct TSeed
+         {
+         TVertex Vertex;
+         TPoint  Point;
+         bool    IsPoint;
+         bool    IsUnified;
+         TFrontId FrontId;
+         TSeed( )
+         : IsUnified( false ),
+         FrontId( TFrontId( 0 ) )
+         { }
+         };
+         typedef std::vector< TSeed > TSeeds;
+
+         struct TNode
+         {
+         TVertex  Vertex;
+         TVertex  Parent;
+         TFrontId FrontId;
+
+         // Hack to hide the fact that seed values need to be initialized
+         mutable TOutputValue Value;
+         };
+         struct TNodeCompare
+         {
+         bool operator()( const TNode& a, const TNode& b ) const
+         {
+         TCompare cmp;
+         return( cmp( a.Vertex, b.Vertex ) );
+         }
+         };
+         typedef std::set< TNode, TNodeCompare > TNodes;
+      */
+
+    private:
       itkConceptMacro(
         Check_TFrontId,
         ( itk::Concept::IsUnsignedInteger< _TFrontId > )
         );
 
-    public:
-      typedef _TVertex       TVertex;
-      typedef _TPoint        TPoint;
-      typedef _TInputValue   TInputValue;
-      typedef _TOutputValue  TOutputValue;
-      typedef _TFrontId      TFrontId;
-      typedef _TCompare      TCompare;
-      typedef SingleSeedInterface Self;
-
-      struct TSeed
-      {
-        TVertex  Vertex;
-        TPoint   Point;
-        bool     IsPoint;
-        bool     IsUnified;
-        TFrontId FrontId;
-        TSeed( )
-          : IsUnified( false ),
-            FrontId( TFrontId( 0 ) )
-          { }
-      };
-      typedef std::vector< TSeed > TSeeds;
-
-      struct TNode
-      {
-        TVertex  Vertex;
-        TVertex  Parent;
-        TFrontId FrontId;
-
-        // Hack to hide the fact that seed values need to be initialized
-        mutable TOutputValue Value;
-      };
-      struct TNodeCompare
-      {
-        bool operator()( const TNode& a, const TNode& b ) const
-          {
-            TCompare cmp;
-            return( cmp( a.Vertex, b.Vertex ) );
-          }
-      };
-      typedef std::set< TNode, TNodeCompare > TNodes;
-
     public:
       TSeeds& GetSeeds( );
       const TSeeds& GetSeeds( ) const;
index c669618552e7b66eaaec344aac06f2cda44d5e52..63cc629284b923acb1072e733b94128e2d238dc2 100644 (file)
@@ -7,31 +7,26 @@
 #define __fpa__Base__SingleSeedInterface__hxx__
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-typename
-fpa::Base::SingleSeedInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
-TSeeds&
-fpa::Base::SingleSeedInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+typename fpa::Base::SingleSeedInterface< _TTraits >::
+TSeeds& fpa::Base::SingleSeedInterface< _TTraits >::
 GetSeeds( )
 {
   return( this->m_Seeds );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-const typename
-fpa::Base::SingleSeedInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
-TSeeds&
-fpa::Base::SingleSeedInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+const typename fpa::Base::SingleSeedInterface< _TTraits >::
+TSeeds& fpa::Base::SingleSeedInterface< _TTraits >::
 GetSeeds( ) const
 {
   return( this->m_Seeds );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-void
-fpa::Base::SingleSeedInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+void fpa::Base::SingleSeedInterface< _TTraits >::
 SetSeed( const TVertex& seed )
 {
   TSeed s;
@@ -43,9 +38,8 @@ SetSeed( const TVertex& seed )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-void
-fpa::Base::SingleSeedInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+void fpa::Base::SingleSeedInterface< _TTraits >::
 SetSeed( const TPoint& seed )
 {
   TSeed s;
@@ -57,8 +51,8 @@ SetSeed( const TPoint& seed )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-fpa::Base::SingleSeedInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+fpa::Base::SingleSeedInterface< _TTraits >::
 SingleSeedInterface( itk::ProcessObject* filter )
   : m_Filter( filter )
 {
@@ -66,8 +60,8 @@ SingleSeedInterface( itk::ProcessObject* filter )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
-fpa::Base::SingleSeedInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+template< class _TTraits >
+fpa::Base::SingleSeedInterface< _TTraits >::
 ~SingleSeedInterface( )
 {
   this->m_Seeds.clear( );
index 708dec1f9f21d52b344660b0e93949f41188ce1f..e1cd318189a6a2678e41bb305157a98434b5ae0e 100644 (file)
 #  undef USE_ivq
 #endif
 
+// -------------------------------------------------------------------------
+#define fpa_Base_TraitTypes( _traits_ )              \
+  typedef _traits_::TInputValue   TInputValue;       \
+  typedef _traits_::TOutputValue  TOutputValue;      \
+  typedef _traits_::TNeighborhood TNeighborhood;     \
+  typedef _traits_::TNode         TNode;             \
+  typedef _traits_::TNodes        TNodes;            \
+  typedef _traits_::TSeeds        TSeeds;            \
+  typedef _traits_::TVertex       TVertex;           \
+  typedef _traits_::TEvent        TEvent
+
 #endif // __fpa__Config__h__
 
 // eof - $RCSfile$
index 1c84a7253532bd69f72d2ec89b6aafddeada40ca..6bed9adc858a68b142aca6effff34065fef065a5 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <itkImage.h>
 #include <itkImageToImageFilter.h>
-
 #include <fpa/Base/Algorithm.h>
 
 namespace fpa
@@ -17,27 +16,37 @@ namespace fpa
   {
     /**
      */
-    template< class _TTraits >
+    template< class _TTraits, class _TMarks, class _TSeeds >
     class Algorithm
-      : public fpa::Base::Algorithm< _TTraits >
+      : public fpa::Base::Algorithm< itk::ImageToImageFilter< typename _TTraits::TInputImage, typename _TTraits::TOutputImage >, _TMarks, _TSeeds >
     {
     public:
       typedef _TTraits TTraits;
-      typedef fpa::Base::Algorithm< _TTraits > Superclass;
-      typedef Algorithm                        Self;
-      typedef itk::SmartPointer< Self >        Pointer;
-      typedef itk::SmartPointer< const Self >  ConstPointer;
-
-      typedef typename TTraits::TFrontId      TFrontId;
-      typedef typename TTraits::TInputImage   TInputImage;
-      typedef typename TTraits::TInputValue   TInputValue;
-      typedef typename TTraits::TNeighborhood TNeighborhood;
-      typedef typename TTraits::TNode         TNode;
-      typedef typename TTraits::TNodes        TNodes;
-      typedef typename TTraits::TOutputImage  TOutputImage;
-      typedef typename TTraits::TOutputValue  TOutputValue;
-      typedef typename TTraits::TSeeds        TSeeds;
-      typedef typename TTraits::TVertex       TVertex;
+      typedef _TMarks  TMarksInterface;
+      typedef _TSeeds  TSeedsInterface;
+      typedef typename TTraits::TInputImage  TInputImage;
+      typedef typename TTraits::TOutputImage TOutputImage;
+      typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
+
+      typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
+      typedef Algorithm                       Self;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      fpa_Base_TraitTypes( typename TTraits );
+
+      /* TODO
+         typedef typename TTraits::TFrontId      TFrontId;
+         typedef typename TTraits::TInputImage   TInputImage;
+         typedef typename TTraits::TInputValue   TInputValue;
+         typedef typename TTraits::TNeighborhood TNeighborhood;
+         typedef typename TTraits::TNode         TNode;
+         typedef typename TTraits::TNodes        TNodes;
+         typedef typename TTraits::TOutputImage  TOutputImage;
+         typedef typename TTraits::TOutputValue  TOutputValue;
+         typedef typename TTraits::TSeeds        TSeeds;
+         typedef typename TTraits::TVertex       TVertex;
+      */
 
       typedef itk::Image< TFrontId, TTraits::Dimension > TMarks;
 
@@ -63,6 +72,12 @@ namespace fpa
          typedef Algorithm                       Self;
       */
 
+    private:
+      itkConceptMacro(
+        Marks_SameTraits,
+        ( itk::Concept::SameType< typename _TMarks::TTraits, TTraits > )
+        );
+
     public:
       itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
 
index 43ebeb0af9da0affc72c892300b2d5ee6e7b3f9d..744aafa148a8c9b9e4707ceb38aeb269ec01a519 100644 (file)
@@ -7,9 +7,9 @@
 #define __fpa__Image__Algorithm__hxx__
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-typename fpa::Image::Algorithm< _TTraits >::TMarks*
-fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TMarks*
+fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 GetMarks( )
 {
   return(
@@ -20,9 +20,9 @@ GetMarks( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-const typename fpa::Image::Algorithm< _TTraits >::TMarks*
-fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+const typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TMarks*
+fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 GetMarks( ) const
 {
   return(
@@ -33,8 +33,8 @@ GetMarks( ) const
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 Algorithm( )
   : Superclass( ),
     m_NeigborhoodOrder( 1 )
@@ -45,16 +45,16 @@ Algorithm( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 ~Algorithm( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-typename fpa::Image::Algorithm< _TTraits >::TNodes
-fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TNodes
+fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _UnifySeeds( )
 {
   const TInputImage* input = this->GetInput( );
@@ -90,8 +90,8 @@ _UnifySeeds( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+void fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _ConfigureOutput( const TOutputValue& v )
 {
   const TInputImage* in = this->GetInput( );
@@ -118,9 +118,9 @@ _ConfigureOutput( const TOutputValue& v )
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-typename fpa::Image::Algorithm< _TTraits >::TNeighborhood
-fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TNeighborhood
+fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _GetNeighbors( const TVertex& v ) const
 {
   typename TInputImage::RegionType region =
@@ -150,50 +150,50 @@ _GetNeighbors( const TVertex& v ) const
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-typename fpa::Image::Algorithm< _TTraits >::TInputValue
-fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TInputValue
+fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _GetInputValue( const TVertex& v ) const
 {
   return( this->GetInput( )->GetPixel( v ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-typename fpa::Image::Algorithm< _TTraits >::TOutputValue
-fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TOutputValue
+fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _GetOutputValue( const TVertex& v ) const
 {
   return( this->GetOutput( )->GetPixel( v ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+void fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _UpdateOutputValue( TNode& n )
 {
   this->GetOutput( )->SetPixel( n.Vertex, n.Value );
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-bool fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+bool fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _IsMarked( const TVertex& v ) const
 {
   return( this->GetMarks( )->GetPixel( v ) > 0 );
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-unsigned long fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+unsigned long fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _GetMark( const TVertex& v ) const
 {
   return( ( unsigned long )( this->GetMarks( )->GetPixel( v ) ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Image::Algorithm< _TTraits >::
+template< class _TTraits, class _TMarks, class _TSeeds >
+void fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
 _Mark( const TVertex& v, unsigned long frontId )
 {
   this->GetMarks( )->SetPixel( v, TFrontId( frontId ) );
index c2b829530d9915e369c4a5184ea179b980750750..9ce95eb67a718b9f707b02501270945fb6a792cb 100644 (file)
@@ -10,9 +10,6 @@
 #include <itkConceptChecking.h>
 #include <itkImageToImageFilter.h>
 
-#include <fpa/Base/MarksInterfaceWithCollisions.h>
-#include <fpa/Base/SeedsInterface.h>
-
 namespace fpa
 {
   namespace Image
@@ -37,19 +34,15 @@ namespace fpa
 
       typedef std::vector< TVertex > TNeighborhood;
 
-      typedef fpa::Base::SeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TCompare > TSeedsInterface;
-      typedef fpa::Base::MarksInterfaceWithCollisions< TVertex > TMarksInterface;
-      typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
-
       typedef typename TSeedsInterface::TNode  TNode;
       typedef typename TSeedsInterface::TNodes TNodes;
       typedef typename TSeedsInterface::TSeed  TSeed;
       typedef typename TSeedsInterface::TSeeds TSeeds;
 
-    public:
+    private:
       itkConceptMacro(
         Check_SameDimension,
-        ( itk::Concept::SameDimension< TInputImage::ImageDimension, TOutputImage::ImageDimension > )
+        ( itk::Concept::SameDimension< Self::Dimension, TOutputImage::ImageDimension > )
         );
 
     private:
index 4d190dc09e32229afc33dc88da42c55333dbf202..3797b23d78cc1f00708486689f798f6e4021d0e6 100644 (file)
@@ -6,32 +6,39 @@
 #ifndef __fpa__Image__RegionGrow__h__
 #define __fpa__Image__RegionGrow__h__
 
+#include <fpa/Base/MarksInterfaceWithCollisions.h>
 #include <fpa/Base/RegionGrow.h>
+#include <fpa/Base/SeedsInterface.h>
 #include <fpa/Image/Algorithm.h>
 #include <fpa/Image/DefaultTraits.h>
 
+
 namespace fpa
 {
   namespace Image
   {
     /**
      */
-    template< class _TInputImage, class _TOutputImage, class _TFrontId = unsigned char >
+    template< class _TInputImage, class _TOutputImage, class _TFrontId = unsigned char, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, _TFrontId > >
     class RegionGrow
-      : public fpa::Base::RegionGrow< fpa::Image::Algorithm< fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, _TFrontId > > >
+      : public fpa::Base::RegionGrow< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterfaceWithCollisions< _TTraits >, fpa::Base::SeedsInterface< _TTraits > > >
     {
     public:
       typedef _TInputImage  TInputImage;
       typedef _TOutputImage TOutputImage;
       typedef _TFrontId     TFrontId;
+      typedef _TTraits      TTraits;
+      typedef fpa::Base::MarksInterfaceWithCollisions< TTraits > TMarksInterface;
+      typedef fpa::Base::SeedsInterface< TTraits > TSeedsInterface;
 
-      typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > TTraits;
-      typedef fpa::Image::Algorithm< TTraits >    TAlgorithm;
+      typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm;
       typedef fpa::Base::RegionGrow< TAlgorithm > Superclass;
       typedef RegionGrow                          Self;
       typedef itk::SmartPointer< Self >           Pointer;
       typedef itk::SmartPointer< const Self >     ConstPointer;
 
+      fpa_Base_TraitTypes( typename TTraits );
+
     public:
       itkNewMacro( Self );
       itkTypeMacro( fpa::Image::RegionGrow, fpa::Base::RegionGrow );