From c9542e420b94b0bfc1f285599f7816eab1191519 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Tue, 8 Aug 2017 16:21:33 -0500 Subject: [PATCH 1/1] ... --- lib/fpa/Base/Algorithm.h | 71 ++++-------- lib/fpa/Base/Algorithm.hxx | 92 ++++------------ lib/fpa/Base/Dijkstra.h | 1 + lib/fpa/Base/DijkstraBase.h | 17 ++- lib/fpa/Base/Event.h | 54 +++++++++ lib/fpa/Base/Event.hxx | 61 +++++++++++ lib/fpa/Base/MarksInterface.h | 6 +- lib/fpa/Base/MarksInterface.hxx | 16 +-- lib/fpa/Base/MarksInterfaceWithCollisions.h | 9 +- lib/fpa/Base/MarksInterfaceWithCollisions.hxx | 32 +++--- lib/fpa/Base/Mori.h | 19 ++-- lib/fpa/Base/RegionGrow.h | 23 ++-- lib/fpa/Base/SeedsInterface.h | 103 ++++++++++-------- lib/fpa/Base/SeedsInterface.hxx | 39 +++---- lib/fpa/Base/SingleSeedInterface.h | 97 +++++++++-------- lib/fpa/Base/SingleSeedInterface.hxx | 34 +++--- lib/fpa/Config.h.in | 11 ++ lib/fpa/Image/Algorithm.h | 51 ++++++--- lib/fpa/Image/Algorithm.hxx | 64 +++++------ lib/fpa/Image/DefaultTraits.h | 11 +- lib/fpa/Image/RegionGrow.h | 15 ++- 21 files changed, 452 insertions(+), 374 deletions(-) create mode 100644 lib/fpa/Base/Event.h create mode 100644 lib/fpa/Base/Event.hxx diff --git a/lib/fpa/Base/Algorithm.h b/lib/fpa/Base/Algorithm.h index 785b818..051d61b 100644 --- a/lib/fpa/Base/Algorithm.h +++ b/lib/fpa/Base/Algorithm.h @@ -7,9 +7,8 @@ #define __fpa__Base__Algorithm__h__ #include - +#include #include -#include 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 ); diff --git a/lib/fpa/Base/Algorithm.hxx b/lib/fpa/Base/Algorithm.hxx index 68296be..888dc38 100644 --- a/lib/fpa/Base/Algorithm.hxx +++ b/lib/fpa/Base/Algorithm.hxx @@ -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( ); diff --git a/lib/fpa/Base/Dijkstra.h b/lib/fpa/Base/Dijkstra.h index 11f5538..508b368 100644 --- a/lib/fpa/Base/Dijkstra.h +++ b/lib/fpa/Base/Dijkstra.h @@ -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; diff --git a/lib/fpa/Base/DijkstraBase.h b/lib/fpa/Base/DijkstraBase.h index 4f08eb9..b5f214f 100644 --- a/lib/fpa/Base/DijkstraBase.h +++ b/lib/fpa/Base/DijkstraBase.h @@ -7,8 +7,8 @@ #define __fpa__Base__DijkstraBase__h__ #include - #include +#include #include 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 index 0000000..dc4910d --- /dev/null +++ b/lib/fpa/Base/Event.h @@ -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 + +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 +#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 index 0000000..309bc81 --- /dev/null +++ b/lib/fpa/Base/Event.hxx @@ -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$ diff --git a/lib/fpa/Base/MarksInterface.h b/lib/fpa/Base/MarksInterface.h index 9644457..b4a8423 100644 --- a/lib/fpa/Base/MarksInterface.h +++ b/lib/fpa/Base/MarksInterface.h @@ -6,6 +6,7 @@ #ifndef __fpa__Base__MarksInterface__h__ #define __fpa__Base__MarksInterface__h__ +#include #include 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 ); diff --git a/lib/fpa/Base/MarksInterface.hxx b/lib/fpa/Base/MarksInterface.hxx index cd37eb5..08ad426 100644 --- a/lib/fpa/Base/MarksInterface.hxx +++ b/lib/fpa/Base/MarksInterface.hxx @@ -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 ); diff --git a/lib/fpa/Base/MarksInterfaceWithCollisions.h b/lib/fpa/Base/MarksInterfaceWithCollisions.h index 3d6f10e..767882a 100644 --- a/lib/fpa/Base/MarksInterfaceWithCollisions.h +++ b/lib/fpa/Base/MarksInterfaceWithCollisions.h @@ -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; diff --git a/lib/fpa/Base/MarksInterfaceWithCollisions.hxx b/lib/fpa/Base/MarksInterfaceWithCollisions.hxx index 1230931..b7fd33f 100644 --- a/lib/fpa/Base/MarksInterfaceWithCollisions.hxx +++ b/lib/fpa/Base/MarksInterfaceWithCollisions.hxx @@ -9,32 +9,32 @@ #include // ------------------------------------------------------------------------- -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 ); diff --git a/lib/fpa/Base/Mori.h b/lib/fpa/Base/Mori.h index 27f6915..e7ea726 100644 --- a/lib/fpa/Base/Mori.h +++ b/lib/fpa/Base/Mori.h @@ -10,8 +10,8 @@ #include #include #include - #include +#include #include 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; diff --git a/lib/fpa/Base/RegionGrow.h b/lib/fpa/Base/RegionGrow.h index 8d7439f..7147944 100644 --- a/lib/fpa/Base/RegionGrow.h +++ b/lib/fpa/Base/RegionGrow.h @@ -7,7 +7,7 @@ #define __fpa__Base__RegionGrow__h__ #include - +#include #include #include @@ -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: diff --git a/lib/fpa/Base/SeedsInterface.h b/lib/fpa/Base/SeedsInterface.h index 61860cc..8162675 100644 --- a/lib/fpa/Base/SeedsInterface.h +++ b/lib/fpa/Base/SeedsInterface.h @@ -6,70 +6,79 @@ #ifndef __fpa__Base__SeedsInterface__h__ #define __fpa__Base__SeedsInterface__h__ -#include -#include -#include - +#include #include #include +/* TODO + #include + #include + #include +*/ + 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; diff --git a/lib/fpa/Base/SeedsInterface.hxx b/lib/fpa/Base/SeedsInterface.hxx index 5bfd16a..77b1600 100644 --- a/lib/fpa/Base/SeedsInterface.hxx +++ b/lib/fpa/Base/SeedsInterface.hxx @@ -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( ); diff --git a/lib/fpa/Base/SingleSeedInterface.h b/lib/fpa/Base/SingleSeedInterface.h index 0b2147b..807d8d0 100644 --- a/lib/fpa/Base/SingleSeedInterface.h +++ b/lib/fpa/Base/SingleSeedInterface.h @@ -6,10 +6,7 @@ #ifndef __fpa__Base__SingleSeedInterface__h__ #define __fpa__Base__SingleSeedInterface__h__ -#include -#include -#include - +#include #include #include @@ -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; diff --git a/lib/fpa/Base/SingleSeedInterface.hxx b/lib/fpa/Base/SingleSeedInterface.hxx index c669618..63cc629 100644 --- a/lib/fpa/Base/SingleSeedInterface.hxx +++ b/lib/fpa/Base/SingleSeedInterface.hxx @@ -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( ); diff --git a/lib/fpa/Config.h.in b/lib/fpa/Config.h.in index 708dec1..e1cd318 100644 --- a/lib/fpa/Config.h.in +++ b/lib/fpa/Config.h.in @@ -20,6 +20,17 @@ # 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$ diff --git a/lib/fpa/Image/Algorithm.h b/lib/fpa/Image/Algorithm.h index 1c84a72..6bed9ad 100644 --- a/lib/fpa/Image/Algorithm.h +++ b/lib/fpa/Image/Algorithm.h @@ -8,7 +8,6 @@ #include #include - #include 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 ); diff --git a/lib/fpa/Image/Algorithm.hxx b/lib/fpa/Image/Algorithm.hxx index 43ebeb0..744aafa 100644 --- a/lib/fpa/Image/Algorithm.hxx +++ b/lib/fpa/Image/Algorithm.hxx @@ -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 ) ); diff --git a/lib/fpa/Image/DefaultTraits.h b/lib/fpa/Image/DefaultTraits.h index c2b8295..9ce95eb 100644 --- a/lib/fpa/Image/DefaultTraits.h +++ b/lib/fpa/Image/DefaultTraits.h @@ -10,9 +10,6 @@ #include #include -#include -#include - 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: diff --git a/lib/fpa/Image/RegionGrow.h b/lib/fpa/Image/RegionGrow.h index 4d190dc..3797b23 100644 --- a/lib/fpa/Image/RegionGrow.h +++ b/lib/fpa/Image/RegionGrow.h @@ -6,32 +6,39 @@ #ifndef __fpa__Image__RegionGrow__h__ #define __fpa__Image__RegionGrow__h__ +#include #include +#include #include #include + 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 ); -- 2.45.1