X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fexamples%2FComplexAppend.cxx;fp=appli%2Fexamples%2FComplexAppend.cxx;h=bae98740bda59df5e8764ed212f1d5cf11e0e8db;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=0000000000000000000000000000000000000000;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/appli/examples/ComplexAppend.cxx b/appli/examples/ComplexAppend.cxx new file mode 100644 index 0000000..bae9874 --- /dev/null +++ b/appli/examples/ComplexAppend.cxx @@ -0,0 +1,88 @@ +// ========================================================================= +// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) +// ========================================================================= + +#include +#include +#include + +int main( int argc, char* argv[] ) +{ + if( argc != 7 ) + { + std::cerr << "Usage: " << argv[ 0 ] << " input output" << std::endl; + return( 1 ); + } // end if + + try + { + typedef cpPlugins::Pipeline TPipeline; + + TPipeline::SharedPtr pipeline = TPipeline::New( ); + + cpPlugins::Filter* r1 = + pipeline->CreateNode( "cpPluginsBase::RawFileReader", "r1" )-> + Cast< cpPlugins::Filter >( ); + + cpPlugins::Filter* r2 = + pipeline->CreateNode( "cpPluginsBase::RawFileReader", "r2" )-> + Cast< cpPlugins::Filter >( ); + + cpPlugins::Filter* r3 = + pipeline->CreateNode( "cpPluginsBase::RawFileReader", "r3" )-> + Cast< cpPlugins::Filter >( ); + + cpPlugins::Filter* r4 = + pipeline->CreateNode( "cpPluginsBase::RawFileReader", "r4" )-> + Cast< cpPlugins::Filter >( ); + + cpPlugins::Filter* r5 = + pipeline->CreateNode( "cpPluginsBase::RawFileReader", "r5" )-> + Cast< cpPlugins::Filter >( ); + + cpPlugins::Filter* a1 = + pipeline->CreateNode( "cpPluginsBase::AppendRawDataFilter", "a1" )-> + Cast< cpPlugins::Filter >( ); + + cpPlugins::Filter* a2 = + pipeline->CreateNode( "cpPluginsBase::AppendRawDataFilter", "a2" )-> + Cast< cpPlugins::Filter >( ); + + cpPlugins::Filter* a3 = + pipeline->CreateNode( "cpPluginsBase::AppendRawDataFilter", "a3" )-> + Cast< cpPlugins::Filter >( ); + + cpPlugins::Filter* w = + pipeline->CreateNode( "cpPluginsBase::RawFileWriter", "w" )-> + Cast< cpPlugins::Filter >( ); + + a1->SetInput( "Input", r1->GetOutput( "Output" ) ); + a1->SetInput( "Input", r2->GetOutput( "Output" ) ); + + a2->SetInput( "Input", a1->GetOutput( "Output" ) ); + a2->SetInput( "Input", r3->GetOutput( "Output" ) ); + a2->SetInput( "Input", r4->GetOutput( "Output" ) ); + + a3->SetInput( "Input", a2->GetOutput( "Output" ) ); + a3->SetInput( "Input", r5->GetOutput( "Output" ) ); + + w->SetInput( "Input", a3->GetOutput( "Output" ) ); + + r1->SetInValue( "FileName", std::string( argv[ 1 ] ) ); + r2->SetInValue( "FileName", std::string( argv[ 2 ] ) ); + r3->SetInValue( "FileName", std::string( argv[ 3 ] ) ); + r4->SetInValue( "FileName", std::string( argv[ 4 ] ) ); + r5->SetInValue( "FileName", std::string( argv[ 5 ] ) ); + w->SetInValue( "FileName", std::string( argv[ 6 ] ) ); + + w->Update( ); + } + catch( std::exception& err ) + { + std::cerr << "ERROR CAUGHT: " << err.what( ) << std::endl; + return( 1 ); + } // end try + return( 0 ); +} + +// eof - $RCSfile$