#define __fpa__Base__Algorithm__h__
#include <fpa/Config.h>
-
+#include <itkConceptChecking.h>
#include <itkObject.h>
-#include <itkEventObject.h>
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 );
#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;
}
// -------------------------------------------------------------------------
-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;
}
// -------------------------------------------------------------------------
-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( ) );
}
// -------------------------------------------------------------------------
-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( );
typedef _TMST TMST;
+ typedef typename Superclass::TTraits TTraits;
typedef typename Superclass::TNode TNode;
typedef typename Superclass::TNodes TNodes;
typedef typename Superclass::TInputValue TInputValue;
#define __fpa__Base__DijkstraBase__h__
#include <vector>
-
#include <itkConceptChecking.h>
+#include <fpa/Config.h>
#include <fpa/Base/Functors/Dijkstra/Function.h>
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
--- /dev/null
+// =========================================================================
+// @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$
--- /dev/null
+// =========================================================================
+// @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$
#ifndef __fpa__Base__MarksInterface__h__
#define __fpa__Base__MarksInterface__h__
+#include <fpa/Config.h>
#include <itkProcessObject.h>
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 );
#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 )
}
// -------------------------------------------------------------------------
-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 );
{
/**
*/
- 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;
#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 )
}
// -------------------------------------------------------------------------
-template< class _TVertex >
-fpa::Base::MarksInterfaceWithCollisions< _TVertex >::
+template< class _TTraits >
+fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
MarksInterfaceWithCollisions( itk::ProcessObject* filter )
: Superclass( filter ),
m_StopAtOneFront( false ),
}
// -------------------------------------------------------------------------
-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 );
}
// -------------------------------------------------------------------------
-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 );
#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
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;
#define __fpa__Base__RegionGrow__h__
#include <deque>
-
+#include <fpa/Config.h>
#include <itkConceptChecking.h>
#include <itkFunctionBase.h>
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:
#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;
#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;
}
// -------------------------------------------------------------------------
-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;
}
// -------------------------------------------------------------------------
-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 )
}
// -------------------------------------------------------------------------
-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( );
#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>
{
/**
*/
- 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;
#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;
}
// -------------------------------------------------------------------------
-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;
}
// -------------------------------------------------------------------------
-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 )
{
}
// -------------------------------------------------------------------------
-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( );
# 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$
#include <itkImage.h>
#include <itkImageToImageFilter.h>
-
#include <fpa/Base/Algorithm.h>
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;
typedef Algorithm Self;
*/
+ private:
+ itkConceptMacro(
+ Marks_SameTraits,
+ ( itk::Concept::SameType< typename _TMarks::TTraits, TTraits > )
+ );
+
public:
itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
#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(
}
// -------------------------------------------------------------------------
-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(
}
// -------------------------------------------------------------------------
-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 )
}
// -------------------------------------------------------------------------
-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( );
}
// -------------------------------------------------------------------------
-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( );
}
// -------------------------------------------------------------------------
-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 =
}
// -------------------------------------------------------------------------
-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 ) );
#include <itkConceptChecking.h>
#include <itkImageToImageFilter.h>
-#include <fpa/Base/MarksInterfaceWithCollisions.h>
-#include <fpa/Base/SeedsInterface.h>
-
namespace fpa
{
namespace Image
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:
#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 );