1 #ifndef __cpPlugins__BaseObjects__ProcessObject__h__
2 #define __cpPlugins__BaseObjects__ProcessObject__h__
4 #include <cpPlugins/BaseObjects/Object.h>
5 #include <cpPlugins/BaseObjects/Parameters.h>
6 #include <cpPlugins/BaseObjects/Port.h>
9 // -------------------------------------------------------------------------
11 class vtkRenderWindowInteractor;
13 // -------------------------------------------------------------------------
20 class cpPlugins_EXPORT ProcessObject
24 typedef ProcessObject Self;
25 typedef Object Superclass;
26 typedef itk::SmartPointer< Self > Pointer;
27 typedef itk::SmartPointer< const Self > ConstPointer;
30 itkTypeMacro( ProcessObject, Object );
31 cpPlugins_Id_Macro( ProcessObject, Object );
33 itkBooleanMacro( ExplicitExecution );
35 itkGetStringMacro( Name );
36 itkGetStringMacro( PluginName );
37 itkGetConstMacro( ExplicitExecution, bool );
38 itkGetConstMacro( LastExecutionSpan, long );
40 itkSetStringMacro( Name );
41 itkSetStringMacro( PluginName );
42 itkSetMacro( ExplicitExecution, bool );
45 void PrintExecutionOn( );
46 void PrintExecutionOff( );
47 bool GetPrintExecution( ) const;
48 bool SetPrintExecution( bool v );
49 void SetPrintExecutionStream( std::ofstream* s );
51 Parameters* GetParameters( );
52 const Parameters* GetParameters( ) const;
54 virtual void SetITK( itk::LightObject* o ) final;
55 virtual void SetVTK( vtkObjectBase* o ) final;
58 std::set< std::string > GetInputsNames( ) const;
59 std::set< std::string > GetOutputsNames( ) const;
60 bool HasInput( const std::string& n ) const;
61 bool HasOutput( const std::string& n ) const;
63 unsigned int GetNumberOfInputs( ) const;
64 unsigned int GetNumberOfOutputs( ) const;
65 unsigned int GetInputSize( const std::string& n ) const;
66 bool IsInputMultiple( const std::string& n ) const;
68 template< class _TType = DataObject >
69 inline _TType* GetInput( const std::string& n, unsigned int i = 0 );
71 template< class _TType = DataObject >
72 inline const _TType* GetInput(
73 const std::string& n, unsigned int i = 0
76 template< class _TType = itk::LightObject >
77 inline _TType* GetInputData( const std::string& n, unsigned int i = 0 );
79 template< class _TType = itk::LightObject >
80 inline const _TType* GetInputData(
81 const std::string& n, unsigned int i = 0
84 template< class _TType = DataObject >
85 inline _TType* GetOutput( const std::string& n );
87 template< class _TType = DataObject >
88 inline const _TType* GetOutput( const std::string& n ) const;
90 template< class _TType = itk::LightObject >
91 inline _TType* GetOutputData( const std::string& n );
93 template< class _TType = itk::LightObject >
94 inline const _TType* GetOutputData( const std::string& n ) const;
97 virtual void AddInput( const std::string& n, DataObject* o );
98 virtual void SetInput( const std::string& n, DataObject* o );
100 // Other interesting methods
101 void DisconnectInput( const std::string& n, unsigned int id );
102 void DisconnectInputs( );
103 void DisconnectOutputs( );
106 // Pipeline execution
107 virtual void Modified( ) const cpPlugins_OVERRIDE;
108 virtual void Update( );
110 // Qt dialog creation
111 virtual QDialog* CreateQDialog( );
112 virtual void AddInteractor( vtkRenderWindowInteractor* i );
113 virtual bool IsInteractive( );
117 virtual ~ProcessObject( );
119 // Error handling method
120 void _Error( const std::string& error );
122 // For configuration purposes
123 template< class _TType = DataObject >
124 inline void _ConfigureInput(
125 const std::string& name, bool required, bool multiple
128 template< class _TType = DataObject >
129 inline void _ConfigureOutput( const std::string& name );
131 template< class _TFilter >
132 inline _TFilter* _CreateITK( );
134 template< class _TFilter >
135 inline _TFilter* _CreateVTK( );
137 virtual void _GenerateData( ) = 0;
140 // Purposely not implemented
141 ProcessObject( const Self& );
142 Self& operator=( const Self& );
145 Parameters m_Parameters;
147 std::string m_PluginName;
148 bool m_ExplicitExecution;
150 std::map< std::string, Port* > m_Inputs;
151 std::map< std::string, Port* > m_Outputs;
153 itk::ModifiedTimeType m_LastExecutionTime;
154 mutable long m_LastExecutionSpan;
156 bool m_PrintExecution;
157 std::ostream* m_PrintExecutionStream;
164 #include <cpPlugins/BaseObjects/ProcessObject.hxx>
166 #endif // __cpPlugins__BaseObjects__ProcessObject__h__