]> Creatis software - cpPlugins.git/commitdiff
This does not compile yet: updating plugins interface and transparency of image actors
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 6 Nov 2015 23:16:56 +0000 (18:16 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 6 Nov 2015 23:16:56 +0000 (18:16 -0500)
19 files changed:
appli/examples/CMakeLists.txt
appli/examples/example_HandleWidget.cxx
appli/examples/example_LoadPlugins.cxx
appli/examples/example_LoadPluginsFromPath.cxx [new file with mode: 0644]
appli/examples/example_ReadWriteImage.cxx
appli/examples/example_SeedWidget.cxx
appli/examples/example_SphereWidget.cxx
appli/examples/example_Test_Memento.cxx
appli/examples/example_View2DImage.cxx
lib/cpPlugins/Interface/Interface.cxx
lib/cpPlugins/Interface/Interface.h
lib/cpPlugins/Interface/Macros.h
lib/cpPlugins/Interface/ParametersQtDialog.cxx
lib/cpPlugins/Interface/Plugins.cxx
lib/cpPlugins/Interface/Plugins.h
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h
lib/third_party/Pluma/PluginManager.cpp
lib/third_party/Pluma/PluginManager.hpp

index 79d2338f00d2db3dd0e5b9c69ddd05a8aca81018..a389ddb70921e2e9db18ceb04e1ae68f42010430 100644 (file)
@@ -16,6 +16,7 @@ SET(
   EXAMPLES_PROGRAMS_ONLY_INTERFACE
   example_TestParameters
   example_LoadPlugins
+  example_LoadPluginsFromPath
   )
 
 FOREACH(prog ${EXAMPLES_PROGRAMS_ONLY_INTERFACE}) 
@@ -25,7 +26,7 @@ ENDFOREACH(prog)
 
 SET(
   EXAMPLES_PROGRAMS_WITH_PLUGINS
-  #example_ReadWriteImage
+  example_ReadWriteImage
   #example_MPR
   example_View2DImage
   example_HandleWidget
@@ -51,7 +52,6 @@ FOREACH(prog ${EXAMPLES_PROGRAMS_WITH_PLUGINS})
     ${prog}
     cpExtensions
     cpPlugins_Interface
-       
     )
 ENDFOREACH(prog)
 
index 69bc3090b447cd7ee0170a962cfbbb40e85f41bf..692186ad253646dc87530847e2842b4e8d837255 100644 (file)
@@ -49,8 +49,8 @@ int main( int argc, char* argv[] )
   } // fi
 
   // Create objects
-  TProcessObject::Pointer reader;
-  reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
+  TProcessObject::Pointer reader =
+    plugins.CreateObject( "cpPlugins::IO::ImageReader" );
   if( reader.IsNull( ) )
   {
     std::cerr
index d090d38318e718f877c5726f5f28ff3affa85d46..b68087cd655cbc3c662d486f44d772903f67a7ed 100644 (file)
@@ -1,8 +1,13 @@
 #include <iostream>
 #include <string>
 
-#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/Plugins.h>
 
+// -------------------------------------------------------------------------
+typedef cpPlugins::Interface::Plugins TPlugins;
+typedef TPlugins::TStringContainer    TStringContainer;
+
+// -------------------------------------------------------------------------
 int main( int argc, char* argv[] )
 {
   if( argc < 2 )
@@ -13,23 +18,25 @@ int main( int argc, char* argv[] )
   } // fi
 
   // Create interface
-  typedef cpPlugins::Interface::Interface TInterface;
-  typedef TInterface::TClasses            TClasses;
+  cpPlugins::Interface::Plugins plugins;
 
-  TInterface plugins;
   for( int i = 1; i < argc; ++i )
-    if( !plugins.Load( argv[ i ] ) )
+    if( !plugins.LoadPlugins( argv[ i ] ) )
       std::cerr
         << "Error loading plugins file \""
         << argv[ i ] << "\""
         << std::endl;
 
-  std::cout << "---------------------------------------------" << std::endl;
-  std::cout << "Loaded classes:" << std::endl;
-  TClasses::const_iterator cIt = plugins.GetClasses( ).begin( );
-  for( ; cIt != plugins.GetClasses( ).end( ); ++cIt )
-    std::cout << "  := " << cIt->first << std::endl;
-  std::cout << "---------------------------------------------" << std::endl;
+  TStringContainer categories;
+  plugins.GetLoadedCategories( categories );
+  for( auto pIt = categories.begin( ); pIt != categories.end( ); ++pIt )
+  {
+    std::cout << "Category: " << *pIt << std::endl;
+    const TStringContainer& filters = plugins.GetLoadedFilters( *pIt );
+    for( auto fIt = filters.begin( ); fIt != filters.end( ); ++fIt )
+      std::cout << "\t" << *fIt << std::endl;
+
+  } // rof
 
   return( 0 );
 }
diff --git a/appli/examples/example_LoadPluginsFromPath.cxx b/appli/examples/example_LoadPluginsFromPath.cxx
new file mode 100644 (file)
index 0000000..3747995
--- /dev/null
@@ -0,0 +1,48 @@
+#include <iostream>
+#include <string>
+
+#include <cpPlugins/Interface/Plugins.h>
+
+// -------------------------------------------------------------------------
+typedef cpPlugins::Interface::Plugins TPlugins;
+typedef TPlugins::TStringContainer    TStringContainer;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  if( argc < 2 )
+  {
+    std::cerr << "Usage: " << argv[ 0 ] << " plugins_file(s)" << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create interface
+  cpPlugins::Interface::Plugins plugins;
+
+  if( !plugins.LoadPluginsPath( argv[ 1 ] ) )
+    std::cerr
+      << "Error loading plugins from folder \""
+      << argv[ 1 ] << "\""
+      << std::endl;
+
+  const TStringContainer& loaded_plugins = plugins.GetLoadedPlugins( );
+  auto pIt = loaded_plugins.begin( );
+  for( ; pIt != loaded_plugins.end( ); ++pIt )
+    std::cout << "Plugin: " << *pIt << std::endl;
+  
+  TStringContainer categories;
+  plugins.GetLoadedCategories( categories );
+  for( auto cIt = categories.begin( ); cIt != categories.end( ); ++cIt )
+  {
+    std::cout << "Category: " << *cIt << std::endl;
+    const TStringContainer& filters = plugins.GetLoadedFilters( *cIt );
+    for( auto fIt = filters.begin( ); fIt != filters.end( ); ++fIt )
+      std::cout << "\t" << *fIt << std::endl;
+
+  } // rof
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
index b051277e30cad06e532e62495f19a39c56153899..07591b2cf81e1298a18b6ae62c5383aa80570605 100644 (file)
@@ -2,16 +2,10 @@
 #include <iostream>
 #include <string>
 
-#include <cpPlugins/Interface/Interface.h>
-#include <cpPlugins/Interface/ProcessObject.h>
-#include <cpPlugins/Interface/Image.h>
+#include <cpPlugins/Interface/Plugins.h>
 
 // -------------------------------------------------------------------------
-typedef cpPlugins::Interface::Interface     TInterface;
-typedef cpPlugins::Interface::ProcessObject TProcessObject;
-typedef cpPlugins::Interface::DataObject    TDataObject;
-typedef cpPlugins::Interface::Parameters    TParameters;
-typedef TInterface::TClasses                TClasses;
+typedef cpPlugins::Interface::Plugins TPlugins;
 
 // -------------------------------------------------------------------------
 int main( int argc, char* argv[] )
@@ -26,53 +20,32 @@ int main( int argc, char* argv[] )
 
   } // fi
 
-  // Create interface
-  TInterface plugins;
-  if( !plugins.Load( argv[ 1 ] ) )
+  // Load plugins
+  cpPlugins::Interface::Plugins plugins;
+  if( !plugins.LoadPlugins( argv[ 1 ] ) )
   {
     std::cerr << "Failed to load plugins." << std::endl;
     return( 1 );
 
   } // fi
 
-  // Create objects
-  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
-      << "Reader: " << reader.GetPointer( ) << std::endl
-      << "Writer: " << writer.GetPointer( ) << std::endl
-      << std::endl;
-    return( 1 );
-
-  } // fi
-
-  // Configure reader
-  TParameters reader_params = reader->GetDefaultParameters( );
+  // Associate filenames
+  std::vector< std::string > fnames;
   for( int i = 2; i < argc - 1; ++i )
-    reader_params.AddValueToStringList( "FileNames", argv[ i ] );
-  reader->SetParameters( reader_params );
-
-  // Configure writer
-  TParameters writer_params = writer->GetDefaultParameters( );
-  writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
-  writer->SetParameters( writer_params );
-
-  // Connect pipeline
-  writer->SetInput( 0, reader->GetOutput< TDataObject >( 0 ) );
-
-  // Execute pipeline
-  std::string err = writer->Update( );
-  if( err != "" )
+    fnames.push_back( argv[ i ] );
+  
+  // Read image
+  try
   {
-    std::cerr << "ERROR: " << err << std::endl;
+    std::string name = plugins.ReadImage( fnames, "" );
+    plugins.WriteDataObject( argv[ argc - 1 ], name );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << err.what( ) << std::endl;
     return( 1 );
 
-  } // fi
-
+  } // yrt
   return( 0 );
 }
 
index 3853f23e18dd14c61a2ec4e21e761484bbd31ae5..5c414a07b164a2d25bdf4649c551a5aa25ac3760 100644 (file)
@@ -52,7 +52,7 @@ int main( int argc, char* argv[] )
 
   // Create objects
   TProcessObject::Pointer reader;
-  reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
+  reader = plugins.CreateObject( "cpPlugins::IO::ImageReader" );
   if( reader.IsNull( ) )
   {
     std::cerr
index db3626f4f9298af27b3d5c6eac7a5a57ddfbcbf0..73a800f0f19873c0c16661a2df3db6fc2a81f789 100644 (file)
@@ -74,7 +74,7 @@ int main(int argc, char* argv[])
 
   // Create reader
   TProcessObject::Pointer reader;
-  reader = plugins.CreateProcessObject("cpPlugins::IO::ImageReader");
+  reader = plugins.CreateObject("cpPlugins::IO::ImageReader");
   if (reader.IsNull())
   {
     std::cerr
index 7a16d696819ec412f08c78305c957ea89e4f2c10..edaf0abb224da82686aaf61d6bb3ba86ae468c06 100644 (file)
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
 
   // Create reader
   TProcessObject::Pointer reader;
-  reader = plugins.CreateProcessObject("cpPlugins::IO::ImageReader");
+  reader = plugins.CreateObject("cpPlugins::IO::ImageReader");
   if (reader.IsNull())
   {
     std::cerr
@@ -91,7 +91,7 @@ int main(int argc, char* argv[])
   // filter 1 (state 2) ---------------------------------------------------------------
 
   TProcessObject::Pointer binaryFilter;
-  binaryFilter = plugins.CreateProcessObject("cpPlugins::BasicFilters::BinaryErodeImageFilter");
+  binaryFilter = plugins.CreateObject("cpPlugins::BasicFilters::BinaryErodeImageFilter");
   if (binaryFilter.IsNull())
   {
     std::cerr
index fcf13147f275f9674fd0025545314f9cf31a909f..2778e8844a785901a6c1f374eb6b63a30d81468d 100644 (file)
@@ -46,7 +46,7 @@ int main( int argc, char* argv[] )
 
   // Create objects
   TProcessObject::Pointer reader;
-  reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
+  reader = plugins.CreateObject( "cpPlugins::IO::ImageReader" );
   if( reader.IsNull( ) )
   {
     std::cerr
index 4d470b68c4e2d96ec6a4aa1f5ba81714110acc9c..bb5b35c92ac32a7f85cfaefbd9432ed01bc3b884 100644 (file)
@@ -4,7 +4,7 @@
 cpPlugins::Interface::Interface::
 Interface( )
 {
-  this->m_Pluma.acceptProviderType< ObjectProvider >( );
+  this->m_Pluma.acceptProviderType< ProcessObjectProvider >( );
 }
 
 // -------------------------------------------------------------------------
@@ -31,14 +31,17 @@ GetClasses( ) const
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Interface::Object::Pointer cpPlugins::Interface::Interface::
+cpPlugins::Interface::ProcessObject::Pointer
+cpPlugins::Interface::Interface::
 CreateObject( const std::string& name ) const
 {
   TClassesIterator cIt = this->m_Classes.find( name );
   if( cIt != this->m_Classes.end( ) )
   {
-    ObjectProvider* provider =
-      dynamic_cast< ObjectProvider* >( this->m_Providers[ cIt->second ] );
+    ProcessObjectProvider* provider =
+      dynamic_cast< ProcessObjectProvider* >(
+        this->m_Providers[ cIt->second ]
+        );
     if( provider != NULL )
       return( provider->create( ) );
 
@@ -46,17 +49,6 @@ CreateObject( const std::string& name ) const
   return( NULL );
 }
 
-// -------------------------------------------------------------------------
-cpPlugins::Interface::ProcessObject::Pointer
-cpPlugins::Interface::Interface::
-CreateProcessObject( const std::string& name ) const
-{
-  cpPlugins::Interface::Object::Pointer o = this->CreateObject( name );
-  cpPlugins::Interface::ProcessObject::Pointer p =
-    dynamic_cast< cpPlugins::Interface::ProcessObject* >( o.GetPointer( ) );
-  return( p );
-}
-
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Interface::
 Load( const std::string& path )
@@ -96,22 +88,20 @@ Load( const std::string& folder, const std::string& name )
 }
 
 // -------------------------------------------------------------------------
-int cpPlugins::Interface::Interface::
+std::list< std::string > cpPlugins::Interface::Interface::
 LoadFromFolder( const std::string& folder, bool r )
 {
-  bool ret = true;
+  std::list< std::string > files;
   try
   {
-    ret = this->m_Pluma.loadFromFolder( folder, r );
-    if( ret )
+    files = this->m_Pluma.loadFromFolder( folder, r );
+    if( files.size( ) > 0 )
       this->_LoadClasses( );
   }
   catch( ... )
   {
-    ret = false;
-
   } // yrt
-  return( ret );
+  return( files );
 }
 
 // -------------------------------------------------------------------------
@@ -180,7 +170,7 @@ _LoadClasses( )
   // Get reader provider
   for( unsigned int i = 0; i < this->m_Providers.size( ); ++i )
   {
-    Object::Pointer dummy = this->m_Providers[ i ]->create( );
+    ProcessObject::Pointer dummy = this->m_Providers[ i ]->create( );
     this->m_Classes[ dummy->GetClassName( ) ] = i;
 
   } // rof
index a51f8be231409e38857b9b3a761b2c9dcebd818c..34f29a80cdd11067a6a9e2b3318d7e5d573f9e59 100644 (file)
@@ -19,7 +19,7 @@ namespace cpPlugins
     class cpPlugins_Interface_EXPORT Interface
     {
     public:
-      typedef std::vector< ObjectProvider* >        TProviders;
+      typedef std::vector< ProcessObjectProvider* > TProviders;
       typedef std::map< std::string, unsigned int > TClasses;
 
       typedef TProviders::const_iterator TProvidersIterator;
@@ -32,15 +32,14 @@ namespace cpPlugins
       // Plugin access
       TClasses& GetClasses( );
       const TClasses& GetClasses( ) const;
-      Object::Pointer CreateObject( const std::string& name ) const;
-      ProcessObject::Pointer CreateProcessObject(
-        const std::string& name
-        ) const;
+      ProcessObject::Pointer CreateObject( const std::string& name ) const;
 
       // Interface to PLUMA
       bool Load( const std::string& path );
       bool Load( const std::string& folder, const std::string& name );
-      int LoadFromFolder( const std::string& folder, bool r = false );
+      std::list< std::string > LoadFromFolder(
+        const std::string& folder, bool r = false
+        );
       bool Unload( const std::string& name );
       void UnloadAll( );
       void GetLoadedPlugins( std::vector< const std::string* >& names ) const;
index 85a9d089a81ff50a47b2f43e296e52b5bfef92e8..ef726ede4fcf724c05c70c3d6faf5c5c0495c707 100644 (file)
@@ -46,10 +46,10 @@ public:                                                         \
     : public cpPlugins::Interface::ProcessObjectProvider                \
   {                                                                     \
   public:                                                               \
-    cpPlugins::Interface::Object::Pointer create( ) const               \
+    cpPlugins::Interface::ProcessObject::Pointer create( ) const        \
     {                                                                   \
       TYPE::Pointer a = TYPE::New( );                                   \
-      cpPlugins::Interface::Object::Pointer b = a.GetPointer( );        \
+      cpPlugins::Interface::ProcessObject::Pointer b = a.GetPointer( ); \
       return( b );                                                      \
     }                                                                   \
   };
index 3f24a4480b8a24f0984aca726282d4b7fc2c2b6c..cbe4484e02304f5da6488281d895c4dbedf9f937 100644 (file)
@@ -19,7 +19,7 @@
 // -------------------------------------------------------------------------
 #include <cpPlugins/Interface/ProcessObject.h>
 #include <cpPlugins/Interface/Plugins.h>
-#include <cpPlugins/Interface/BasePluginsApplication.h>
+#include <cpPlugins/Interface/BaseApplication.h>
 
 class SingleSeedCommand
   : public vtkCommand
index 4647fde50d1d25a2669b3aa32c05df49f1c91137..e7ebb4b5892a0b7d24f3917d7b4d29f10ef8896a 100644 (file)
@@ -1,14 +1,16 @@
 #include <cpPlugins/Interface/Plugins.h>
 
+#include <stdexcept>
+
+#include <cpPlugins/Interface/Image.h>
+#include <cpPlugins/Interface/Mesh.h>
+
 #ifdef cpPlugins_Interface_QT4
 
-/*
-  #include <QApplication>
-  #include <QFileDialog>
-  #include <QMenu>
-  #include <QMessageBox>
-  #include <QWidget>
-*/
+#include <QApplication>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QWidget>
 
 #ifdef _WIN32
 #  define PLUGIN_PREFIX ""
@@ -27,19 +29,15 @@ cpPlugins::Interface::Plugins::
 Plugins( )
   : m_Widget( NULL ),
     m_Application( NULL ),
-    m_Interface( NULL ),
     m_LastLoadedPlugin( "" ),
     m_ActiveFilter( NULL )
 {
-  this->m_Interface = new TInterface( );
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Plugins::
 ~Plugins( )
 {
-  if( this->m_Interface != NULL )
-    delete this->m_Interface;
 }
 
 // -------------------------------------------------------------------------
@@ -119,6 +117,7 @@ DialogLoadPlugins( )
 }
 
 // -------------------------------------------------------------------------
+cpPlugins::Interface::
 BaseApplication* cpPlugins::Interface::Plugins::
 GetApplication( )
 {
@@ -126,7 +125,8 @@ GetApplication( )
 }
 
 // -------------------------------------------------------------------------
-const BaseApplication* cpPlugins::Interface::Plugins::
+const cpPlugins::Interface::
+BaseApplication* cpPlugins::Interface::Plugins::
 GetApplication( ) const
 {
   return( this->m_Application );
@@ -141,9 +141,31 @@ SetApplication( BaseApplication* a )
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Plugins::
-LoadPlugins( )
+LoadPluginsPath( const std::string& path )
 {
-  // TODO: what to do here?
+  this->BlockWidget( );
+
+  // Load all plugins from given folder
+  std::list< std::string > files =
+    this->m_Interface.LoadFromFolder( path );
+
+  // Update a simple track
+  bool ret = false;
+  if( files.size( ) > 0 )
+  {
+    for( auto fIt = files.begin( ); fIt != files.end( ); ++fIt )
+    {
+      this->m_LoadedPlugins.insert( *fIt );
+      this->m_LastLoadedPlugin = *fIt;
+      ret = true;
+
+    } // rof
+    this->_UpdateLoadedPluginsInformation( );
+
+  } // fi
+
+  this->UnblockWidget( );
+  return( ret );
 }
 
 // -------------------------------------------------------------------------
@@ -157,7 +179,7 @@ LoadPlugins( const std::string& fname )
   if( this->m_LoadedPlugins.find( fname ) == this->m_LoadedPlugins.end( ) )
   {
     // Was it succesfully loaded?
-    ret = this->m_Interface->Load( fname );
+    ret = this->m_Interface.Load( fname );
 
     // Update a simple track
     if( ret )
@@ -213,6 +235,16 @@ GetLoadedPlugins( ) const
   return( this->m_LoadedPlugins );
 }
 
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+GetLoadedCategories( TStringContainer& categories ) const
+{
+  categories.clear( );
+  auto fIt = this->m_LoadedFilters.begin( );
+  for( ; fIt != this->m_LoadedFilters.end( ); ++fIt )
+    categories.insert( fIt->first );
+}
+
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 GetLoadedFilters( TStringContainer& filters ) const
@@ -227,10 +259,10 @@ GetLoadedFilters( TStringContainer& filters ) const
 // -------------------------------------------------------------------------
 const cpPlugins::Interface::Plugins::
 TStringContainer& cpPlugins::Interface::Plugins::
-GetLoadedFilters( const std::string& plugin ) const
+GetLoadedFilters( const std::string& category ) const
 {
   static const TStringContainer EMPTY;
-  auto pIt = this->m_LoadedFilters.find( plugin );
+  auto pIt = this->m_LoadedFilters.find( category );
   if( pIt != this->m_LoadedFilters.end( ) )
     return( pIt->second );
   else
@@ -286,11 +318,8 @@ ReadImage(
   const std::vector< std::string >& fnames, const std::string& parent
   )
 {
-  // Activate reader
-  auto fIt = this->m_IOFilters.find( "ImageReader" );
-  if( fIt == this->m_IOFilters.end( ) )
-    return( "" );
-  this->m_ActiveFilter = fIt->second;
+  // Load source
+  this->_ActivateIOFilter( "ImageReader" );
 
   // Configure reader
   TParameters* params = this->GetActiveFilterParameters( );
@@ -299,129 +328,261 @@ ReadImage(
     params->AddToStringList( "FileNames", *nIt );
 
   // Execute filter
-  std::string err = this->UpdateActiveFilter( );
-  if( err == "" )
-  {
-#error GET OBJECT NAME
-  }
-  else
-  {
-#error THROW ERROR
-  } // fi
+  return( this->_ReadData( parent ) );
 }
 
 // -------------------------------------------------------------------------
 std::string cpPlugins::Interface::Plugins::
 ReadImage( const std::string& parent )
 {
+  // Load source
+  this->_ActivateIOFilter( "ImageReader" );
+
+  // Try to configure source
+  if( this->ConfigureActiveFilter( ) == TProcessObject::DialogResult_Cancel )
+  {
+    this->DeactivateFilter( );
+    return( "" );
+
+  } // fi
+
+  // Execute filter
+  return( this->_ReadData( parent ) );
 }
 
 // -------------------------------------------------------------------------
 std::string cpPlugins::Interface::Plugins::
 ReadDicomSeries( const std::string& parent )
 {
+  // Load source
+  this->_ActivateIOFilter( "DicomSeriesReader" );
+
+  // Try to configure source
+  if( this->ConfigureActiveFilter( ) == TProcessObject::DialogResult_Cancel )
+  {
+    this->DeactivateFilter( );
+    return( "" );
+
+  } // fi
+
+  // Execute filter
+  return( this->_ReadData( parent ) );
 }
 
 // -------------------------------------------------------------------------
 std::string cpPlugins::Interface::Plugins::
-ReadMesh(
-  const std::string& fname, const std::string& parent
-  )
+ReadMesh( const std::string& fname, const std::string& parent )
 {
+  // Load source
+  this->_ActivateIOFilter( "MeshReader" );
+
+  // Configure reader
+  TParameters* params = this->GetActiveFilterParameters( );
+  params->SetString( "FileName", fname );
+
+  // Execute filter
+  return( this->_ReadData( parent ) );
 }
 
 // -------------------------------------------------------------------------
 std::string cpPlugins::Interface::Plugins::
 ReadMesh( const std::string& parent )
 {
+  // Load source
+  this->_ActivateIOFilter( "MeshReader" );
+
+  // Try to configure source
+  if( this->ConfigureActiveFilter( ) == TProcessObject::DialogResult_Cancel )
+  {
+    this->DeactivateFilter( );
+    return( "" );
+
+  } // fi
+
+  // Execute filter
+  return( this->_ReadData( parent ) );
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-WriteDataObject(
-  const std::string& fname, const std::string& name
-  )
+bool cpPlugins::Interface::Plugins::
+WriteDataObject( const std::string& fname, const std::string& name )
 {
+  typedef cpPlugins::Interface::Image _TImage;
+  typedef cpPlugins::Interface::Mesh  _TMesh;
+
+  // Activate sink
+  TDataObject* obj = this->GetData< TDataObject >( name );
+  if( dynamic_cast< cpPlugins::Interface::Image* >( obj ) != NULL )
+    this->_ActivateIOFilter( "ImageWriter" );
+  else if( dynamic_cast< cpPlugins::Interface::Mesh* >( obj ) != NULL )
+    this->_ActivateIOFilter( "MeshWriter" );
+  else
+  {
+    this->DeactivateFilter( );
+    return( false );
+
+  } // fi
+
+  // Configure writer
+  TParameters* params = this->GetActiveFilterParameters( );
+  params->SetString( "FileName", fname );
+
+  // Execute filter
+  return( this->_WriteData( name ) );
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
+bool cpPlugins::Interface::Plugins::
 WriteDataObject( const std::string& name )
 {
+  typedef cpPlugins::Interface::Image _TImage;
+  typedef cpPlugins::Interface::Mesh  _TMesh;
+
+  // Activate sink
+  TDataObject* obj = this->GetData< TDataObject >( name );
+  if( dynamic_cast< cpPlugins::Interface::Image* >( obj ) != NULL )
+    this->_ActivateIOFilter( "ImageWriter" );
+  else if( dynamic_cast< cpPlugins::Interface::Mesh* >( obj ) != NULL )
+    this->_ActivateIOFilter( "MeshWriter" );
+  else
+  {
+    this->DeactivateFilter( );
+    return( false );
+
+  } // fi
+
+  // Try to configure source
+  if( this->ConfigureActiveFilter( ) == TProcessObject::DialogResult_Cancel )
+  {
+    this->DeactivateFilter( );
+    return( false );
+
+  } // fi
+
+  // Execute filter
+  return( this->_WriteData( name ) );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 ClearDataObjects( )
 {
+  this->m_DataObjects.clear( );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 DeleteDataObject( const std::string& name )
 {
+  // Find and delete object
+  auto oIt = this->m_DataObjects.find( name );
+  if( oIt == this->m_DataObjects.end( ) )
+    return;
+  this->m_DataObjects.erase( oIt );
+
+  // Delete children
+  TStringContainer children;
+  this->GetChildren( children, name );
+  auto cIt = children.begin( );
+  for( ; cIt != children.end( ); ++cIt )
+    this->DeleteDataObject( *cIt );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 GetDataObjects( TStringContainer& names )
 {
+  names.clear( );
+  auto oIt = this->m_DataObjects.begin( );
+  for( ; oIt != this->m_DataObjects.end( ); ++oIt )
+    names.insert( oIt->first );
 }
 
 // -------------------------------------------------------------------------
 std::string cpPlugins::Interface::Plugins::
 GetParent( const std::string& name ) const
 {
+  // Find and delete object
+  auto oIt = this->m_DataObjects.find( name );
+  if( oIt != this->m_DataObjects.end( ) )
+    return( oIt->second.first );
+  else
+    return( "" );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
-GetChildren(
-  TStringContainer& names, const std::string& name
-  ) const
+GetChildren( TStringContainer& names, const std::string& name ) const
 {
+  names.clear( );
+  auto oIt = this->m_DataObjects.begin( );
+  for( ; oIt != this->m_DataObjects.end( ); ++oIt )
+    if( oIt->second.first == name )
+      names.insert( oIt->first );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 GetRoots( TStringContainer& names ) const
 {
+  this->GetChildren( names, "" );
 }
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Plugins::
 ActivateFilter( const std::string& name )
 {
+  this->m_ActiveFilter = this->m_Interface.CreateObject( name );
+  if( this->m_ActiveFilter.IsNotNull( ) )
+  {
+    this->m_ActiveFilter->SetPlugins( this );
+    auto iIt = this->m_Interactors.begin( );
+    for( ; iIt != this->m_Interactors.end( ); ++iIt )
+      this->m_ActiveFilter->AddInteractor( *iIt );
+    return( true );
+  }
+  else
+    return( false );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 DeactivateFilter( )
 {
+  this->m_ActiveFilter = NULL;
 }
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Plugins::
 HasActiveFilter( ) const
 {
+  return( this->m_ActiveFilter.IsNotNull( ) );
 }
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Plugins::
 IsActiveFilterInteractive( ) const
 {
+  if( this->m_ActiveFilter.IsNotNull( ) )
+    return( this->m_ActiveFilter->GetInteractive( ) );
+  else
+    return( false );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 GetActiveFilterInputsNames( TStringContainer& names ) const
 {
+  if( this->m_ActiveFilter.IsNotNull( ) )
+    this->m_ActiveFilter->GetInputsNames( names );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 GetActiveFilterOutputsNames( TStringContainer& names ) const
 {
+  if( this->m_ActiveFilter.IsNotNull( ) )
+    this->m_ActiveFilter->GetOutputsNames( names );
 }
 
 // -------------------------------------------------------------------------
@@ -430,6 +591,18 @@ ConnectInputInActiveFilter(
   const std::string& object_name, const std::string& input_name
   )
 {
+  if( this->m_ActiveFilter.IsNotNull( ) )
+  {
+    TDataObject* dobj = this->GetData< TDataObject >( object_name );
+    if( dobj != NULL )
+    {
+      this->m_ActiveFilter->SetInput( input_name, dobj );
+      return( true );
+
+    } // fi
+
+  } // fi
+  return( false );
 }
 
 // -------------------------------------------------------------------------
@@ -438,1016 +611,190 @@ SetOutputNameInActiveFilter(
   const std::string& new_object_name, const std::string& output_name
   )
 {
+  if( this->m_ActiveFilter.IsNotNull( ) )
+    return(
+      this->m_ActiveFilter->SetOutputObjectName(
+        new_object_name, output_name
+        )
+      );
+  else
+    return( false );
 }
 
 // -------------------------------------------------------------------------
+cpPlugins::Interface::Plugins::
 TParameters* cpPlugins::Interface::Plugins::
 GetActiveFilterParameters( )
 {
+  if( this->m_ActiveFilter.IsNotNull( ) )
+    return( this->m_ActiveFilter->GetParameters( ) );
+  else
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
-const TParameters* cpPlugins::Interface::Plugins::
+const cpPlugins::Interface::Plugins::
+TParameters* cpPlugins::Interface::Plugins::
 GetActiveFilterParameters( ) const
 {
+  if( this->m_ActiveFilter.IsNotNull( ) )
+    return( this->m_ActiveFilter->GetParameters( ) );
+  else
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
+cpPlugins::Interface::Plugins::
 TProcessObject::DialogResult cpPlugins::Interface::Plugins::
 ConfigureActiveFilter( )
 {
+  if( this->m_ActiveFilter.IsNotNull( ) )
+    return( this->m_ActiveFilter->ExecConfigurationDialog( this->m_Widget ) );
+  else
+    return( TProcessObject::DialogResult_Cancel );
 }
 
 // -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-UpdateActiveFilter( )
+bool cpPlugins::Interface::Plugins::
+UpdateActiveFilter( TStringContainer& outputs, const std::string& parent )
 {
+  if( this->m_ActiveFilter.IsNull( ) )
+    return( false );
+  
+  // Execute filter
+  this->BlockWidget( );
+  std::string err = this->m_ActiveFilter->Update( );
+  this->UnblockWidget( );
+
+  // Associate outputs
+  outputs.clear( );
+  if( err == "" )
+  {
+    std::set< std::string > names;
+    this->m_ActiveFilter->GetOutputsNames( names );
+    for( auto oIt = names.begin( ); oIt != names.end( ); ++oIt )
+    {
+      TDataObject* dobj =
+        this->m_ActiveFilter->GetOutput< TDataObject >( *oIt );
+      this->_InsertNewData( dobj, parent );
+      outputs.insert( dobj->GetName( ) );
+
+    } // rof
+    this->m_ActiveFilter->DisconnectOutputs( );
+    return( true );
+  }
+  else
+  {
+#ifdef cpPlugins_Interface_QT4
+    if( this->m_Widget != NULL )
+      QMessageBox::critical(
+        this->m_Widget,
+        QMessageBox::tr( "Error reading image." ),
+        QMessageBox::tr( err.c_str( ) )
+        );
+    else
+      throw std::runtime_error(
+        std::string( "Error reading image: " ) + err
+        );
+#else // cpPlugins_Interface_QT4
+    throw std::runtime_error(
+      std::string( "Error reading image: " ) + err
+      );
+#endif // cpPlugins_Interface_QT4
+    return( false );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
 _UpdateLoadedPluginsInformation( )
 {
+  this->m_LoadedFilters.clear( );
+  const TInterface::TClasses& cls = this->m_Interface.GetClasses( );
+  for( auto i = cls.begin( ); i != cls.end( ); ++i )
+  {
+    TProcessObject::Pointer o = this->m_Interface.CreateObject( i->first );
+    std::string name = o->GetClassName( );
+    std::string category = o->GetClassCategory( );
+
+    if(
+      category == "ImageReader" ||
+      category == "ImageWriter" ||
+      category == "MeshReader" ||
+      category == "MeshWriter" ||
+      category == "DicomSeriesReader"
+      )
+      this->m_IOFilters[ category ] = o;
+    this->m_LoadedFilters[ category ].insert( name );
+
+  } // rof
 }
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Plugins::
-_InsertNewData( TDataObject* dobj, const std::string& parent )
+_ActivateIOFilter( const std::string& filter )
 {
+  // Activate reader
+  auto fIt = this->m_IOFilters.find( filter );
+  if( fIt != this->m_IOFilters.end( ) )
+  {
+    this->m_ActiveFilter = fIt->second;
+    return( true );
+  }
+  else
+    return( false );
 }
 
-/*
-  protected:
-  // MVC objects
-  QWidget*         m_Widget;
-  BaseApplication* m_Application;
-  
-  // Plugins interface
-  TInterface       m_Interface;
-  TStringContainer m_LoadedPlugins;
-  std::string      m_LastLoadedPlugin;
-  
-  // Loaded filters
-  std::map< std::string, TProcessObject::Pointer > m_IOFilters;
-  TProcessObject::Pointer                       m_ActiveFilter;
-  std::map< std::string, std::string >   m_ActiveFilterOutputs;
-  std::map< std::string, TStringContainer >    m_LoadedFilters;
-  
-  // Loaded data objects
-  typedef std::pair< std::string, TDataObject::Pointer >  _TTreeNode;
-  std::map< std::string, _TTreeNode > m_DataObjects;
-  
-  // Associated interactors
-  std::set< vtkRenderWindowInteractor* > m_Interactors;
-  };
-  
-  } // ecapseman
-  
-  } // ecapseman
-*/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+_ReadData( const std::string& parent )
+{
+  if( !( this->HasActiveFilter( ) ) )
+    return( "" );
 
+  TStringContainer outputs;
+  if( this->UpdateActiveFilter( outputs, parent ) )
+    return( *( outputs.begin( ) ) );
+  else
+    return( "" );
+}
 
+// ------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+_WriteData( const std::string& name )
+{
+  if( !( this->HasActiveFilter( ) ) )
+    return( false );
 
+  TStringContainer inputs;
+  this->GetActiveFilterInputsNames( inputs );
+  bool r = true;
+  for( auto iIt = inputs.begin( ); iIt != inputs.end( ); ++iIt )
+    r &= this->ConnectInputInActiveFilter( name, *iIt );
 
+  if( r )
+  {
+    TStringContainer outputs;
+    return( this->UpdateActiveFilter( outputs, "" ) );
+  }
+  else
+    return( false );
+}
 
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+_InsertNewData( TDataObject* dobj, const std::string& parent )
+{
+  if( parent != "" )
+  {
+    auto oIt = this->m_DataObjects.find( parent );
+    if( oIt == this->m_DataObjects.end( ) )
+      return( false );
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#include <cpPlugins/Interface/Config.h>
-
-#include <fstream>
-#include <sstream>
-
-#ifdef cpPlugins_Interface_QT4
-
-#include <QApplication>
-#include <QFileDialog>
-#include <QMenu>
-#include <QMessageBox>
-#include <QWidget>
-
-#ifdef _WIN32
-#  define PLUGIN_PREFIX ""
-#  define PLUGIN_EXT "dll"
-#  define PLUGIN_REGEX "Plugins file (*.dll);;All files (*)"
-#else // Linux
-#  define PLUGIN_PREFIX "lib"
-#  define PLUGIN_EXT "so"
-#  define PLUGIN_REGEX "Plugins file (*.so);;All files (*)"
-#endif // _WIN32
-
-#endif // cpPlugins_Interface_QT4
-
-
-
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-AddInteractor( vtkRenderWindowInteractor* interactor )
-{
-  this->m_Interactors.insert( interactor );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-RemoveInteractor( vtkRenderWindowInteractor* interactor )
-{
-  this->m_Interactors.erase( interactor );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-ClearInteractors( )
-{
-  this->m_Interactors.clear( );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasImageReader( ) const
-{
-  return( this->m_ImageReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasDicomSeriesReader( ) const
-{
-  return( this->m_DicomSeriesReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasMeshReader( ) const
-{
-  return( this->m_MeshReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasImageWriter( ) const
-{
-  return( this->m_ImageWriter.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasMeshWriter( ) const
-{
-  return( this->m_MeshWriter.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage( const std::string& fname, const std::string& parent )
-{
-  std::vector< std::string > fnames;
-  fnames.push_back( fname );
-  return( this->ReadImage( fnames, parent ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage(
-  const std::vector< std::string >& fnames, const std::string& parent
-  )
-{
-  // Check if object exists
-  if( this->m_ImageReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TParameters* params = this->m_ImageReader->GetParameters( );
-  params->ClearStringList( "FileNames" );
-  auto i = fnames.begin( );
-  for( ; i != fnames.end( ); ++i )
-    params->AddToStringList( "FileNames", *i );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ImageReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TImage* image = this->m_ImageReader->GetOutput< TImage >( "Output" );
-    this->m_ImageReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( image, parent ) )
-      return( image->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading image." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading image: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage( const std::string& parent )
-{
-  // Check if object exists
-  if( this->m_ImageReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TProcessObject::DialogResult dret =
-    this->m_ImageReader->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ImageReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TImage* image = this->m_ImageReader->GetOutput< TImage >( "Output" );
-    this->m_ImageReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( image, parent ) )
-      return( image->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading image." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading image: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadDicomSeries( const std::string& parent )
-{
-  // Check if object exists
-  if( this->m_DicomSeriesReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TProcessObject::DialogResult dret =
-    this->m_DicomSeriesReader->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_DicomSeriesReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TImage* image =
-      this->m_DicomSeriesReader->GetOutput< TImage >( "Output" );
-    this->m_DicomSeriesReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( image, parent ) )
-      return( image->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading image." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading image: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadMesh( const std::string& fname, const std::string& parent )
-{
-  // Check if object exists
-  if( this->m_MeshReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TParameters* params = this->m_MeshReader->GetParameters( );
-  params->SetString( "FileName", fname );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_MeshReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TMesh* mesh = this->m_MeshReader->GetOutput< TMesh >( "Output" );
-    this->m_MeshReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( mesh, parent ) )
-      return( mesh->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadMesh( const std::string& parent )
-{
-  // Check if object exists
-  if( this->m_MeshReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TProcessObject::DialogResult dret =
-    this->m_MeshReader->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_MeshReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TMesh* mesh = this->m_MeshReader->GetOutput< TMesh >( "Output" );
-    this->m_MeshReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( mesh, parent ) )
-      return( mesh->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteImage( const std::string& fname, const std::string& name )
-{
-  // Check if objects exist
-  if( this->m_ImageWriter.IsNull( ) )
-    return( false );
-  TImage* image = this->GetImage( name );
-  if( image == NULL )
-    return( false );
-
-  // Configure writer
-  this->m_ImageWriter->GetParameters( )->SetString( "FileName", fname );
-  this->m_ImageWriter->SetInput( "Input", image );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ImageWriter->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err != "" )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( false );
-  }
-  else
-    return( true );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteImage( const std::string& name )
-{
-  // Check if objects exist
-  if( this->m_ImageWriter.IsNull( ) )
-    return( false );
-  TImage* image = this->GetImage( name );
-  if( image == NULL )
-    return( false );
-
-  // Configure writer
-  TProcessObject::DialogResult dret = 
-    this->m_ImageWriter->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-  this->m_ImageWriter->SetInput( "Input", image );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ImageWriter->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err != "" )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( false );
-  }
-  else
-    return( true );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteMesh( const std::string& fname, const std::string& name )
-{
-  // Check if objects exist
-  if( this->m_MeshWriter.IsNull( ) )
-    return( false );
-  TMesh* mesh = this->GetMesh( name );
-  if( mesh == NULL )
-    return( false );
-
-  // Configure writer
-  this->m_MeshWriter->GetParameters( )->SetString( "FileName", fname );
-  this->m_MeshWriter->SetInput( "Input", mesh );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_MeshWriter->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err != "" )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( false );
-  }
-  else
-    return( true );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteMesh( const std::string& name )
-{
-  // Check if objects exist
-  if( this->m_MeshWriter.IsNull( ) )
-    return( false );
-  TMesh* mesh = this->GetMesh( name );
-  if( mesh == NULL )
-    return( false );
-
-  // Configure writer
-  TProcessObject::DialogResult dret = 
-    this->m_MeshWriter->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-  this->m_MeshWriter->SetInput( "Input", mesh );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_MeshWriter->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err != "" )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( false );
-  }
-  else
-    return( true );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-ClearDataObjects( )
-{
-  this->m_Objects.clear( );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-DeleteDataObject( const std::string& name )
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-  {
-    this->m_Objects.erase( i );
-
-    // Get children
-    std::vector< std::string > children;
-    for( i = this->m_Objects.begin( ); i != this->m_Objects.end( ); ++i )
-      if( i->second.first == name )
-        children.push_back( i->first );
-
-    // Erase children
-    auto c = children.begin( );
-    for( ; c != children.end( ); ++c )
-      this->DeleteDataObject( *c );
-    
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-GetParent( const std::string& name ) const
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( i->second.first );
-  else
-    return( "" );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TTree& cpPlugins::Interface::Plugins::
-GetDataObjects( ) const
-{
-  return( this->m_Objects );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TDataObject* cpPlugins::Interface::Plugins::
-GetDataObject( const std::string& name )
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< TDataObject* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TDataObject* cpPlugins::Interface::Plugins::
-GetDataObject( const std::string& name ) const
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return(
-      dynamic_cast< const TDataObject* >( i->second.second.GetPointer( ) )
-      );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TImage* cpPlugins::Interface::Plugins::
-GetImage( const std::string& name )
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< TImage* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TImage* cpPlugins::Interface::Plugins::
-GetImage( const std::string& name ) const
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< const TImage* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TMesh* cpPlugins::Interface::Plugins::
-GetMesh( const std::string& name )
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< TMesh* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TMesh* cpPlugins::Interface::Plugins::
-GetMesh( const std::string& name ) const
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< const TMesh* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-ActivateFilter( const std::string& name )
-{
-  this->m_ActiveFilter = this->m_Interface.CreateProcessObject( name );
-  if( this->m_ActiveFilter.IsNotNull( ) )
-  {
-    this->m_ActiveFilter->SetPlugins( this );
-    this->m_ActiveFilterOutputs.clear( );
-    auto i = this->m_Interactors.begin( );
-    for( ; i != this->m_Interactors.end( ); ++i )
-      this->m_ActiveFilter->AddInteractor( *i );
-    return( true );
-  }
-  else
-    return( false );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-DeactivateFilter( )
-{
-  this->m_ActiveFilter = NULL;
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasActiveFilter( ) const
-{
-  return( this->m_ActiveFilter.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-IsActiveFilterInteractive( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->IsInteractive( ) );
-  else
-    return( false );
-}
-
-// -------------------------------------------------------------------------
-unsigned int cpPlugins::Interface::Plugins::
-GetNumberOfInputsInActiveFilter( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetNumberOfInputs( ) );
-  else
-    return( 0 );
-}
-
-// -------------------------------------------------------------------------
-unsigned int cpPlugins::Interface::Plugins::
-GetNumberOfOutputsInActiveFilter( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetNumberOfOutputs( ) );
-  else
-    return( 0 );
-}
-
-// -------------------------------------------------------------------------
-std::vector< std::string > cpPlugins::Interface::Plugins::
-GetActiveFilterInputsNames( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetInputsNames( ) );
-  else
-    return( std::vector< std::string >( ) );
-}
-
-// -------------------------------------------------------------------------
-std::vector< std::string > cpPlugins::Interface::Plugins::
-GetActiveFilterOutputsNames( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetOutputsNames( ) );
-  else
-    return( std::vector< std::string >( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-ConnectInputInActiveFilter(
-  const std::string& object_name, const std::string& input
-  )
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-  {
-    TDataObject* dobj = this->GetDataObject( object_name );
-    if( dobj != NULL )
-      this->m_ActiveFilter->SetInput( input, dobj );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-SetOutputNameInActiveFilter(
-  const std::string& new_name, const std::string& output
-  )
-{
-  this->m_ActiveFilterOutputs[ output ] = new_name;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TParameters* cpPlugins::Interface::Plugins::
-GetActiveFilterParameters( )
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetParameters( ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TParameters* cpPlugins::Interface::Plugins::
-GetActiveFilterParameters( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetParameters( ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TProcessObject::DialogResult cpPlugins::Interface::Plugins::
-ConfigureActiveFilter( )
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->ExecConfigurationDialog( this->m_Widget ) );
-  else
-    return( TProcessObject::DialogResult_Cancel );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-UpdateActiveFilter( std::vector< std::string >& outputs )
-{
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ActiveFilter->Update( );
-  this->UnblockWidget( );
-
-  // Associate outputs
-  outputs.clear( );
-  if( err == "" )
-  {
-    std::string parent = "";
-    if( this->GetNumberOfInputsInActiveFilter( ) > 0 )
-    {
-      std::string input = this->m_ActiveFilter->GetInputsNames( )[ 0 ];
-      parent =
-        this->m_ActiveFilter->GetInput< TDataObject >( input )->GetName( );
-
-    } // fi
-
-    auto i = this->m_ActiveFilterOutputs.begin( );
-    for( ; i != this->m_ActiveFilterOutputs.end( ); ++i )
-    {
-      TDataObject* out =
-        this->m_ActiveFilter->GetOutput< TDataObject >( i->first );
-      out->SetName( i->second );
-      outputs.push_back( out->GetName( ) );
-      this->_InsertNewData( out, parent );
-
-    } // rof
-
-  } // fi
-  return( err );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-_UpdateLoadedPluginsInformation( )
-{
-  typedef TInterface::TClasses _C;
-
-  this->m_Filters.clear( );
-  _C& classes = this->m_Interface.GetClasses( );
-  for( _C::const_iterator i = classes.begin( ); i != classes.end( ); ++i )
-  {
-    TProcessObject::Pointer o =
-      this->m_Interface.CreateProcessObject( i->first );
-    std::string name = o->GetClassName( );
-    std::string category = o->GetClassCategory( );
-    if( category == "ImageReader" )
-      this->m_ImageReader = o;
-    else if( category == "ImageWriter" )
-      this->m_ImageWriter = o;
-    else if( category == "MeshReader" )
-      this->m_MeshReader = o;
-    else if( category == "MeshWriter" )
-      this->m_MeshWriter = o;
-    else if( category == "DicomSeriesReader" )
-      this->m_DicomSeriesReader = o;
-    else
-      this->m_Filters[ category ].insert( name );
-
-  } // rof
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-_InsertNewData( TDataObject* dobj, const std::string& parent )
-{
-  std::string name = dobj->GetName( );
-  auto i = this->m_Objects.find( name );
-  bool ret = true;
-  if( i == this->m_Objects.end( ) )
-  {
-    if( parent != "" )
-    {
-      auto j = this->m_Objects.find( parent );
-      if( j != this->m_Objects.end( ) )
-        this->m_Objects[ name ] = TTreeNode( parent, dobj );
-      else
-        ret = false;
-    }
-    else
-      this->m_Objects[ name ] = TTreeNode( "", dobj );
-  }
-  else
-    i->second.second = dobj;
-
-  if( !ret )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error inserting data." ),
-        QMessageBox::tr( "Given parent does not exists." )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr
-      << "Error inserting data: Given parent does not exists."
-      << std::endl;
-#endif // cpPlugins_Interface_QT4
   } // fi
-  return( ret );
+  this->m_DataObjects[ dobj->GetName( ) ] = _TTreeNode( parent, dobj );
+  return( true );
 }
 
 // eof - $RCSfile$
index 57ffe3f14a16f00acd30d1cb74e1661c9150ae3f..5bf887cb46171689556ebca407814f317798f5e9 100644 (file)
@@ -55,13 +55,14 @@ namespace cpPlugins
       void SetApplication( BaseApplication* a );
 
       // Plugins management
-      bool LoadPlugins( );
+      bool LoadPluginsPath( const std::string& path );
       bool LoadPlugins( const std::string& fname );
       bool LoadPluginsConfigurationFile( const std::string& fname );
       const TStringContainer& GetLoadedPlugins( ) const;
+      void GetLoadedCategories( TStringContainer& categories ) const;
       void GetLoadedFilters( TStringContainer& filters ) const;
       const TStringContainer& GetLoadedFilters(
-        const std::string& plugin
+        const std::string& category
         ) const;
 
       // Interactors
@@ -89,10 +90,10 @@ namespace cpPlugins
         );
       std::string ReadMesh( const std::string& parent );
 
-      std::string WriteDataObject(
+      bool WriteDataObject(
         const std::string& fname, const std::string& name
         );
-      std::string WriteDataObject( const std::string& name );
+      bool WriteDataObject( const std::string& name );
 
       // Data objects
       void ClearDataObjects( );
@@ -126,10 +127,16 @@ namespace cpPlugins
       TParameters* GetActiveFilterParameters( );
       const TParameters* GetActiveFilterParameters( ) const;
       TProcessObject::DialogResult ConfigureActiveFilter( );
-      std::string UpdateActiveFilter( );
+      bool UpdateActiveFilter(
+        TStringContainer& outputs,
+        const std::string& parent
+        );
 
     protected:
       void _UpdateLoadedPluginsInformation( );
+      bool _ActivateIOFilter( const std::string& filter );
+      std::string _ReadData( const std::string& parent );
+      bool _WriteData( const std::string& name );
       bool _InsertNewData( TDataObject* dobj, const std::string& parent );
 
     protected:
@@ -138,7 +145,7 @@ namespace cpPlugins
       BaseApplication* m_Application;
 
       // Plugins interface
-      TInterface*                               m_Interface;
+      TInterface                                m_Interface;
       TStringContainer                          m_LoadedPlugins;
       std::string                               m_LastLoadedPlugin;
       std::map< std::string, TStringContainer > m_LoadedFilters;
@@ -146,7 +153,6 @@ namespace cpPlugins
       // Loaded filters
       std::map< std::string, TProcessObject::Pointer > m_IOFilters;
       TProcessObject::Pointer                       m_ActiveFilter;
-      std::map< std::string, std::string >   m_ActiveFilterOutputs;
 
       // Loaded data objects
       typedef std::pair< std::string, TDataObject::Pointer >  _TTreeNode;
index 93d36d57b9a5f7bbc72908de9d2ab94dcd1b699b..7d2a19257fe1340b2dfa9d30934bf6a04d178837 100644 (file)
@@ -1,6 +1,7 @@
 #include <cpPlugins/Interface/ProcessObject.h>
 
 #ifdef cpPlugins_Interface_QT4
+#include <QApplication>
 #include <cpPlugins/Interface/ParametersQtDialog.h>
 #endif // cpPlugins_Interface_QT4
 
@@ -18,25 +19,40 @@ Modified( ) const
 }
 
 // -------------------------------------------------------------------------
-std::vector< std::string > cpPlugins::Interface::ProcessObject::
-GetInputsNames( ) const
+void cpPlugins::Interface::ProcessObject::
+GetInputsNames( std::set< std::string >& names ) const
 {
-  std::vector< std::string > r;
+  names.clear( );
   auto dIt = this->m_Inputs.begin( );
   for( ; dIt != this->m_Inputs.end( ); ++dIt )
-    r.push_back( dIt->first );
-  return( r );
+    names.insert( dIt->first );
 }
 
 // -------------------------------------------------------------------------
-std::vector< std::string > cpPlugins::Interface::ProcessObject::
-GetOutputsNames( ) const
+void cpPlugins::Interface::ProcessObject::
+GetOutputsNames( std::set< std::string >& names ) const
 {
-  std::vector< std::string > r;
+  names.clear( );
   auto dIt = this->m_Outputs.begin( );
   for( ; dIt != this->m_Outputs.end( ); ++dIt )
-    r.push_back( dIt->first );
-  return( r );
+    names.insert( dIt->first );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::ProcessObject::
+SetOutputObjectName(
+  const std::string& new_object_name, const std::string& output_name
+  )
+{
+  auto oIt = this->m_Outputs.find( output_name );
+  if( oIt != this->m_Outputs.end( ) )
+  {
+    this->m_OutputObjectsNames[ output_name ] = new_object_name;
+    this->Modified( );
+    return( true );
+  }
+  else
+    return( false );
 }
 
 // -------------------------------------------------------------------------
@@ -72,6 +88,16 @@ Update( )
   if( r == "" )
     r = this->_GenerateData( );
 
+  // Configure output names
+  auto oIt = this->m_Outputs.begin( );
+  for( ; oIt != this->m_Outputs.end( ); ++oIt )
+  {
+    auto nIt = this->m_OutputObjectsNames.find( oIt->first );
+    if( nIt != this->m_OutputObjectsNames.end( ) )
+      oIt->second->SetName( nIt->second );
+
+  } // rof
+
   // Return error description, if any
   return( r );
 }
@@ -104,22 +130,33 @@ ExecConfigurationDialog( QWidget* parent )
 
 #ifdef cpPlugins_Interface_QT4
 
-  this->m_ParametersDialog->setParent( NULL );
-  this->m_ParametersDialog->setParameters( this->m_Parameters );
-
-  if( !( this->m_ParametersDialog->IsModal( ) ) )
-  {
-    this->m_ParametersDialog->show( );
-    r = Self::DialogResult_Modal;
-  }
-  else
+  if( QApplication::instance( ) != NULL )
   {
-    if( this->m_ParametersDialog->exec( ) == 1 )
-      r = Self::DialogResult_NoModal;
+    if( this->m_ParametersDialog == NULL )
+      this->m_ParametersDialog = new ParametersQtDialog( );
+    this->m_ParametersDialog->setTitle(
+      this->GetClassName( ) + std::string( " basic configuration" )
+      );
+
+    this->m_ParametersDialog->setParent( NULL );
+    this->m_ParametersDialog->setParameters( this->m_Parameters );
+
+    if( !( this->m_ParametersDialog->IsModal( ) ) )
+    {
+      this->m_ParametersDialog->show( );
+      r = Self::DialogResult_Modal;
+    }
     else
-      r = Self::DialogResult_Cancel;
+    {
+      if( this->m_ParametersDialog->exec( ) == 1 )
+        r = Self::DialogResult_NoModal;
+      else
+        r = Self::DialogResult_Cancel;
 
-  } // fi
+    } // fi
+  }
+  else
+    r = Self::DialogResult_Cancel;
 
 #endif // cpPlugins_Interface_QT4
 
@@ -132,22 +169,19 @@ ProcessObject( )
   : Superclass( ),
     m_ITKObject( NULL ),
     m_VTKObject( NULL ),
+    m_ParametersDialog( NULL ),
     m_Plugins( NULL )
 {
   this->m_Parameters = TParameters::New( );
   this->m_Parameters->SetProcessObject( this );
-
-  this->m_ParametersDialog = new ParametersQtDialog( );
-  this->m_ParametersDialog->setTitle(
-    this->GetClassName( ) + std::string( " basic configuration" )
-    );
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::Interface::ProcessObject::
 ~ProcessObject( )
 {
-  delete this->m_ParametersDialog;
+  if( this->m_ParametersDialog != NULL )
+    delete this->m_ParametersDialog;
 }
 
 // -------------------------------------------------------------------------
index 43533f5cda030a1e969f92d05a25e358650a6078..3dfe118e4415046848050e337f0a3c460113a2ca 100644 (file)
@@ -1,15 +1,8 @@
 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
 
-/*
-  #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <set>
 
-  #include <map>
-  #include <vector>
-
-  #include <cpPlugins/Interface/Config.h>
-  #include <cpPlugins/Interface/DataObject.h>
-*/
 #include <cpPlugins/Interface/DataObject.h>
 #include <cpPlugins/Interface/Parameters.h>
 
@@ -76,8 +69,13 @@ namespace cpPlugins
       // To impact pipeline
       virtual void Modified( ) const;
 
-      virtual std::vector< std::string > GetInputsNames( ) const;
-      virtual std::vector< std::string > GetOutputsNames( ) const;
+      virtual void GetInputsNames( std::set< std::string >& names ) const;
+      virtual void GetOutputsNames( std::set< std::string >& names ) const;
+
+      virtual bool SetOutputObjectName(
+        const std::string& new_object_name,
+        const std::string& output_name
+        );
 
       virtual void SetInput( const std::string& id, DataObject* dobj );
 
@@ -145,6 +143,7 @@ namespace cpPlugins
       typedef std::map< std::string, DataObject::Pointer > _TDataContainer;
       _TDataContainer m_Inputs;
       _TDataContainer m_Outputs;
+      std::map< std::string, std::string > m_OutputObjectsNames;
     };
 
     /**
index 491a1a9f5a9b653b3f939573f01d24f92f1834cf..6cfe12e1a1c86178f81848349190bbdf1461ca47 100644 (file)
@@ -22,7 +22,6 @@
 //\r
 ////////////////////////////////////////////////////////////\r
 \r
-\r
 ////////////////////////////////////////////////////////////\r
 // Headers\r
 ////////////////////////////////////////////////////////////\r
@@ -106,18 +105,24 @@ bool PluginManager::load(const std::string& folder, const std::string& pluginNam
     return load(folder + '/' + pluginName);\r
 }\r
 \r
-\r
 ////////////////////////////////////////////////////////////\r
-int PluginManager::loadFromFolder(const std::string& folder, bool recursive){\r
-    std::list<std::string> files;\r
+  std::list< std::string > PluginManager::loadFromFolder(const std::string& folder, bool recursive){\r
+    std::list<std::string> files, loaded_files;\r
     dir::listFiles(files, folder, PLUMA_LIB_EXTENSION, recursive);\r
     // try to load every library\r
-    int res = 0;\r
     std::list<std::string>::const_iterator it;\r
     for (it = files.begin() ; it != files.end() ; ++it){\r
-        if ( load(*it) ) ++res;\r
+      // *** LFV ***\r
+      try\r
+      {\r
+        if ( load(*it) ) loaded_files.push_back( *it );\r
+      }\r
+      catch( ... )\r
+      {\r
+      } // yrt\r
+      // *** LFV ***\r
     }\r
-    return res;\r
+    return loaded_files;\r
 }\r
 \r
 \r
index e5ddf060f57fb30006f47adff68bdfa38afed1bb..a6ba5f2e85959343f1223c5e8d50d1f90fc43593 100644 (file)
@@ -104,7 +104,9 @@ public:
     /// \see unloadAll\r
     ///\r
     ////////////////////////////////////////////////////////////\r
-    int loadFromFolder(const std::string& folder, bool recursive = false);\r
+    std::list< std::string > loadFromFolder(\r
+      const std::string& folder, bool recursive = false\r
+      );\r
 \r
     ////////////////////////////////////////////////////////////\r
     /// \brief Unload a plugin.\r