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