]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/Plugins.h
Generic MPR+Plugins application base updated.
[cpPlugins.git] / lib / cpPlugins / Interface / Plugins.h
1 #ifndef __CPPLUGINS__INTERFACE__PLUGINS__H__
2 #define __CPPLUGINS__INTERFACE__PLUGINS__H__
3
4 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
5
6 #include <map>
7 #include <set>
8 #include <string>
9
10 #include <cpPlugins/Interface/Interface.h>
11 #include <cpPlugins/Interface/ProcessObject.h>
12 #include <cpPlugins/Interface/Image.h>
13 #include <cpPlugins/Interface/Mesh.h>
14
15 class QObject;
16 class QMenu;
17 class QWidget;
18
19 namespace cpPlugins
20 {
21   namespace Interface
22   {
23     /**
24      */
25     class cpPlugins_Interface_EXPORT Plugins
26     {
27     public:
28       typedef cpPlugins::Interface::Interface     TInterface;
29       typedef cpPlugins::Interface::ProcessObject TProcessObject;
30       typedef cpPlugins::Interface::DataObject    TDataObject;
31       typedef cpPlugins::Interface::Image         TImage;
32       typedef cpPlugins::Interface::Mesh          TMesh;
33       typedef TProcessObject::TParameters         TParameters;
34
35       typedef std::set< std::string >           TOrderedStringContainer;
36       typedef std::map< std::string, std::set< std::string > > TFilters;
37
38     public:
39       Plugins( QWidget* widget = NULL );
40       virtual ~Plugins( );
41
42       QWidget* GetWidget( );
43       const QWidget* GetWidget( ) const;
44       void SetWidget( QWidget* widget );
45       void BlockWidget( );
46       void UnblockWidget( );
47       void DialogLoadPlugins( );
48       void AssociatePluginsToMenu(
49         QMenu* menu, QObject* obj, const char* slot
50         );
51
52       bool LoadPlugins( const std::string& fname );
53       bool LoadPluginsConfigurationFile( const std::string& fname );
54
55       TParameters* GetImageReaderParameters( );
56       TParameters* GetMeshReaderParameters( );
57       TParameters* GetImageWriterParameters( );
58       TParameters* GetMeshWriterParameters( );
59
60       const TParameters* GetImageReaderParameters( ) const;
61       const TParameters* GetMeshReaderParameters( ) const;
62       const TParameters* GetImageWriterParameters( ) const;
63       const TParameters* GetMeshWriterParameters( ) const;
64
65       // Data IO
66       bool ReadImage( TImage::Pointer& image, bool exec_qt = false );
67       bool ReadDicomSeries( TImage::Pointer& image );
68       bool ReadMesh( TMesh::Pointer& mesh, bool exec_qt = false );
69
70       bool WriteImage( TImage* image, bool exec_qt = false );
71       bool WriteMesh( TMesh* mesh, bool exec_qt = false );
72
73       // Filter acces
74       bool CreateFilter(
75         TProcessObject::Pointer& filter, const std::string& name
76         );
77
78     protected:
79       void _Update( );
80
81     protected:
82       QWidget* m_Widget;
83
84       TInterface m_Interface;
85       TOrderedStringContainer m_LoadedPlugins;
86       std::string m_LastLoadedPlugin;
87
88       TProcessObject::Pointer m_ImageReader;
89       TProcessObject::Pointer m_ImageWriter;
90       TProcessObject::Pointer m_MeshReader;
91       TProcessObject::Pointer m_MeshWriter;
92       TProcessObject::Pointer m_DicomSeriesReader;
93       TFilters m_Filters;
94     };
95
96   } // ecapseman
97
98 } // ecapseman
99
100 #endif // __CPPLUGINS__INTERFACE__PLUGINS__H__
101
102 // eof - $RCSfile$