// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __CTBronchi__RandomWalker__h__ #define __CTBronchi__RandomWalker__h__ #include #include #include #include namespace CTBronchi { // ----------------------------------------------------------------------- template< class _TInputPtr, class _TLabelPtr > void RandomWalker( _TLabelPtr& output, const _TInputPtr& input, const _TLabelPtr& labels, std::map< std::string, std::string >& args ) { typedef typename _TInputPtr::ObjectType _TInput; typedef typename _TLabelPtr::ObjectType _TLabel; typedef float _TScalar; typedef fpa::Filters::Image::RandomWalker< _TInput, _TLabel, _TScalar > _TRandomWalker; typedef fpa::Functors::Dijkstra::Image::Gaussian< _TInput, _TScalar > _TWeight; typename _TWeight::Pointer weight = _TWeight::New( ); weight->SetAlpha( std::atof( args[ "random_walker_alpha" ].c_str( ) ) ); weight->SetBeta( std::atof( args[ "random_walker_beta" ].c_str( ) ) ); typename _TRandomWalker::Pointer rw = _TRandomWalker::New( ); rw->SetInputImage( input ); rw->SetInputLabels( labels ); rw->SetWeightFunction( weight ); double t = CTBronchi::MeasureTime( rw ); std::cout << "RandomWalker executed in " << t << " s" << std::endl; output = rw->GetOutputLabels( ); output->DisconnectPipeline( ); } } // ecapseman #endif // __CTBronchi__Functions__h__ // eof - $RCSfile$