From 75a965968c4234c08e1ad1700ee5bc8da6362eba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Wed, 9 Aug 2017 15:11:58 -0500 Subject: [PATCH] ... --- lib/fpa/Base/SeedsInterface.h | 51 +---------------- lib/fpa/Base/SingleSeedInterface.h | 45 +-------------- lib/fpa/Config.h.in | 9 ++- lib/fpa/Image/DefaultTraits.h | 42 ++++++++++++-- lib/fpa/Image/Dijkstra.h | 16 +++--- lib/fpa/Image/Dijkstra.hxx | 16 +++--- lib/fpa/Image/LabelledSeedsInterface.h | 21 ++----- lib/fpa/Image/LabelledSeedsInterface.hxx | 30 +++++----- lib/fpa/Image/Mori.h | 47 ++-------------- lib/fpa/Image/Mori.hxx | 24 ++++---- lib/fpa/Image/RandomWalker.h | 70 ++++-------------------- lib/fpa/Image/RandomWalker.hxx | 22 ++++---- lib/fpa/Image/RegionGrow.h | 1 - 13 files changed, 121 insertions(+), 273 deletions(-) diff --git a/lib/fpa/Base/SeedsInterface.h b/lib/fpa/Base/SeedsInterface.h index 8162675..d556f3a 100644 --- a/lib/fpa/Base/SeedsInterface.h +++ b/lib/fpa/Base/SeedsInterface.h @@ -10,12 +10,6 @@ #include #include -/* TODO - #include - #include - #include -*/ - namespace fpa { namespace Base @@ -30,53 +24,10 @@ namespace fpa 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 > ) + ( itk::Concept::IsUnsignedInteger< TFrontId > ) ); public: diff --git a/lib/fpa/Base/SingleSeedInterface.h b/lib/fpa/Base/SingleSeedInterface.h index 807d8d0..0295032 100644 --- a/lib/fpa/Base/SingleSeedInterface.h +++ b/lib/fpa/Base/SingleSeedInterface.h @@ -24,53 +24,10 @@ namespace fpa 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 > ) + ( itk::Concept::IsUnsignedInteger< TFrontId > ) ); public: diff --git a/lib/fpa/Config.h.in b/lib/fpa/Config.h.in index e1cd318..aa7042b 100644 --- a/lib/fpa/Config.h.in +++ b/lib/fpa/Config.h.in @@ -22,14 +22,17 @@ // ------------------------------------------------------------------------- #define fpa_Base_TraitTypes( _traits_ ) \ + typedef _traits_::TEvent TEvent; \ + typedef _traits_::TFrontId TFrontId; \ typedef _traits_::TInputValue TInputValue; \ - typedef _traits_::TOutputValue TOutputValue; \ typedef _traits_::TNeighborhood TNeighborhood; \ typedef _traits_::TNode TNode; \ typedef _traits_::TNodes TNodes; \ + typedef _traits_::TOutputValue TOutputValue; \ + typedef _traits_::TPoint TPoint; \ + typedef _traits_::TSeed TSeed; \ typedef _traits_::TSeeds TSeeds; \ - typedef _traits_::TVertex TVertex; \ - typedef _traits_::TEvent TEvent + typedef _traits_::TVertex TVertex #endif // __fpa__Config__h__ diff --git a/lib/fpa/Image/DefaultTraits.h b/lib/fpa/Image/DefaultTraits.h index 9ce95eb..b56bdec 100644 --- a/lib/fpa/Image/DefaultTraits.h +++ b/lib/fpa/Image/DefaultTraits.h @@ -6,9 +6,10 @@ #ifndef __fpa__Image__DefaultTraits__h__ #define __fpa__Image__DefaultTraits__h__ +#include #include #include -#include +#include namespace fpa { @@ -32,12 +33,41 @@ namespace fpa typedef typename TOutputImage::PixelType TOutputValue; typedef typename TVertex::LexicographicCompare TCompare; - typedef std::vector< TVertex > TNeighborhood; + typedef fpa::Base::Event< TVertex > TEvent; + typedef std::vector< TVertex > TNeighborhood; - typedef typename TSeedsInterface::TNode TNode; - typedef typename TSeedsInterface::TNodes TNodes; - typedef typename TSeedsInterface::TSeed TSeed; - typedef typename TSeedsInterface::TSeeds TSeeds; + 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( diff --git a/lib/fpa/Image/Dijkstra.h b/lib/fpa/Image/Dijkstra.h index 24c0643..4262f7f 100644 --- a/lib/fpa/Image/Dijkstra.h +++ b/lib/fpa/Image/Dijkstra.h @@ -7,6 +7,8 @@ #define __fpa__Image__Dijkstra__h__ #include +#include +#include #include #include #include @@ -18,25 +20,25 @@ namespace fpa { /** */ - 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 Dijkstra - : public fpa::Base::Dijkstra< fpa::Image::Algorithm< fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, _TFrontId > >, fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > > + : public fpa::Base::Dijkstra< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterfaceWithCollisions< _TTraits >, fpa::Base::SeedsInterface< _TTraits > >, fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > > { 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::MinimumSpanningTree< _TInputImage::ImageDimension > TMST; - 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::Dijkstra< TAlgorithm, TMST > Superclass; typedef Dijkstra Self; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; - typedef typename Superclass::TOutputValue TOutputValue; - typedef typename Superclass::TVertex TVertex; + fpa_Base_TraitTypes( typename TTraits ); typedef fpa::Image::Functors::Dijkstra::Function< TInputImage, TOutputValue > TWeightFunction; diff --git a/lib/fpa/Image/Dijkstra.hxx b/lib/fpa/Image/Dijkstra.hxx index b0780de..f3c6a72 100644 --- a/lib/fpa/Image/Dijkstra.hxx +++ b/lib/fpa/Image/Dijkstra.hxx @@ -7,23 +7,23 @@ #define __fpa__Image__Dijkstra__hxx__ // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage, class _TFrontId > -fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >:: +template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits > +fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >:: Dijkstra( ) : Superclass( ) { } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage, class _TFrontId > -fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >:: +template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits > +fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >:: ~Dijkstra( ) { } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage, class _TFrontId > -void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >:: +template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits > +void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >:: _BeforeGenerateData( ) { this->Superclass::_BeforeGenerateData( ); @@ -34,8 +34,8 @@ _BeforeGenerateData( ) } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage, class _TFrontId > -void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId >:: +template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits > +void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >:: _ConfigureOutput( const TOutputValue& v ) { this->Superclass::_ConfigureOutput( v ); diff --git a/lib/fpa/Image/LabelledSeedsInterface.h b/lib/fpa/Image/LabelledSeedsInterface.h index 74ec756..96016c0 100644 --- a/lib/fpa/Image/LabelledSeedsInterface.h +++ b/lib/fpa/Image/LabelledSeedsInterface.h @@ -7,7 +7,6 @@ #define __fpa__Image__LabelledSeedsInterface__h__ #include - #include namespace fpa @@ -16,23 +15,15 @@ namespace fpa { /** */ - template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare = std::greater< _TVertex > > + template< class _TTraits > class LabelledSeedsInterface - : public fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare > + : public fpa::Base::SeedsInterface< _TTraits > { public: - typedef _TVertex TVertex; - typedef _TPoint TPoint; - typedef _TInputValue TInputValue; - typedef _TOutputValue TOutputValue; - typedef _TFrontId TFrontId; - typedef _TCompare TCompare; - typedef LabelledSeedsInterface Self; - typedef fpa::Base::SeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TCompare > Superclass; - - typedef typename Superclass::TNode TNode; - typedef typename Superclass::TNodeCompare TNodeCompare; - typedef typename Superclass::TSeeds TSeeds; + typedef _TTraits TTraits; + typedef LabelledSeedsInterface Self; + typedef fpa::Base::SeedsInterface< TTraits > Superclass; + fpa_Base_TraitTypes( typename TTraits ); typedef itk::Image< TFrontId, TVertex::Dimension > TLabelImage; diff --git a/lib/fpa/Image/LabelledSeedsInterface.hxx b/lib/fpa/Image/LabelledSeedsInterface.hxx index 98cc334..5b184f1 100644 --- a/lib/fpa/Image/LabelledSeedsInterface.hxx +++ b/lib/fpa/Image/LabelledSeedsInterface.hxx @@ -10,9 +10,8 @@ #include // ------------------------------------------------------------------------- -template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare > -void -fpa::Image::LabelledSeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >:: +template< class _TTraits > +void fpa::Image::LabelledSeedsInterface< _TTraits >:: AddSeed( const TVertex& seed ) { std::ostringstream msg; @@ -26,9 +25,8 @@ AddSeed( const TVertex& seed ) } // ------------------------------------------------------------------------- -template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare > -void -fpa::Image::LabelledSeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >:: +template< class _TTraits > +void fpa::Image::LabelledSeedsInterface< _TTraits >:: AddSeed( const TPoint& seed ) { std::ostringstream msg; @@ -42,35 +40,33 @@ AddSeed( const TPoint& seed ) } // ------------------------------------------------------------------------- -template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare > -const typename -fpa::Image::LabelledSeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >:: -TLabelImage* -fpa::Image::LabelledSeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >:: +template< class _TTraits > +const typename fpa::Image::LabelledSeedsInterface< _TTraits >:: +TLabelImage* fpa::Image::LabelledSeedsInterface< _TTraits >:: GetLabels( ) const { return( this->m_LabelImage ); } // ------------------------------------------------------------------------- -template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare > -void fpa::Image::LabelledSeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >:: +template< class _TTraits > +void fpa::Image::LabelledSeedsInterface< _TTraits >:: SetLabels( const TLabelImage* image ) { this->m_LabelImage = image; } // ------------------------------------------------------------------------- -template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare > -fpa::Image::LabelledSeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >:: +template< class _TTraits > +fpa::Image::LabelledSeedsInterface< _TTraits >:: LabelledSeedsInterface( itk::ProcessObject* filter ) : Superclass( filter ) { } // ------------------------------------------------------------------------- -template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare > -fpa::Image::LabelledSeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >:: +template< class _TTraits > +fpa::Image::LabelledSeedsInterface< _TTraits >:: ~LabelledSeedsInterface( ) { } diff --git a/lib/fpa/Image/Mori.h b/lib/fpa/Image/Mori.h index 7e6b0e0..b45db50 100644 --- a/lib/fpa/Image/Mori.h +++ b/lib/fpa/Image/Mori.h @@ -18,52 +18,17 @@ namespace fpa { /** */ - template< class _TInputImage, class _TOutputImage > - class MoriTraits - : public fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, typename _TOutputImage::PixelType > - { - public: - typedef MoriTraits Self; - typedef _TInputImage TInputImage; - typedef _TOutputImage TOutputImage; - typedef typename TOutputImage::PixelType TFrontId; - typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > Superclass; - - typedef typename Superclass::TVertex TVertex; - typedef typename Superclass::TInputValue TInputValue; - typedef typename Superclass::TPoint TPoint; - typedef typename Superclass::TOutputValue TOutputValue; - typedef typename Superclass::TCompare TCompare; - typedef typename Superclass::TNeighborhood TNeighborhood; - typedef typename Superclass::TFilter TFilter; - - typedef fpa::Base::SingleSeedInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TCompare > TSeedsInterface; - typedef fpa::Base::MarksInterface< TVertex > TMarksInterface; - - typedef typename TSeedsInterface::TNode TNode; - typedef typename TSeedsInterface::TNodes TNodes; - typedef typename TSeedsInterface::TSeed TSeed; - typedef typename TSeedsInterface::TSeeds TSeeds; - - private: - // Purposely not implemented. - MoriTraits( ); - MoriTraits( const Self& other ); - virtual ~MoriTraits( ); - Self& operator=( const Self& other ); - }; - - /** - */ - template< class _TInputImage, class _TOutputImage > + template< class _TInputImage, class _TOutputImage, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, typename _TOutputImage::PixelType > > class Mori - : public fpa::Base::Mori< fpa::Image::Algorithm< fpa::Image::MoriTraits< _TInputImage, _TOutputImage > > > + : public fpa::Base::Mori< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterface< _TTraits >, fpa::Base::SingleSeedInterface< _TTraits > > > { public: typedef _TInputImage TInputImage; typedef _TOutputImage TOutputImage; - typedef fpa::Image::MoriTraits< TInputImage, TOutputImage > TTraits; - typedef fpa::Image::Algorithm< TTraits > TAlgorithm; + typedef _TTraits TTraits; + typedef fpa::Base::MarksInterface< _TTraits > TMarksInterface; + typedef fpa::Base::SingleSeedInterface< _TTraits > TSeedsInterface; + typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm; typedef Mori Self; typedef fpa::Base::Mori< TAlgorithm > Superclass; diff --git a/lib/fpa/Image/Mori.hxx b/lib/fpa/Image/Mori.hxx index d33e5ec..4a0589e 100644 --- a/lib/fpa/Image/Mori.hxx +++ b/lib/fpa/Image/Mori.hxx @@ -9,9 +9,9 @@ #include // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage > -typename fpa::Image::Mori< _TInputImage, _TOutputImage >:: -TOutputImage* fpa::Image::Mori< _TInputImage, _TOutputImage >:: +template< class _TInputImage, class _TOutputImage, class _TTraits > +typename fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >:: +TOutputImage* fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >:: GetThresholdedOutput( ) { return( @@ -22,9 +22,9 @@ GetThresholdedOutput( ) } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage > -const typename fpa::Image::Mori< _TInputImage, _TOutputImage >:: -TOutputImage* fpa::Image::Mori< _TInputImage, _TOutputImage >:: +template< class _TInputImage, class _TOutputImage, class _TTraits > +const typename fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >:: +TOutputImage* fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >:: GetThresholdedOutput( ) const { return( @@ -35,8 +35,8 @@ GetThresholdedOutput( ) const } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage > -fpa::Image::Mori< _TInputImage, _TOutputImage >:: +template< class _TInputImage, class _TOutputImage, class _TTraits > +fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >:: Mori( ) : Superclass( ) { @@ -48,15 +48,15 @@ Mori( ) } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage > -fpa::Image::Mori< _TInputImage, _TOutputImage >:: +template< class _TInputImage, class _TOutputImage, class _TTraits > +fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >:: ~Mori( ) { } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TOutputImage > -void fpa::Image::Mori< _TInputImage, _TOutputImage >:: +template< class _TInputImage, class _TOutputImage, class _TTraits > +void fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >:: _AfterGenerateData( ) { typedef itk::BinaryThresholdImageFilter< TMarks, TOutputImage > _TFilter; diff --git a/lib/fpa/Image/RandomWalker.h b/lib/fpa/Image/RandomWalker.h index 98b9492..213eb97 100644 --- a/lib/fpa/Image/RandomWalker.h +++ b/lib/fpa/Image/RandomWalker.h @@ -20,72 +20,26 @@ namespace fpa { /** */ - template< class _TInputImage, class _TLabelImage, class _TScalar > - class RandomWalkerTraits - : public fpa::Image::DefaultTraits< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension >, typename _TLabelImage::PixelType > - { - public: - typedef RandomWalkerTraits Self; - typedef _TInputImage TInputImage; - typedef _TLabelImage TLabelImage; - typedef _TScalar TScalar; - typedef typename _TLabelImage::PixelType TFrontId; - typedef itk::Image< TScalar, _TInputImage::ImageDimension > TOutputImage; - typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > Superclass; - - typedef typename Superclass::TVertex TVertex; - typedef typename Superclass::TInputValue TInputValue; - typedef typename Superclass::TPoint TPoint; - typedef typename Superclass::TOutputValue TOutputValue; - typedef typename Superclass::TCompare TCompare; - typedef typename Superclass::TNeighborhood TNeighborhood; - typedef typename Superclass::TFilter TFilter; - - typedef fpa::Image::LabelledSeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TCompare > TSeedsInterface; - typedef fpa::Base::MarksInterface< TVertex > TMarksInterface; - - typedef typename TSeedsInterface::TNode TNode; - typedef typename TSeedsInterface::TNodes TNodes; - typedef typename TSeedsInterface::TSeed TSeed; - typedef typename TSeedsInterface::TSeeds TSeeds; - - public: - itkConceptMacro( - Check_SameDimension, - ( itk::Concept::SameDimension< TInputImage::ImageDimension, TLabelImage::ImageDimension > ) - ); - - private: - // Purposely not implemented. - RandomWalkerTraits( ); - RandomWalkerTraits( const Self& other ); - virtual ~RandomWalkerTraits( ); - Self& operator=( const Self& other ); - }; - - /** - */ - template< class _TInputImage, class _TLabelImage, class _TScalar > + template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension >, typename _TLabelImage::PixelType > > class RandomWalker - : public fpa::Base::DijkstraBase< fpa::Image::Algorithm< fpa::Image::RandomWalkerTraits< _TInputImage, _TLabelImage, _TScalar > > > + : public fpa::Base::DijkstraBase< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterface< _TTraits >, fpa::Image::LabelledSeedsInterface< _TTraits > > > { public: typedef _TInputImage TInputImage; typedef _TLabelImage TLabelImage; typedef _TScalar TScalar; + typedef _TTraits TTraits; + fpa_Base_TraitTypes( typename TTraits ); - typedef fpa::Image::RandomWalkerTraits< TInputImage, TLabelImage, TScalar > TTraits; - typedef fpa::Image::Algorithm< TTraits > TAlgorithm; - typedef fpa::Base::DijkstraBase< TAlgorithm > Superclass; - typedef RandomWalker Self; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - typedef typename TTraits::TNode TNode; - typedef typename TTraits::TNodes TNodes; - typedef typename TTraits::TSeed TSeed; - typedef typename TTraits::TVertex TVertex; + typedef fpa::Base::MarksInterface< TTraits > TMarksInterface; + typedef fpa::Image::LabelledSeedsInterface< TTraits > TSeedsInterface; + typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm; + typedef fpa::Base::DijkstraBase< TAlgorithm > Superclass; + typedef RandomWalker Self; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + typedef fpa::Image::Functors::Dijkstra::Function< TInputImage, TScalar > TWeightFunction; public: diff --git a/lib/fpa/Image/RandomWalker.hxx b/lib/fpa/Image/RandomWalker.hxx index 6935abf..2e8b46f 100644 --- a/lib/fpa/Image/RandomWalker.hxx +++ b/lib/fpa/Image/RandomWalker.hxx @@ -14,9 +14,9 @@ #include // ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage, class _TScalar > +template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits > itk::ModifiedTimeType -fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar >:: +fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >:: GetMTime( ) const { const TLabelImage* labels = this->GetLabels( ); @@ -31,8 +31,8 @@ GetMTime( ) const } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage, class _TScalar > -fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar >:: +template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits > +fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >:: RandomWalker( ) : Superclass( ) { @@ -41,15 +41,15 @@ RandomWalker( ) } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage, class _TScalar > -fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar >:: +template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits > +fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >:: ~RandomWalker( ) { } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage, class _TScalar > -void fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar >:: +template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits > +void fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >:: _BeforeGenerateData( ) { this->Superclass::_BeforeGenerateData( ); @@ -60,9 +60,9 @@ _BeforeGenerateData( ) } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TLabelImage, class _TScalar > -typename fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar >:: -TNodes fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar >:: +template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits > +typename fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >:: +TNodes fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >:: _UnifySeeds( ) { this->m_Seeds.clear( ); diff --git a/lib/fpa/Image/RegionGrow.h b/lib/fpa/Image/RegionGrow.h index 3797b23..09631cc 100644 --- a/lib/fpa/Image/RegionGrow.h +++ b/lib/fpa/Image/RegionGrow.h @@ -26,7 +26,6 @@ namespace fpa 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; -- 2.47.1