]> Creatis software - cpPlugins.git/blobdiff - appli/plugins/ExecutePipeline.cxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / appli / plugins / ExecutePipeline.cxx
index a842d8db759c8c26fb93371d9d5c470c0f1db0c6..ccab93186da172f76e6d7ba29e0dde24bd9f8c9e 100644 (file)
@@ -1,4 +1,5 @@
 #include <iostream>
+#include <cpPlugins/Utility.h>
 #include <cpPlugins/Interface/Plugins.h>
 #include <cpPlugins/Interface/Workspace.h>
 
@@ -19,9 +20,7 @@ int main( int argc, char* argv[] )
     cpPlugins::Interface::Plugins::New( );
   try
   {
-    interface->AddEnvironments( "." );
-    interface->LoadPaths( "." );
-    interface->LoadEnvironments( );
+    interface->GuessEnvironment( "." );
     interface->GuessPlugins( );
   }
   catch( std::exception& err )
@@ -46,11 +45,40 @@ int main( int argc, char* argv[] )
     return( 1 );
 
   } // yrt
+    
+  // Read parameters
+  for( int i = 2; i < argc; ++i )
+  {
+    std::vector< std::string > tokens;
+    cpPlugins::Tokenize( tokens, argv[ i ], "@=" );
+    if( tokens.size( ) == 3 )
+    {
+      auto filter = workspace->GetFilter( tokens[ 1 ] );
+      if( filter != NULL )
+      {
+        auto params = filter->GetParameters( );
+        params->SetString( tokens[ 0 ], tokens[ 2 ], true );
+
+      } // fi
+
+    } // fi
+
+  } // rof
 
   // Execute filter
   workspace->PrintExecutionOn( );
-  workspace->Execute( );
+  try
+  {
+    workspace->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << std::endl << "********************************" << std::endl;
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    std::cerr << "********************************" << std::endl;
+    return( 1 );
 
+  } // yrt
   return( 0 );
 }