5 #include <cpPlugins/Interface/Interface.h>
6 #include <cpPlugins/Interface/ProcessObject.h>
7 #include <cpPlugins/Interface/Image.h>
9 // -------------------------------------------------------------------------
10 typedef cpPlugins::Interface::Interface TInterface;
11 typedef cpPlugins::Interface::ProcessObject TProcessObject;
12 typedef cpPlugins::Interface::DataObject TDataObject;
13 typedef cpPlugins::Interface::Parameters TParameters;
14 typedef TInterface::TClasses TClasses;
16 // -------------------------------------------------------------------------
17 int main( int argc, char* argv[] )
22 << "Usage: " << argv[ 0 ]
24 << " input_image output_image" << std::endl;
31 if( !plugins.Load( argv[ 1 ] ) )
33 std::cerr << "Failed to load plugins." << std::endl;
39 TProcessObject::Pointer reader, writer;
40 reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
41 writer = plugins.CreateProcessObject( "cpPlugins::IO::ImageWriter" );
42 if( reader.IsNull( ) || writer.IsNull( ) )
45 << "No suitable reader found in plugins." << std::endl
46 << "Reader: " << reader.GetPointer( ) << std::endl
47 << "Writer: " << writer.GetPointer( ) << std::endl
54 TParameters reader_params = reader->GetDefaultParameters( );
55 for( int i = 2; i < argc - 1; ++i )
56 reader_params.AddValueToStringList( "FileNames", argv[ i ] );
57 reader->SetParameters( reader_params );
60 TParameters writer_params = writer->GetDefaultParameters( );
61 writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
62 writer->SetParameters( writer_params );
65 writer->SetInput( 0, reader->GetOutput< TDataObject >( 0 ) );
68 std::string err = writer->Update( );
71 std::cerr << "ERROR: " << err << std::endl;