X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FMarksInterfaceWithCollisions.hxx;fp=lib%2Ffpa%2FBase%2FMarksInterfaceWithCollisions.hxx;h=0000000000000000000000000000000000000000;hb=3c639e5da479c7216a0a302ffa156ac6762caeed;hp=12309317bb63389ab4c445593e59095a5559e49b;hpb=5bf766068f54d061d3816f4950a076c3cf3a4d8b;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/MarksInterfaceWithCollisions.hxx b/lib/fpa/Base/MarksInterfaceWithCollisions.hxx deleted file mode 100644 index 1230931..0000000 --- a/lib/fpa/Base/MarksInterfaceWithCollisions.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// ========================================================================= -// @author Leonardo Florez Valencia -// @email florez-l@javeriana.edu.co -// ========================================================================= - -#ifndef __fpa__Base__MarksInterfaceWithCollisions__hxx__ -#define __fpa__Base__MarksInterfaceWithCollisions__hxx__ - -#include - -// ------------------------------------------------------------------------- -template< class _TVertex > -bool fpa::Base::MarksInterfaceWithCollisions< _TVertex >:: -StopAtOneFront( ) const -{ - return( this->m_StopAtOneFront ); -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -void fpa::Base::MarksInterfaceWithCollisions< _TVertex >:: -StopAtOneFrontOn( ) -{ - this->SetStopAtOneFront( true ); -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -void fpa::Base::MarksInterfaceWithCollisions< _TVertex >:: -StopAtOneFrontOff( ) -{ - this->SetStopAtOneFront( false ); -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -void fpa::Base::MarksInterfaceWithCollisions< _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::MarksInterfaceWithCollisions< _TVertex >:: -MarksInterfaceWithCollisions( itk::ProcessObject* filter ) - : Superclass( filter ), - m_StopAtOneFront( false ), - m_NumberOfFronts( 0 ) -{ -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -fpa::Base::MarksInterfaceWithCollisions< _TVertex >:: -~MarksInterfaceWithCollisions( ) -{ -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -void fpa::Base::MarksInterfaceWithCollisions< _TVertex >:: -_InitMarks( unsigned long nSeeds ) -{ - this->Superclass::_InitMarks( nSeeds ); - this->m_NumberOfFronts = nSeeds; - TCollision coll( TVertex( ), false ); - TCollisionsRow row( this->m_NumberOfFronts, coll ); - this->m_Collisions.clear( ); - this->m_Collisions.resize( this->m_NumberOfFronts, row ); -} - -// ------------------------------------------------------------------------- -template< class _TVertex > -bool fpa::Base::MarksInterfaceWithCollisions< _TVertex >:: -_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( false ); - - // 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_StopAtOneFront && - this->m_NumberOfSeeds > 1 && - this->m_NumberOfFronts == 1 - ); -} - -#endif // __fpa__Base__MarksInterfaceWithCollisions__hxx__ - -// eof - $RCSfile$