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 );
59 bool LoadPlugins( const std::string& fname );
60 bool LoadPluginsConfigurationFile( const std::string& fname );
61 const TStringContainer& GetLoadedPlugins( ) const;
62 void GetLoadedFilters( TStringContainer& filters ) const;
63 const TStringContainer& GetLoadedFilters(
64 const std::string& plugin
68 void AddInteractor( vtkRenderWindowInteractor* interactor );
69 void RemoveInteractor( vtkRenderWindowInteractor* interactor );
70 void ClearInteractors( );
73 bool HasImageReader( ) const;
74 bool HasDicomSeriesReader( ) const;
75 bool HasMeshReader( ) const;
76 bool HasImageWriter( ) const;
77 bool HasMeshWriter( ) const;
79 std::string ReadImage(
80 const std::string& fname, const std::string& parent
82 std::string ReadImage(
83 const std::vector< std::string >& fnames, const std::string& parent
85 std::string ReadImage( const std::string& parent );
86 std::string ReadDicomSeries( const std::string& parent );
88 const std::string& fname, const std::string& parent
90 std::string ReadMesh( const std::string& parent );
92 std::string WriteDataObject(
93 const std::string& fname, const std::string& name
95 std::string WriteDataObject( const std::string& name );
98 void ClearDataObjects( );
99 void DeleteDataObject( const std::string& name );
100 void GetDataObjects( TStringContainer& names );
101 std::string GetParent( const std::string& name ) const;
103 TStringContainer& names, const std::string& name
105 void GetRoots( TStringContainer& names ) const;
108 inline T* GetData( const std::string& name );
111 inline const T* GetData( const std::string& name ) const;
114 bool ActivateFilter( const std::string& name );
115 void DeactivateFilter( );
116 bool HasActiveFilter( ) const;
117 bool IsActiveFilterInteractive( ) const;
118 void GetActiveFilterInputsNames( TStringContainer& names ) const;
119 void GetActiveFilterOutputsNames( TStringContainer& names ) const;
120 bool ConnectInputInActiveFilter(
121 const std::string& object_name, const std::string& input_name
123 bool SetOutputNameInActiveFilter(
124 const std::string& new_object_name, const std::string& output_name
126 TParameters* GetActiveFilterParameters( );
127 const TParameters* GetActiveFilterParameters( ) const;
128 TProcessObject::DialogResult ConfigureActiveFilter( );
129 std::string UpdateActiveFilter( );
132 void _UpdateLoadedPluginsInformation( );
133 bool _InsertNewData( TDataObject* dobj, const std::string& parent );
138 BaseApplication* m_Application;
141 TInterface* m_Interface;
142 TStringContainer m_LoadedPlugins;
143 std::string m_LastLoadedPlugin;
144 std::map< std::string, TStringContainer > m_LoadedFilters;
147 std::map< std::string, TProcessObject::Pointer > m_IOFilters;
148 TProcessObject::Pointer m_ActiveFilter;
149 std::map< std::string, std::string > m_ActiveFilterOutputs;
151 // Loaded data objects
152 typedef std::pair< std::string, TDataObject::Pointer > _TTreeNode;
153 std::map< std::string, _TTreeNode > m_DataObjects;
155 // Associated interactors
156 std::set< vtkRenderWindowInteractor* > m_Interactors;
163 #include <cpPlugins/Interface/Plugins.hxx>
165 #endif // __CPPLUGINS__INTERFACE__PLUGINS__H__