1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __CTBronchi__RandomWalker__h__
6 #define __CTBronchi__RandomWalker__h__
9 #include <CTBronchi/Functions.h>
10 #include <fpa/Filters/Image/RandomWalker.h>
11 #include <fpa/Functors/Dijkstra/Image/Gaussian.h>
15 // -----------------------------------------------------------------------
16 template< class _TInputPtr, class _TOutputPtr, class _TLabelPtr >
19 const _TInputPtr& input, const _TLabelPtr& labels,
20 std::map< std::string, std::string >& args
23 typedef typename _TInputPtr::ObjectType _TInput;
24 typedef typename _TOutputPtr::ObjectType _TOutput;
25 typedef typename _TLabelPtr::ObjectType _TLabel;
26 typedef typename _TOutput::PixelType _TOutputPixel;
27 typedef fpa::Filters::Image::RandomWalker< _TInput, _TLabel, _TOutputPixel > _TRandomWalker;
28 typedef fpa::Functors::Dijkstra::Image::Gaussian< _TInput, _TOutputPixel > _TWeight;
30 typename _TWeight::Pointer weight = _TWeight::New( );
31 weight->SetAlpha( std::atof( args[ "random_walker_alpha" ].c_str( ) ) );
32 weight->SetBeta( std::atof( args[ "random_walker_beta" ].c_str( ) ) );
34 typename _TRandomWalker::Pointer rw = _TRandomWalker::New( );
35 rw->SetInputImage( input );
36 rw->SetInputLabels( labels );
37 rw->SetWeightFunction( weight );
38 double t = CTBronchi::MeasureTime( rw );
39 std::cout << "RandomWalker executed in " << t << " s" << std::endl;
40 output = rw->GetOutput( );
41 output->DisconnectPipeline( );
46 #endif // __CTBronchi__Functions__h__