X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FFilters%2FImage%2FRandomWalker.hxx;h=12543a3e6e7439ba7e8575f8efb848d69c07c5f4;hb=b6c80dbd5be1caf6cbdbfc21d2075021c57d7af2;hp=ef858b597acf65d177a826b7b1a678dd9d9b9d12;hpb=03200c96631e0c6e35b5be9c78d651185efcbdf2;p=FrontAlgorithms.git diff --git a/lib/fpa/Filters/Image/RandomWalker.hxx b/lib/fpa/Filters/Image/RandomWalker.hxx index ef858b5..12543a3 100644 --- a/lib/fpa/Filters/Image/RandomWalker.hxx +++ b/lib/fpa/Filters/Image/RandomWalker.hxx @@ -5,8 +5,6 @@ #ifndef __fpa__Filters__Image__RandomWalker__hxx__ #define __fpa__Filters__Image__RandomWalker__hxx__ -#include - // ------------------------------------------------------------------------- template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits > typename @@ -88,7 +86,6 @@ fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _T RandomWalker( ) : Superclass( ) { - fpaFilterInputConfigureMacro( InputLabels, TInputLabels ); } // ------------------------------------------------------------------------- @@ -98,69 +95,5 @@ fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _T { } -// ------------------------------------------------------------------------- -template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits > -const itk::DataObject* -fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >:: -_GetReferenceInput( ) const -{ - return( this->GetInputLabels( ) ); -} - -// ------------------------------------------------------------------------- -template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits > -void -fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >:: -_PrepareSeeds( const itk::DataObject* input ) -{ - // Input object is a labelled image? - const TInputLabels* labels = dynamic_cast< const TInputLabels* >( input ); - if( labels != NULL ) - { - this->m_UnifiedSeeds.clear( ); - - // Iterate over labels - typedef itk::ImageRegionConstIteratorWithIndex< TInputLabels > _TIt; - typename TInputLabels::RegionType reg = labels->GetRequestedRegion( ); - _TIt lIt( labels, reg ); - for( lIt.GoToBegin( ); !lIt.IsAtEnd( ); ++lIt ) - { - if( lIt.Get( ) > 0 ) - { - bool is_seed = false; - for( unsigned int d = 0; d < Self::Dimension; ++d ) - { - for( int s = -1; s <= 1; s += 2 ) - { - TVertex neigh = lIt.GetIndex( ); - neigh[ d ] += s; - if( reg.IsInside( neigh ) ) - is_seed |= ( labels->GetPixel( neigh ) == 0 ); - - } // rof - - } // rof - - // Add pixel as seed or already marked - TNode node; - node.Vertex = lIt.GetIndex( ); - node.Parent = lIt.GetIndex( ); - node.FrontId = lIt.Get( ); - node.Value = TOutputValue( 0 ); - if( !is_seed ) - { - this->_Mark( node.Vertex, node.FrontId ); - this->_UpdateOutputValue( node ); - } - else - this->m_UnifiedSeeds.insert( node ); - - } // fi - - } // rof - - } // fi -} - #endif // __fpa__Filters__Image__RandomWalker__hxx__ // eof - $RCSfile$