]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/ProcessObject.h
Widget integration (step 5/6): Interactive plugins now supported, widgets updates...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.h
1 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
2 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
3
4 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
5 #include <cpPlugins/Interface/Config.h>
6 #include <cpPlugins/Interface/Object.h>
7 #include <cpPlugins/Interface/DataObject.h>
8 #include <cpPlugins/Interface/Parameters.h>
9
10 #ifdef cpPlugins_Interface_QT4
11 class QWidget;
12 #else
13 typedef char QWidget
14 #endif // cpPlugins_Interface_QT4
15
16 #include <itkProcessObject.h>
17
18 #include <vtkSmartPointer.h>
19 #include <vtkAlgorithm.h>
20
21 namespace cpPlugins
22 {
23   namespace Interface
24   {
25     /**
26      */
27     class cpPlugins_Interface_EXPORT ProcessObject
28       : public Object
29     {
30     public:
31       typedef ProcessObject                   Self;
32       typedef Object                          Superclass;
33       typedef itk::SmartPointer< Self >       Pointer;
34       typedef itk::SmartPointer< const Self > ConstPointer;
35
36       typedef Parameters TParameters;
37
38     public:
39       itkTypeMacro( ProcessObject, Object );
40       cpPlugins_Id_Macro(
41         cpPlugins::Interface::ProcessObject, "BaseObject"
42         );
43
44     public:
45       virtual TParameters* GetParameters( );
46       virtual const TParameters* GetParameters( ) const;
47
48       virtual unsigned int GetNumberOfInputs( ) const;
49       virtual unsigned int GetNumberOfOutputs( ) const;
50
51       virtual void SetNumberOfInputs( unsigned int n );
52       virtual void SetNumberOfOutputs( unsigned int n );
53
54       virtual void SetInput( unsigned int idx, DataObject* dobj );
55
56       virtual std::string Update( );
57       virtual void DisconnectOutputs( );
58
59       virtual bool ExecConfigurationDialog( QWidget* parent );
60
61       template< class T >
62         inline T* GetITK( );
63
64       template< class T >
65         inline const T* GetITK( ) const;
66
67       template< class T >
68         inline T* GetVTK( );
69
70       template< class T >
71         inline const T* GetVTK( ) const;
72
73       template< class T >
74         inline T* GetInput( unsigned int idx );
75
76       template< class T >
77         inline const T* GetInput( unsigned int idx ) const;
78
79       template< class T >
80         inline T* GetOutput( unsigned int idx );
81
82       template< class T >
83         inline const T* GetOutput( unsigned int idx ) const;
84
85     protected:
86       ProcessObject( );
87       virtual ~ProcessObject( );
88
89       template< class F >
90         inline F* _CreateITK( );
91
92       template< class F >
93         inline F* _CreateVTK( );
94
95       template< class O >
96         inline void _MakeOutput( unsigned int idx );
97
98       virtual std::string _GenerateData( ) = 0;
99
100     private:
101       // Purposely not implemented
102       ProcessObject( const Self& );
103       Self& operator=( const Self& );
104
105     protected:
106       itk::ProcessObject::Pointer     m_ITKObject;
107       vtkSmartPointer< vtkAlgorithm > m_VTKObject;
108
109       Parameters::Pointer m_Parameters;
110
111       std::vector< DataObject::Pointer > m_Inputs;
112       std::vector< DataObject::Pointer > m_Outputs;
113     };
114
115   } // ecapseman
116
117 } // ecapseman
118
119 #include <cpPlugins/Interface/ProcessObject.hxx>
120
121 #endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
122
123 // eof - $RCSfile$