]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/ProcessObject.h
Widget integration (step 5/6): generic widget controller finished and tested on linux...
[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     public:
37       itkTypeMacro( ProcessObject, Object );
38       cpPlugins_Id_Macro(
39         cpPlugins::Interface::ProcessObject, "BaseObject"
40         );
41
42     public:
43       virtual const Parameters& GetDefaultParameters( ) const;
44       virtual void SetParameters( const Parameters& params );
45
46       virtual unsigned int GetNumberOfInputs( ) const;
47       virtual unsigned int GetNumberOfOutputs( ) const;
48
49       virtual void SetNumberOfInputs( unsigned int n );
50       virtual void SetNumberOfOutputs( unsigned int n );
51
52       virtual void SetInput( unsigned int idx, DataObject* dobj );
53
54       virtual std::string Update( );
55       virtual void DisconnectOutputs( );
56
57       virtual bool ExecConfigurationDialog( QWidget* parent );
58
59       template< class T >
60         inline T* GetITK( );
61
62       template< class T >
63         inline const T* GetITK( ) const;
64
65       template< class T >
66         inline T* GetVTK( );
67
68       template< class T >
69         inline const T* GetVTK( ) const;
70
71       template< class T >
72         inline T* GetInput( unsigned int idx );
73
74       template< class T >
75         inline const T* GetInput( unsigned int idx ) const;
76
77       template< class T >
78         inline T* GetOutput( unsigned int idx );
79
80       template< class T >
81         inline const T* GetOutput( unsigned int idx ) const;
82
83     protected:
84       ProcessObject( );
85       virtual ~ProcessObject( );
86
87       template< class F >
88         inline F* _CreateITK( );
89
90       template< class F >
91         inline F* _CreateVTK( );
92
93       template< class O >
94         inline void _MakeOutput( unsigned int idx );
95
96       virtual std::string _GenerateData( ) = 0;
97
98     private:
99       // Purposely not implemented
100       ProcessObject( const Self& );
101       Self& operator=( const Self& );
102
103     protected:
104       itk::ProcessObject::Pointer     m_ITKObject;
105       vtkSmartPointer< vtkAlgorithm > m_VTKObject;
106
107       Parameters m_DefaultParameters;
108       Parameters m_Parameters;
109
110       std::vector< DataObject::Pointer > m_Inputs;
111       std::vector< DataObject::Pointer > m_Outputs;
112     };
113
114   } // ecapseman
115
116 } // ecapseman
117
118 #include <cpPlugins/Interface/ProcessObject.hxx>
119
120 #endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
121
122 // eof - $RCSfile$