X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FCTBronchi%2FRandomWalker.h;fp=appli%2FCTBronchi%2FRandomWalker.h;h=0edb26d49e702a57847b2ac0e0310ee5fc983187;hb=b4c7827278cd914c18ee5404fb636c87e8099b24;hp=0000000000000000000000000000000000000000;hpb=b69a5d04d117c1fdd297999c4fb034db54911aca;p=FrontAlgorithms.git diff --git a/appli/CTBronchi/RandomWalker.h b/appli/CTBronchi/RandomWalker.h new file mode 100644 index 0000000..0edb26d --- /dev/null +++ b/appli/CTBronchi/RandomWalker.h @@ -0,0 +1,48 @@ +// ========================================================================= +// @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 _TOutputPtr, class _TLabelPtr > + void RandomWalker( + _TOutputPtr& output, + const _TInputPtr& input, const _TLabelPtr& labels, + std::map< std::string, std::string >& args + ) + { + typedef typename _TInputPtr::ObjectType _TInput; + typedef typename _TOutputPtr::ObjectType _TOutput; + typedef typename _TLabelPtr::ObjectType _TLabel; + typedef typename _TOutput::PixelType _TOutputPixel; + typedef fpa::Filters::Image::RandomWalker< _TInput, _TLabel, _TOutputPixel > _TRandomWalker; + typedef fpa::Functors::Dijkstra::Image::Gaussian< _TInput, _TOutputPixel > _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->GetOutput( ); + output->DisconnectPipeline( ); + } + +} // ecapseman + +#endif // __CTBronchi__Functions__h__ + +// eof - $RCSfile$