2 #include <cpPlugins/Interface/Plugins.h>
4 int main( int argc, char* argv[] )
10 << "Usage: " << argv[ 0 ]
11 << " image_file(s) output_file" << std::endl;
16 // Create interface and load library
17 cpPlugins::Interface::Plugins::Pointer interface =
18 cpPlugins::Interface::Plugins::New( );
21 interface->LoadEnvironments( );
22 interface->GuessPlugins( );
24 catch( std::exception& err )
26 std::cerr << "Error caught: " << err.what( ) << std::endl;
32 auto reader = interface->CreateProcessObject( "IO", "ImageReader" );
33 auto writer = interface->CreateProcessObject( "IO", "ImageWriter" );
34 if( reader.IsNull( ) )
37 << "Error caugh: Could not create a valid image reader."
42 if( writer.IsNull( ) )
45 << "Error caugh: Could not create a valid image writer."
52 reader->PrintExecutionOn( );
53 auto parameters = reader->GetParameters( );
54 for( int i = 1; i < argc - 1; ++i )
55 parameters->AddToOpenFileNameList( "FileNames", argv[ i ] );
58 writer->PrintExecutionOn( );
59 parameters = writer->GetParameters( );
60 parameters->SetSaveFileName( "FileName", argv[ argc - 1 ] );
63 writer->SetInput( "Input", reader->GetOutput( "Output" ) );
70 catch( std::exception& err )
72 std::cerr << "Error caugth: " << err.what( ) << std::endl;