--- /dev/null
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+
+int main( int argc, char* argv[] )
+{
+ if( argc < 5 )
+ {
+ std::cerr
+ << "Usage: " << argv[ 0 ]
+ << " plugins_file"
+ << " input_image value output_mesh" << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Create interface
+ typedef cpPlugins::Interface::Interface TInterface;
+ typedef TInterface::TClasses TClasses;
+ TInterface plugins;
+ if( !plugins.Load( argv[ 1 ] ) )
+ {
+ std::cerr << "Failed to load plugins." << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Create objects
+ typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::Parameters TParameters;
+ cpPlugins::Interface::ProcessObject::Pointer reader, writer, mc;
+ reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+ writer = plugins.CreateProcessObject( "cpPlugins::MeshWriter" );
+ mc = plugins.CreateProcessObject( "cpPlugins::MarchingCubes" );
+ if( reader.IsNull( ) || writer.IsNull( ) || mc.IsNull( ) )
+ {
+ std::cerr << "No suitable objects found in plugins." << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Configure reader
+ TParameters reader_params = reader->GetDefaultParameters( );
+ for( int i = 2; i < argc - 2; ++i )
+ reader_params.AddValueToStringList( "FileNames", argv[ i ] );
+ reader->SetParameters( reader_params );
+
+ // Configure marching cubes
+ TParameters mc_params = mc->GetDefaultParameters( );
+ mc_params.AddValueToRealList( "Thresholds", std::atof( argv[ argc - 2 ] ) );
+ mc->SetParameters( mc_params );
+
+ // Configure writer
+ TParameters writer_params = writer->GetDefaultParameters( );
+ writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
+ writer->SetParameters( writer_params );
+
+ // Connect pipeline
+ mc->SetInput( 0, reader->GetOutput( 0 ) );
+ writer->SetInput( 0, mc->GetOutput( 0 ) );
+
+ // Execute pipeline
+ std::string err = writer->Update( );
+ if( err != "" )
+ {
+ std::cerr << "ERROR: " << err << std::endl;
+ return( 1 );
+
+ } // fi
+ return( 0 );
+}
+
+// eof - $RCSfile$