X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fexamples%2Fexample_ReadWriteImage.cxx;h=b051277e30cad06e532e62495f19a39c56153899;hb=3633aade338a13bc83642e99e6d61b6499e4b3af;hp=8c562a96dcb0ea9aebcc94faea5b9c11a6d6c9c8;hpb=9015cf98c60cf4ab304a639990004ee783a8bec0;p=cpPlugins.git diff --git a/appli/examples/example_ReadWriteImage.cxx b/appli/examples/example_ReadWriteImage.cxx index 8c562a9..b051277 100644 --- a/appli/examples/example_ReadWriteImage.cxx +++ b/appli/examples/example_ReadWriteImage.cxx @@ -4,7 +4,16 @@ #include #include +#include +// ------------------------------------------------------------------------- +typedef cpPlugins::Interface::Interface TInterface; +typedef cpPlugins::Interface::ProcessObject TProcessObject; +typedef cpPlugins::Interface::DataObject TDataObject; +typedef cpPlugins::Interface::Parameters TParameters; +typedef TInterface::TClasses TClasses; + +// ------------------------------------------------------------------------- int main( int argc, char* argv[] ) { if( argc < 4 ) @@ -18,8 +27,6 @@ int main( int argc, char* argv[] ) } // fi // Create interface - typedef cpPlugins::Interface::Interface TInterface; - typedef TInterface::TClasses TClasses; TInterface plugins; if( !plugins.Load( argv[ 1 ] ) ) { @@ -29,20 +36,16 @@ int main( int argc, char* argv[] ) } // fi // Create objects - typedef cpPlugins::Interface::ProcessObject TProcessObject; - typedef cpPlugins::Interface::Parameters TParameters; - cpPlugins::Interface::ProcessObject::Pointer reader, writer; - reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" ); - if( reader.IsNull( ) ) + TProcessObject::Pointer reader, writer; + reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" ); + writer = plugins.CreateProcessObject( "cpPlugins::IO::ImageWriter" ); + if( reader.IsNull( ) || writer.IsNull( ) ) { - std::cerr << "No suitable reader found in plugins." << std::endl; - return( 1 ); - - } // fi - writer = plugins.CreateProcessObject( "cpPlugins::ImageWriter" ); - if( writer.IsNull( ) ) - { - std::cerr << "No suitable writer found in plugins." << std::endl; + std::cerr + << "No suitable reader found in plugins." << std::endl + << "Reader: " << reader.GetPointer( ) << std::endl + << "Writer: " << writer.GetPointer( ) << std::endl + << std::endl; return( 1 ); } // fi @@ -59,7 +62,7 @@ int main( int argc, char* argv[] ) writer->SetParameters( writer_params ); // Connect pipeline - writer->SetInput( 0, reader->GetOutput( 0 ) ); + writer->SetInput( 0, reader->GetOutput< TDataObject >( 0 ) ); // Execute pipeline std::string err = writer->Update( ); @@ -69,6 +72,7 @@ int main( int argc, char* argv[] ) return( 1 ); } // fi + return( 0 ); }