--- /dev/null
+#ifndef __CPPLUGINS__INTERFACE__BASEAPPLICATION__H__
+#define __CPPLUGINS__INTERFACE__BASEAPPLICATION__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+
+namespace cpPlugins
+{
+ namespace Interface
+ {
+ /**
+ */
+ class cpPlugins_Interface_EXPORT BaseApplication
+ {
+ public:
+ BaseApplication( ) { }
+ virtual ~BaseApplication( ) { }
+
+ virtual void UpdateActualFilter( ) = 0;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__INTERFACE__BASEAPPLICATION__H__
+
+// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__INTERFACE__BASEPLUGINSAPPLICATION__H__
-#define __CPPLUGINS__INTERFACE__BASEPLUGINSAPPLICATION__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-
-namespace cpPlugins
-{
- namespace Interface
- {
- /**
- */
- class cpPlugins_Interface_EXPORT BasePluginsApplication
- {
- public:
- BasePluginsApplication( ) { }
- virtual ~BasePluginsApplication( ) { }
-
- virtual void UpdateActualFilter( ) = 0;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__BASEPLUGINSAPPLICATION__H__
-
-// eof - $RCSfile$
#include <cpPlugins/Interface/DataObject.h>
+#include <cpPlugins/Interface/ProcessObject.h>
#include <itkDataObject.h>
#include <vtkImageData.h>
#include <vtkPolyData.h>
// -------------------------------------------------------------------------
-cpPlugins::Interface::Object* cpPlugins::Interface::DataObject::
+cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject::
GetSource( )
{
return( this->m_Source );
}
// -------------------------------------------------------------------------
-const cpPlugins::Interface::Object* cpPlugins::Interface::DataObject::
+const cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject::
GetSource( ) const
{
return( this->m_Source );
// -------------------------------------------------------------------------
void cpPlugins::Interface::DataObject::
-SetSource( cpPlugins::Interface::Object* src )
+SetSource( cpPlugins::Interface::ProcessObject* src )
{
- if( this->m_Source.GetPointer( ) != src )
+ if( this->m_Source != src )
{
this->m_Source = src;
this->Modified( );
#ifndef __CPPLUGINS__INTERFACE__DATAOBJECT__H__
#define __CPPLUGINS__INTERFACE__DATAOBJECT__H__
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/Object.h>
#include <itkObject.h>
-
#include <vtkSmartPointer.h>
#include <vtkObject.h>
{
namespace Interface
{
+ // Some forward declarations
+ class ProcessObject;
+
/**
*/
class cpPlugins_Interface_EXPORT DataObject
public:
itkTypeMacro( DataObject, Object );
- cpPlugins_Id_Macro(
- cpPlugins::Interface::DataObject, "BasicObject"
- );
+ cpPlugins_Id_Macro( DataObject, "BasicObject" );
public:
- Object* GetSource( );
- const Object* GetSource( ) const;
- void SetSource( Object* src );
+ ProcessObject* GetSource( );
+ const ProcessObject* GetSource( ) const;
+ void SetSource( ProcessObject* src );
void DisconnectPipeline( );
protected:
itk::Object::Pointer m_ITKObject;
vtkSmartPointer< vtkObject > m_VTKObject;
- Object::Pointer m_Source;
+ ProcessObject* m_Source;
};
} // ecapseman
#ifndef __CPPLUGINS__INTERFACE__IMAGE__H__
#define __CPPLUGINS__INTERFACE__IMAGE__H__
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/DataObject.h>
#include <itkProcessObject.h>
-class vtkImageData;
-
// -------------------------------------------------------------------------
namespace cpPlugins
{
public:
itkNewMacro( Self );
itkTypeMacro( Image, DataObject );
- cpPlugins_Id_Macro(
- cpPlugins::Interface::Image, "DataObject"
- );
+ cpPlugins_Id_Macro( Image, "DataObject" );
public:
template< class I >
#ifndef __CPPLUGINS__INTERFACE__IMAGE__HXX__
#define __CPPLUGINS__INTERFACE__IMAGE__HXX__
-#include <cpPlugins/Interface/Macros.h>
-
#include <complex>
#include <itkImage.h>
#ifndef __CPPLUGINS__INTERFACE__MACROS__H__
#define __CPPLUGINS__INTERFACE__MACROS__H__
+#include <Pluma/Pluma.hpp>
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/Config.h>
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Id_Macro( name, category ) \
+ public: \
+ virtual std::string GetClassName( ) { return( #name ); } \
+ virtual std::string GetClassCategory( ) { return( category ); }
+
+// -------------------------------------------------------------------------
+#define CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \
+ class cpPlugins_Interface_EXPORT TYPE##Provider \
+ : public pluma::Provider \
+ { \
+private: \
+ friend class pluma::Pluma; \
+ static const unsigned int PLUMA_INTERFACE_VERSION; \
+ static const unsigned int PLUMA_INTERFACE_LOWEST_VERSION; \
+ static const std::string PLUMA_PROVIDER_TYPE; \
+ std::string plumaGetType( ) const \
+ { return( PLUMA_PROVIDER_TYPE ); } \
+public: \
+ unsigned int getVersion( ) const \
+ { return( PLUMA_INTERFACE_VERSION ); }
+
+// -------------------------------------------------------------------------
+#define CPPLUGINS_PROVIDER_HEADER_END };
+
+// -------------------------------------------------------------------------
+#define CPPLUGINS_PROVIDER_HEADER( TYPE ) \
+ CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \
+ virtual TYPE::Pointer create( ) const = 0; \
+ CPPLUGINS_PROVIDER_HEADER_END
+
+// -------------------------------------------------------------------------
+#define CPPLUGINS_PROVIDER_SOURCE( TYPE, Version, LowestVersion ) \
+ PLUMA_PROVIDER_SOURCE( TYPE, Version, LowestVersion )
+
+// -------------------------------------------------------------------------
+#define CPPLUGINS_INHERIT_PROVIDER( TYPE ) \
+ class TYPE##Provider \
+ : public cpPlugins::Interface::ProcessObjectProvider \
+ { \
+ public: \
+ cpPlugins::Interface::Object::Pointer create( ) const \
+ { \
+ TYPE::Pointer a = TYPE::New( ); \
+ cpPlugins::Interface::Object::Pointer b = a.GetPointer( ); \
+ return( b ); \
+ } \
+ };
/**
* Based upon: http://www.itk.org/Wiki/Proposals:Explicit_Instantiation
*/
-
// -------------------------------------------------------------------------
#define cpPlugins_TEMPLATE_1( X1 ) \
X1
#ifndef __CPPLUGINS__INTERFACE__MESH__H__
#define __CPPLUGINS__INTERFACE__MESH__H__
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/DataObject.h>
namespace cpPlugins
public:
itkNewMacro( Self );
itkTypeMacro( Mesh, DataObject );
- cpPlugins_Id_Macro(
- cpPlugins::Interface::Mesh, "DataObject"
- );
+ cpPlugins_Id_Macro( Mesh, "DataObject" );
public:
template< class M >
#ifndef __CPPLUGINS__INTERFACE__MESH__HXX__
#define __CPPLUGINS__INTERFACE__MESH__HXX__
-#include <cpPlugins/Interface/Macros.h>
-
#include <itkMesh.h>
#include <itkQuadEdgeMesh.h>
{
}
-// -------------------------------------------------------------------------
-CPPLUGINS_PROVIDER_SOURCE( cpPlugins::Interface::Object, 1, 1 );
-
// eof - $RCSfile$
#ifndef __CPPLUGINS__INTERFACE__OBJECT__H__
#define __CPPLUGINS__INTERFACE__OBJECT__H__
-#include <string>
-#include <Pluma/Pluma.hpp>
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/Macros.h>
+#include <string>
#include <itkObject.h>
#include <itkObjectFactory.h>
-// -------------------------------------------------------------------------
-#define CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \
- class cpPlugins_Interface_EXPORT TYPE##Provider \
- : public pluma::Provider \
- { \
-private: \
- friend class pluma::Pluma; \
- static const unsigned int PLUMA_INTERFACE_VERSION; \
- static const unsigned int PLUMA_INTERFACE_LOWEST_VERSION; \
- static const std::string PLUMA_PROVIDER_TYPE; \
- std::string plumaGetType( ) const \
- { return( PLUMA_PROVIDER_TYPE ); } \
-public: \
- unsigned int getVersion( ) const \
- { return( PLUMA_INTERFACE_VERSION ); }
-
-// -------------------------------------------------------------------------
-#define CPPLUGINS_PROVIDER_HEADER_END };
-
-// -------------------------------------------------------------------------
-#define CPPLUGINS_PROVIDER_HEADER( TYPE ) \
- CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \
- virtual TYPE::Pointer create( ) const = 0; \
- CPPLUGINS_PROVIDER_HEADER_END
-
-// -------------------------------------------------------------------------
-#define CPPLUGINS_PROVIDER_SOURCE( TYPE, Version, LowestVersion ) \
- PLUMA_PROVIDER_SOURCE( TYPE, Version, LowestVersion )
-
-// -------------------------------------------------------------------------
-#define CPPLUGINS_INHERIT_PROVIDER( TYPE ) \
- class TYPE##Provider \
- : public cpPlugins::Interface::ObjectProvider \
- { \
- public: \
- cpPlugins::Interface::Object::Pointer create( ) const \
- { \
- TYPE::Pointer a = TYPE::New( ); \
- cpPlugins::Interface::Object::Pointer b = a.GetPointer( ); \
- return( b ); \
- } \
- };
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Id_Macro( name, category ) \
- public: \
- virtual std::string GetClassName( ) { return( #name ); } \
- virtual std::string GetClassCategory( ) { return( category ); }
-
namespace cpPlugins
{
namespace Interface
public:
itkNewMacro( Self );
itkTypeMacro( Object, itkObject );
- cpPlugins_Id_Macro( cpPlugins::Interface::Object, "BaseObject" );
+ cpPlugins_Id_Macro( Object, "BaseObject" );
itkGetStringMacro( Name );
itkSetStringMacro( Name );
std::string m_Name;
};
- /**
- * Plugin provider
- */
- CPPLUGINS_PROVIDER_HEADER( Object );
-
} // ecapseman
} // ecapseman
#include <cpPlugins/Interface/Plugins.h>
-#include <cpPlugins/Interface/Config.h>
-
-#include <fstream>
-#include <sstream>
#ifdef cpPlugins_Interface_QT4
-#include <QApplication>
-#include <QFileDialog>
-#include <QMenu>
-#include <QMessageBox>
-#include <QWidget>
+/*
+ #include <QApplication>
+ #include <QFileDialog>
+ #include <QMenu>
+ #include <QMessageBox>
+ #include <QWidget>
+*/
#ifdef _WIN32
# define PLUGIN_PREFIX ""
// -------------------------------------------------------------------------
cpPlugins::Interface::Plugins::
-Plugins( QWidget* widget )
- : m_Widget( widget ),
+Plugins( )
+ : m_Widget( NULL ),
m_Application( NULL ),
- m_LastLoadedPlugin( "." )
+ m_Interface( NULL ),
+ m_LastLoadedPlugin( "" ),
+ m_ActiveFilter( NULL )
{
+ this->m_Interface = new TInterface( );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Plugins::
~Plugins( )
{
- // TODO: this causes a segfault? this->m_Interface.UnloadAll( );
+ if( this->m_Interface != NULL )
+ delete this->m_Interface;
}
// -------------------------------------------------------------------------
}
// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-AssociatePluginsToMenu( QMenu* menu, QObject* obj, const char* slot )
-{
-#ifdef cpPlugins_Interface_QT4
- std::map< std::string, std::set< std::string > >::const_iterator i;
- std::set< std::string >::const_iterator j;
-
- menu->clear( );
- for( i = this->m_Filters.begin( ); i != this->m_Filters.end( ); i++ )
- {
- QMenu* newMenu = menu->addMenu( i->first.c_str( ) );
- for( j = i->second.begin( ); j != i->second.end( ); ++j )
- {
- QAction* a = newMenu->addAction( j->c_str( ) );
- QObject::connect( a, SIGNAL( triggered( ) ), obj, slot );
-
- } // rof
-
- } // rof
-#endif // cpPlugins_Interface_QT4
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::
-BasePluginsApplication* cpPlugins::Interface::Plugins::
+BaseApplication* cpPlugins::Interface::Plugins::
GetApplication( )
{
return( this->m_Application );
}
// -------------------------------------------------------------------------
-const cpPlugins::Interface::
-BasePluginsApplication* cpPlugins::Interface::Plugins::
+const BaseApplication* cpPlugins::Interface::Plugins::
GetApplication( ) const
{
return( this->m_Application );
// -------------------------------------------------------------------------
void cpPlugins::Interface::Plugins::
-SetApplication( cpPlugins::Interface::BasePluginsApplication* a )
+SetApplication( BaseApplication* a )
{
this->m_Application = a;
}
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+LoadPlugins( )
+{
+ // TODO: what to do here?
+}
+
// -------------------------------------------------------------------------
bool cpPlugins::Interface::Plugins::
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 )
return( true );
}
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::Plugins::
+TStringContainer& cpPlugins::Interface::Plugins::
+GetLoadedPlugins( ) const
+{
+ return( this->m_LoadedPlugins );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+GetLoadedFilters( TStringContainer& filters ) const
+{
+ filters.clear( );
+ auto pIt = this->m_LoadedFilters.begin( );
+ for( ; pIt != this->m_LoadedFilters.end( ); ++pIt )
+ for( auto fIt = pIt->second.begin( ); fIt != pIt->second.end( ); ++fIt )
+ filters.insert( *fIt );
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::Plugins::
+TStringContainer& cpPlugins::Interface::Plugins::
+GetLoadedFilters( const std::string& plugin ) const
+{
+ static const TStringContainer EMPTY;
+ auto pIt = this->m_LoadedFilters.find( plugin );
+ if( pIt != this->m_LoadedFilters.end( ) )
+ return( pIt->second );
+ else
+ return( EMPTY );
+}
+
+// -------------------------------------------------------------------------
+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( );
+}
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Plugins_HasMacro( F ) \
+ bool cpPlugins::Interface::Plugins:: \
+ Has##F( ) const \
+ { \
+ return( this->m_IOFilters.find( #F ) != this->m_IOFilters.end( ) ); \
+ }
+
+cpPlugins_Plugins_HasMacro( ImageReader );
+cpPlugins_Plugins_HasMacro( DicomSeriesReader );
+cpPlugins_Plugins_HasMacro( MeshReader );
+cpPlugins_Plugins_HasMacro( ImageWriter );
+cpPlugins_Plugins_HasMacro( MeshWriter );
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+ReadImage( const std::string& fname, const std::string& parent )
+{
+ std::vector< std::string > fnames( 1, fname );
+ return( this->ReadImage( fnames, parent ) );
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+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;
+
+ // Configure reader
+ TParameters* params = this->GetActiveFilterParameters( );
+ params->ClearStringList( "FileNames" );
+ for( auto nIt = fnames.begin( ); nIt != fnames.end( ); ++nIt )
+ params->AddToStringList( "FileNames", *nIt );
+
+ // Execute filter
+ std::string err = this->UpdateActiveFilter( );
+ if( err == "" )
+ {
+#error GET OBJECT NAME
+ }
+ else
+ {
+#error THROW ERROR
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+ReadImage( const std::string& parent )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+ReadDicomSeries( const std::string& parent )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+ReadMesh(
+ const std::string& fname, const std::string& parent
+ )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+ReadMesh( const std::string& parent )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+WriteDataObject(
+ const std::string& fname, const std::string& name
+ )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+WriteDataObject( const std::string& name )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+ClearDataObjects( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+DeleteDataObject( const std::string& name )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+GetDataObjects( TStringContainer& names )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+GetParent( const std::string& name ) const
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+GetChildren(
+ TStringContainer& names, const std::string& name
+ ) const
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+GetRoots( TStringContainer& names ) const
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+ActivateFilter( const std::string& name )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+DeactivateFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+HasActiveFilter( ) const
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+IsActiveFilterInteractive( ) const
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+GetActiveFilterInputsNames( TStringContainer& names ) const
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+GetActiveFilterOutputsNames( TStringContainer& names ) const
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+ConnectInputInActiveFilter(
+ const std::string& object_name, const std::string& input_name
+ )
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+SetOutputNameInActiveFilter(
+ const std::string& new_object_name, const std::string& output_name
+ )
+{
+}
+
+// -------------------------------------------------------------------------
+TParameters* cpPlugins::Interface::Plugins::
+GetActiveFilterParameters( )
+{
+}
+
+// -------------------------------------------------------------------------
+const TParameters* cpPlugins::Interface::Plugins::
+GetActiveFilterParameters( ) const
+{
+}
+
+// -------------------------------------------------------------------------
+TProcessObject::DialogResult cpPlugins::Interface::Plugins::
+ConfigureActiveFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::Plugins::
+UpdateActiveFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Plugins::
+_UpdateLoadedPluginsInformation( )
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Plugins::
+_InsertNewData( TDataObject* dobj, const std::string& parent )
+{
+}
+
+/*
+ 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
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#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 )
#ifndef __CPPLUGINS__INTERFACE__PLUGINS__H__
#define __CPPLUGINS__INTERFACE__PLUGINS__H__
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/DataObject.h>
+#include <cpPlugins/Interface/ProcessObject.h>
#include <map>
#include <set>
#include <string>
+#include <vector>
-#include <cpPlugins/Interface/Interface.h>
-#include <cpPlugins/Interface/ProcessObject.h>
-#include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Interface/Mesh.h>
-
-class QObject;
-class QMenu;
-class QWidget;
+// Some forward declarations
class vtkRenderWindowInteractor;
+#ifdef cpPlugins_Interface_QT4
+class QWidget;
+#else
+typedef char QWidget;
+#endif // cpPlugins_Interface_QT4
namespace cpPlugins
{
namespace Interface
{
- class BasePluginsApplication;
+ // Some forward declarations
+ class BaseApplication;
/**
*/
typedef cpPlugins::Interface::Interface TInterface;
typedef cpPlugins::Interface::ProcessObject TProcessObject;
typedef cpPlugins::Interface::DataObject TDataObject;
- typedef cpPlugins::Interface::Image TImage;
- typedef cpPlugins::Interface::Mesh TMesh;
typedef TProcessObject::TParameters TParameters;
- typedef std::set< std::string > TOrderedStringContainer;
- typedef std::map< std::string, std::set< std::string > > TFilters;
- typedef std::pair< std::string, TDataObject::Pointer > TTreeNode;
- typedef std::map< std::string, TTreeNode > TTree;
+ typedef std::set< std::string > TStringContainer;
public:
- Plugins( QWidget* widget = NULL );
+ Plugins( );
virtual ~Plugins( );
+ // Qt oriented methods
QWidget* GetWidget( );
const QWidget* GetWidget( ) const;
void SetWidget( QWidget* widget );
void BlockWidget( );
void UnblockWidget( );
void DialogLoadPlugins( );
- void AssociatePluginsToMenu(
- QMenu* menu, QObject* obj, const char* slot
- );
- BasePluginsApplication* GetApplication( );
- const BasePluginsApplication* GetApplication( ) const;
- void SetApplication( BasePluginsApplication* a );
+ // Connection to main application
+ BaseApplication* GetApplication( );
+ const BaseApplication* GetApplication( ) const;
+ void SetApplication( BaseApplication* a );
+ // Plugins management
bool LoadPlugins( );
bool LoadPlugins( const std::string& fname );
bool LoadPluginsConfigurationFile( const std::string& fname );
+ const TStringContainer& GetLoadedPlugins( ) const;
+ void GetLoadedFilters( TStringContainer& filters ) const;
+ const TStringContainer& GetLoadedFilters(
+ const std::string& plugin
+ ) const;
// Interactors
void AddInteractor( vtkRenderWindowInteractor* interactor );
);
std::string ReadMesh( const std::string& parent );
- bool WriteImage( const std::string& fname, const std::string& name );
- bool WriteImage( const std::string& name );
- bool WriteMesh( const std::string& fname, const std::string& name );
- bool WriteMesh( const std::string& name );
+ std::string WriteDataObject(
+ const std::string& fname, const std::string& name
+ );
+ std::string WriteDataObject( const std::string& name );
// Data objects
void ClearDataObjects( );
void DeleteDataObject( const std::string& name );
+ void GetDataObjects( TStringContainer& names );
std::string GetParent( const std::string& name ) const;
- const TTree& GetDataObjects( ) const;
- TDataObject* GetDataObject( const std::string& name );
- const TDataObject* GetDataObject( const std::string& name ) const;
- TImage* GetImage( const std::string& name );
- const TImage* GetImage( const std::string& name ) const;
- TMesh* GetMesh( const std::string& name );
- const TMesh* GetMesh( const std::string& name ) const;
+ void GetChildren(
+ TStringContainer& names, const std::string& name
+ ) const;
+ void GetRoots( TStringContainer& names ) const;
+
+ template< class T >
+ inline T* GetData( const std::string& name );
+
+ template< class T >
+ inline const T* GetData( const std::string& name ) const;
// Filter acces
bool ActivateFilter( const std::string& name );
void DeactivateFilter( );
bool HasActiveFilter( ) const;
bool IsActiveFilterInteractive( ) const;
- unsigned int GetNumberOfInputsInActiveFilter( ) const;
- unsigned int GetNumberOfOutputsInActiveFilter( ) const;
- std::vector< std::string > GetActiveFilterInputsNames( ) const;
- std::vector< std::string > GetActiveFilterOutputsNames( ) const;
- void ConnectInputInActiveFilter(
- const std::string& object_name, const std::string& input
+ void GetActiveFilterInputsNames( TStringContainer& names ) const;
+ void GetActiveFilterOutputsNames( TStringContainer& names ) const;
+ bool ConnectInputInActiveFilter(
+ const std::string& object_name, const std::string& input_name
);
- void SetOutputNameInActiveFilter(
- const std::string& new_name, const std::string& output
+ bool SetOutputNameInActiveFilter(
+ const std::string& new_object_name, const std::string& output_name
);
TParameters* GetActiveFilterParameters( );
const TParameters* GetActiveFilterParameters( ) const;
TProcessObject::DialogResult ConfigureActiveFilter( );
- std::string UpdateActiveFilter( std::vector< std::string >& outputs );
+ std::string UpdateActiveFilter( );
protected:
void _UpdateLoadedPluginsInformation( );
bool _InsertNewData( TDataObject* dobj, const std::string& parent );
protected:
- QWidget* m_Widget;
- BasePluginsApplication* m_Application;
+ // MVC objects
+ QWidget* m_Widget;
+ BaseApplication* m_Application;
- TInterface m_Interface;
- TOrderedStringContainer m_LoadedPlugins;
- std::string m_LastLoadedPlugin;
+ // Plugins interface
+ TInterface* m_Interface;
+ TStringContainer m_LoadedPlugins;
+ std::string m_LastLoadedPlugin;
+ std::map< std::string, TStringContainer > m_LoadedFilters;
- TProcessObject::Pointer m_ImageReader;
- TProcessObject::Pointer m_ImageWriter;
- TProcessObject::Pointer m_MeshReader;
- TProcessObject::Pointer m_MeshWriter;
- TProcessObject::Pointer m_DicomSeriesReader;
- TProcessObject::Pointer m_ActiveFilter;
- std::map< std::string, std::string > m_ActiveFilterOutputs;
- TFilters m_Filters;
+ // Loaded filters
+ std::map< std::string, TProcessObject::Pointer > m_IOFilters;
+ TProcessObject::Pointer m_ActiveFilter;
+ std::map< std::string, std::string > m_ActiveFilterOutputs;
- // Loaded objects
- TTree m_Objects;
+ // 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
+#include <cpPlugins/Interface/Plugins.hxx>
+
#endif // __CPPLUGINS__INTERFACE__PLUGINS__H__
// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__INTERFACE__PLUGINS__HXX__
+#define __CPPLUGINS__INTERFACE__PLUGINS__HXX__
+
+// -------------------------------------------------------------------------
+template< class T >
+T* cpPlugins::Interface::Plugins::
+GetData( const std::string& name )
+{
+ auto dIt = this->m_DataObjects.find( name );
+ if( dIt != this->m_DataObjects.end( ) )
+ return( dynamic_cast< T* >( dIt->second.second.GetPointer( ) ) );
+ else
+ return( NULL );
+}
+
+// -------------------------------------------------------------------------
+template< class T >
+const T* cpPlugins::Interface::Plugins::
+GetData( const std::string& name ) const
+{
+ auto dIt = this->m_DataObjects.find( name );
+ if( dIt != this->m_DataObjects.end( ) )
+ return( dynamic_cast< const T* >( dIt->second.second.GetPointer( ) ) );
+ else
+ return( NULL );
+}
+
+#endif // __CPPLUGINS__INTERFACE__PLUGINS__HXX__
+
+// eof - $RCSfile$
this->Superclass::Modified( );
}
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::ProcessObject::
-IsInteractive( ) const
-{
- std::vector< std::string > names;
- this->m_Parameters->GetNames( names );
- bool res = false;
- auto i = names.begin( );
- for( ; i != names.end( ); ++i )
- {
- TParameters::Type t = this->m_Parameters->GetType( *i );
- res |= ( t == TParameters::Point );
- res |= ( t == TParameters::Index );
- res |= ( t == TParameters::PointList );
- res |= ( t == TParameters::IndexList );
-
- } // rof
- return( res );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::ProcessObject::
-TParameters* cpPlugins::Interface::ProcessObject::
-GetParameters( )
-{
- return( this->m_Parameters.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::ProcessObject::
-TParameters* cpPlugins::Interface::ProcessObject::
-GetParameters( ) const
-{
- return( this->m_Parameters.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::
-Plugins* cpPlugins::Interface::ProcessObject::
-GetPlugins( )
-{
- return( this->m_Plugins );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::
-Plugins* cpPlugins::Interface::ProcessObject::
-GetPlugins( ) const
-{
- return( this->m_Plugins );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::ProcessObject::
-SetPlugins( Plugins* p )
-{
- this->m_Plugins = p;
-}
-
-// -------------------------------------------------------------------------
-unsigned int cpPlugins::Interface::ProcessObject::
-GetNumberOfInputs( ) const
-{
- return( this->m_Inputs.size( ) );
-}
-
-// -------------------------------------------------------------------------
-unsigned int cpPlugins::Interface::ProcessObject::
-GetNumberOfOutputs( ) const
-{
- return( this->m_Outputs.size( ) );
-}
-
// -------------------------------------------------------------------------
std::vector< std::string > cpPlugins::Interface::ProcessObject::
GetInputsNames( ) const
this->Modified( );
}
+// -------------------------------------------------------------------------
+CPPLUGINS_PROVIDER_SOURCE( cpPlugins::Interface::ProcessObject, 1, 1 );
+
// eof - $RCSfile$
#ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
#define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+/*
+ #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <map>
-#include <vector>
+ #include <map>
+ #include <vector>
-#include <cpPlugins/Interface/Config.h>
-#include <cpPlugins/Interface/Object.h>
+ #include <cpPlugins/Interface/Config.h>
+ #include <cpPlugins/Interface/DataObject.h>
+*/
#include <cpPlugins/Interface/DataObject.h>
#include <cpPlugins/Interface/Parameters.h>
-#ifdef cpPlugins_Interface_QT4
-class QWidget;
-#else
-typedef char QWidget;
-#endif // cpPlugins_Interface_QT4
-
#include <itkProcessObject.h>
-
#include <vtkSmartPointer.h>
#include <vtkAlgorithm.h>
+// Some forward declarations
class vtkRenderWindowInteractor;
+#ifdef cpPlugins_Interface_QT4
+class QWidget;
+#else
+typedef char QWidget;
+#endif // cpPlugins_Interface_QT4
namespace cpPlugins
{
namespace Interface
{
+ // Some forward declarations
class Plugins;
#ifdef cpPlugins_Interface_QT4
class ParametersQtDialog;
public:
itkTypeMacro( ProcessObject, Object );
- cpPlugins_Id_Macro(
- cpPlugins::Interface::ProcessObject, "BaseObject"
- );
+ cpPlugins_Id_Macro( ProcessObject, "BaseObject" );
- public:
- // To impact pipeline
- virtual void Modified( ) const;
+ itkBooleanMacro( Interactive );
- virtual bool IsInteractive( ) const;
- virtual TParameters* GetParameters( );
- virtual const TParameters* GetParameters( ) const;
+ itkGetConstObjectMacro( Parameters, TParameters );
+ itkGetObjectMacro( Parameters, TParameters );
+ itkGetConstMacro( Plugins, const Plugins* );
+ itkGetMacro( Plugins, Plugins* );
+ itkGetConstMacro( Interactive, bool );
- Plugins* GetPlugins( );
- const Plugins* GetPlugins( ) const;
- void SetPlugins( Plugins* p );
+ itkSetObjectMacro( Plugins, Plugins );
+ itkSetMacro( Interactive, bool );
- virtual unsigned int GetNumberOfInputs( ) const;
- virtual unsigned int GetNumberOfOutputs( ) const;
+ public:
+ // To impact pipeline
+ virtual void Modified( ) const;
virtual std::vector< std::string > GetInputsNames( ) const;
virtual std::vector< std::string > GetOutputsNames( ) const;
Parameters::Pointer m_Parameters;
ParametersQtDialog* m_ParametersDialog;
Plugins* m_Plugins;
+ bool m_Interactive;
typedef std::map< std::string, DataObject::Pointer > _TDataContainer;
_TDataContainer m_Inputs;
_TDataContainer m_Outputs;
};
+ /**
+ * Plugin provider
+ */
+ CPPLUGINS_PROVIDER_HEADER( ProcessObject );
+
} // ecapseman
} // ecapseman