X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FMarksInterface.hxx;h=08ad426d8ee8d138ad8ba0c60f3324a1f234ef04;hb=c9542e420b94b0bfc1f285599f7816eab1191519;hp=8f00eb35a37d95a9cc5581dcdd780f6ef23ea919;hpb=e82144a4e9fb907de430c8aca4b92577a81033fb;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/MarksInterface.hxx b/lib/fpa/Base/MarksInterface.hxx index 8f00eb3..08ad426 100644 --- a/lib/fpa/Base/MarksInterface.hxx +++ b/lib/fpa/Base/MarksInterface.hxx @@ -6,122 +6,36 @@ #ifndef __fpa__Base__MarksInterface__hxx__ #define __fpa__Base__MarksInterface__hxx__ -#include - -// ------------------------------------------------------------------------- -template< class _TVertex > -bool fpa::Base::MarksInterface< _TVertex >:: -StopAtOneFront( ) const -{ - return( this->m_StopAtOneFront ); -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -void fpa::Base::MarksInterface< _TVertex >:: -StopAtOneFrontOn( ) -{ - this->SetStopAtOneFront( true ); -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -void fpa::Base::MarksInterface< _TVertex >:: -StopAtOneFrontOff( ) -{ - this->SetStopAtOneFront( false ); -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -void fpa::Base::MarksInterface< _TVertex >:: -SetStopAtOneFront( bool v ) -{ - if( this->m_StopAtOneFront != v ) - { - this->m_StopAtOneFront = v; - if( this->m_Filter != NULL ) - this->m_Filter->Modified( ); - - } // fi -} - // ------------------------------------------------------------------------- -template< class _TVertex > -fpa::Base::MarksInterface< _TVertex >:: +template< class _TTraits > +fpa::Base::MarksInterface< _TTraits >:: MarksInterface( itk::ProcessObject* filter ) - : m_StopAtOneFront( false ), - m_NumberOfFronts( 0 ), - m_NumberOfSeeds( 0 ), + : 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_NumberOfFronts = this->m_NumberOfSeeds = nSeeds; - TCollision coll( TVertex( ), false ); - TCollisionsRow row( this->m_NumberOfFronts, coll ); - this->m_Collisions.clear( ); - this->m_Collisions.resize( this->m_NumberOfFronts, row ); + this->m_NumberOfSeeds = nSeeds; } // ------------------------------------------------------------------------- -template< class _TVertex > -unsigned long fpa::Base::MarksInterface< _TVertex >:: +template< class _TTraits > +bool fpa::Base::MarksInterface< _TTraits >:: _Collisions( const TVertex& a, const TVertex& b ) { - unsigned long ma = this->_GetMark( a ); - unsigned long mb = this->_GetMark( b ); - if( ma == mb || ma == 0 || mb == 0 ) - return( this->m_NumberOfFronts ); - - // Mark collision, if it is new - ma--; mb--; - bool ret = false; - bool exists = this->m_Collisions[ ma ][ mb ].second; - exists &= this->m_Collisions[ mb ][ ma ].second; - if( !exists ) - { - this->m_Collisions[ ma ][ mb ].first = a; - this->m_Collisions[ ma ][ mb ].second = true; - this->m_Collisions[ mb ][ ma ].first = b; - this->m_Collisions[ mb ][ ma ].second = true; - - // Update number of fronts - unsigned long count = 0; - std::vector< bool > m( this->m_NumberOfSeeds, false ); - std::queue< unsigned long > q; - q.push( 0 ); - while( !q.empty( ) ) - { - unsigned long f = q.front( ); - q.pop( ); - - if( m[ f ] ) - continue; - m[ f ] = true; - count++; - - for( unsigned int n = 0; n < this->m_NumberOfSeeds; ++n ) - if( this->m_Collisions[ f ][ n ].second && !m[ n ] ) - q.push( n ); - - } // elihw - this->m_NumberOfFronts = this->m_NumberOfSeeds - count + 1; - - } // fi - return( this->m_NumberOfFronts ); + return( false ); } #endif // __fpa__Base__MarksInterface__hxx__