1 #ifndef __CPPLUGINS__INTERFACE__PLUGINS__H__
2 #define __CPPLUGINS__INTERFACE__PLUGINS__H__
4 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
10 #include <cpPlugins/Interface/Interface.h>
11 #include <cpPlugins/Interface/ProcessObject.h>
12 #include <cpPlugins/Interface/Image.h>
13 #include <cpPlugins/Interface/Mesh.h>
18 class vtkRenderWindowInteractor;
24 class BasePluginsApplication;
28 class cpPlugins_Interface_EXPORT Plugins
31 typedef cpPlugins::Interface::Interface TInterface;
32 typedef cpPlugins::Interface::ProcessObject TProcessObject;
33 typedef cpPlugins::Interface::DataObject TDataObject;
34 typedef cpPlugins::Interface::Image TImage;
35 typedef cpPlugins::Interface::Mesh TMesh;
36 typedef TProcessObject::TParameters TParameters;
38 typedef std::set< std::string > TOrderedStringContainer;
39 typedef std::map< std::string, std::set< std::string > > TFilters;
40 typedef std::pair< std::string, TDataObject::Pointer > TTreeNode;
41 typedef std::map< std::string, TTreeNode > TTree;
44 Plugins( QWidget* widget = NULL );
47 QWidget* GetWidget( );
48 const QWidget* GetWidget( ) const;
49 void SetWidget( QWidget* widget );
51 void UnblockWidget( );
52 void DialogLoadPlugins( );
53 void AssociatePluginsToMenu(
54 QMenu* menu, QObject* obj, const char* slot
57 BasePluginsApplication* GetApplication( );
58 const BasePluginsApplication* GetApplication( ) const;
59 void SetApplication( BasePluginsApplication* a );
62 bool LoadPlugins( const std::string& fname );
63 bool LoadPluginsConfigurationFile( const std::string& fname );
66 void AddInteractor( vtkRenderWindowInteractor* interactor );
67 void RemoveInteractor( vtkRenderWindowInteractor* interactor );
68 void ClearInteractors( );
71 bool HasImageReader( ) const;
72 bool HasDicomSeriesReader( ) const;
73 bool HasMeshReader( ) const;
74 bool HasImageWriter( ) const;
75 bool HasMeshWriter( ) const;
77 std::string ReadImage(
78 const std::string& fname, const std::string& parent
80 std::string ReadImage(
81 const std::vector< std::string >& fnames, const std::string& parent
83 std::string ReadImage( const std::string& parent );
84 std::string ReadDicomSeries( const std::string& parent );
86 const std::string& fname, const std::string& parent
88 std::string ReadMesh( const std::string& parent );
90 bool WriteImage( const std::string& fname, const std::string& name );
91 bool WriteImage( const std::string& name );
92 bool WriteMesh( const std::string& fname, const std::string& name );
93 bool WriteMesh( const std::string& name );
96 void ClearDataObjects( );
97 void DeleteDataObject( const std::string& name );
98 std::string GetParent( const std::string& name ) const;
99 const TTree& GetDataObjects( ) const;
100 TDataObject* GetDataObject( const std::string& name );
101 const TDataObject* GetDataObject( const std::string& name ) const;
102 TImage* GetImage( const std::string& name );
103 const TImage* GetImage( const std::string& name ) const;
104 TMesh* GetMesh( const std::string& name );
105 const TMesh* GetMesh( const std::string& name ) const;
108 bool ActivateFilter( const std::string& name );
109 void DeactivateFilter( );
110 bool HasActiveFilter( ) const;
111 bool IsActiveFilterInteractive( ) const;
112 unsigned int GetNumberOfInputsInActiveFilter( ) const;
113 unsigned int GetNumberOfOutputsInActiveFilter( ) const;
114 std::vector< std::string > GetActiveFilterInputsNames( ) const;
115 std::vector< std::string > GetActiveFilterOutputsNames( ) const;
116 void ConnectInputInActiveFilter(
117 const std::string& object_name, const std::string& input
119 void SetOutputNameInActiveFilter(
120 const std::string& new_name, const std::string& output
122 TParameters* GetActiveFilterParameters( );
123 const TParameters* GetActiveFilterParameters( ) const;
124 TProcessObject::DialogResult ConfigureActiveFilter( );
125 std::string UpdateActiveFilter( std::vector< std::string >& outputs );
128 void _UpdateLoadedPluginsInformation( );
129 bool _InsertNewData( TDataObject* dobj, const std::string& parent );
133 BasePluginsApplication* m_Application;
135 TInterface m_Interface;
136 TOrderedStringContainer m_LoadedPlugins;
137 std::string m_LastLoadedPlugin;
139 TProcessObject::Pointer m_ImageReader;
140 TProcessObject::Pointer m_ImageWriter;
141 TProcessObject::Pointer m_MeshReader;
142 TProcessObject::Pointer m_MeshWriter;
143 TProcessObject::Pointer m_DicomSeriesReader;
144 TProcessObject::Pointer m_ActiveFilter;
145 std::map< std::string, std::string > m_ActiveFilterOutputs;
151 // Associated interactors
152 std::set< vtkRenderWindowInteractor* > m_Interactors;
159 #endif // __CPPLUGINS__INTERFACE__PLUGINS__H__