1 #ifndef __CPPLUGINS__INTERFACE__PLUGINS__H__
2 #define __CPPLUGINS__INTERFACE__PLUGINS__H__
4 #include <cpPlugins/Interface/Interface.h>
5 #include <cpPlugins/Interface/DataObject.h>
6 #include <cpPlugins/Interface/ProcessObject.h>
13 // Some forward declarations
14 class vtkRenderWindowInteractor;
15 #ifdef cpPlugins_Interface_QT4
19 #endif // cpPlugins_Interface_QT4
25 // Some forward declarations
26 class BaseApplication;
30 class cpPlugins_Interface_EXPORT Plugins
33 typedef cpPlugins::Interface::Interface TInterface;
34 typedef cpPlugins::Interface::ProcessObject TProcessObject;
35 typedef cpPlugins::Interface::DataObject TDataObject;
36 typedef TProcessObject::TParameters TParameters;
38 typedef std::set< std::string > TStringContainer;
44 // Qt oriented methods
45 QWidget* GetWidget( );
46 const QWidget* GetWidget( ) const;
47 void SetWidget( QWidget* widget );
49 void UnblockWidget( );
50 void DialogLoadPlugins( );
52 // Connection to main application
53 BaseApplication* GetApplication( );
54 const BaseApplication* GetApplication( ) const;
55 void SetApplication( BaseApplication* a );
58 bool LoadPluginsPath( const std::string& path, bool r = false );
59 bool LoadPlugins( const std::string& fname );
60 bool LoadPluginsConfigurationFile( const std::string& fname );
61 const TStringContainer& GetLoadedPlugins( ) const;
62 void GetLoadedCategories( TStringContainer& categories ) const;
63 void GetLoadedFilters( TStringContainer& filters ) const;
64 const TStringContainer& GetLoadedFilters(
65 const std::string& category
69 void AddInteractor( vtkRenderWindowInteractor* interactor );
70 void RemoveInteractor( vtkRenderWindowInteractor* interactor );
71 void ClearInteractors( );
74 bool HasImageReader( ) const;
75 bool HasDicomSeriesReader( ) const;
76 bool HasMeshReader( ) const;
77 bool HasImageWriter( ) const;
78 bool HasMeshWriter( ) const;
80 std::string ReadImage(
81 const std::string& fname, const std::string& parent
83 std::string ReadImage(
84 const std::vector< std::string >& fnames, const std::string& parent
86 std::string ReadImage( const std::string& parent );
87 std::string ReadDicomSeries( const std::string& parent );
89 const std::string& fname, const std::string& parent
91 std::string ReadMesh( const std::string& parent );
94 const std::string& fname, const std::string& name
96 bool WriteDataObject( const std::string& name );
99 void ClearDataObjects( );
100 void DeleteDataObject( const std::string& name );
101 void GetDataObjects( TStringContainer& names );
102 std::string GetParent( const std::string& name ) const;
104 TStringContainer& names, const std::string& name
106 void GetRoots( TStringContainer& names ) const;
109 inline T* GetData( const std::string& name );
112 inline const T* GetData( const std::string& name ) const;
115 bool ActivateFilter( const std::string& name );
116 void DeactivateFilter( );
117 bool HasActiveFilter( ) const;
118 bool IsActiveFilterInteractive( ) const;
119 void GetActiveFilterInputsNames( TStringContainer& names ) const;
120 void GetActiveFilterOutputsNames( TStringContainer& names ) const;
121 bool ConnectInputInActiveFilter(
122 const std::string& object_name, const std::string& input_name
124 bool SetOutputNameInActiveFilter(
125 const std::string& new_object_name, const std::string& output_name
127 TParameters* GetActiveFilterParameters( );
128 const TParameters* GetActiveFilterParameters( ) const;
129 TProcessObject::DialogResult ConfigureActiveFilter( );
130 bool UpdateActiveFilter(
131 TStringContainer& outputs,
132 const std::string& parent
136 void _UpdateLoadedPluginsInformation( );
137 bool _ActivateIOFilter( const std::string& filter );
138 std::string _ReadData( const std::string& parent );
139 bool _WriteData( const std::string& name );
140 bool _InsertNewData( TDataObject* dobj, const std::string& parent );
145 BaseApplication* m_Application;
148 TInterface m_Interface;
149 TStringContainer m_LoadedPlugins;
150 std::string m_LastLoadedPlugin;
151 std::map< std::string, TStringContainer > m_LoadedFilters;
154 std::map< std::string, TProcessObject::Pointer > m_IOFilters;
155 TProcessObject::Pointer m_ActiveFilter;
157 // Loaded data objects
158 typedef std::pair< std::string, TDataObject::Pointer > _TTreeNode;
159 std::map< std::string, _TTreeNode > m_DataObjects;
161 // Associated interactors
162 std::set< vtkRenderWindowInteractor* > m_Interactors;
169 #include <cpPlugins/Interface/Plugins.hxx>
171 #endif // __CPPLUGINS__INTERFACE__PLUGINS__H__