+// -------------------------------------------------------------------------
+namespace CTBronchi
+{
+ template< class _TInputPtr, class _TOutputPtr, class _TInputValue >
+ void Label(
+ _TOutputPtr& output,
+ const _TInputPtr& input, const _TOutputPtr& input_labels,
+ const _TInputValue& last_thr,
+ std::map< std::string, std::string >& args
+ )
+ {
+ typedef typename _TInputPtr::ObjectType _TInput;
+ typedef typename _TOutputPtr::ObjectType _TOutput;
+ typedef CTBronchi::MoriLabelling< _TInput, _TOutput > _TLabelling;
+
+ typename _TLabelling::Pointer labelling = _TLabelling::New( );
+ labelling->SetInput( input );
+ labelling->SetInputLabels( input_labels );
+ labelling->SetOutsideValue( 2 );
+ labelling->SetInsideValue( 1 );
+ labelling->SetUpperThreshold(
+ _TInputValue( std::atof( args[ "labelling_upper_threshold" ].c_str( ) ) )
+ );
+ labelling->SetLastThreshold( last_thr );
+ double t = MeasureTime( labelling );
+ std::cout << "Labelling executed in " << t << " s" << std::endl;
+ output = labelling->GetOutput( );
+ std::map< std::string, std::string >::const_iterator i =
+ args.find( "out_labels" );
+ if( i != args.end( ) )
+ WriteImage( output, i->second );
+ output->DisconnectPipeline( );
+ }
+
+} // ecapseman
+