1 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
2 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
6 #include <itkDataObject.h>
8 #include <cpPlugins/Interface/DataObject.h>
9 #include <cpPlugins/Interface/Parameters.h>
11 // Some forward declarations
12 class vtkRenderWindowInteractor;
13 #ifdef cpPlugins_Interface_QT4
17 #endif // cpPlugins_Interface_QT4
23 // Some forward declarations
24 #ifdef cpPlugins_Interface_QT4
25 class ParametersQtDialog;
26 class SimpleMPRWidget;
28 typedef char ParametersQtDialog;
29 typedef char SimpleMPRWidget;
30 #endif // cpPlugins_Interface_QT4
34 class cpPlugins_Interface_EXPORT ProcessObject
38 typedef ProcessObject Self;
39 typedef Object Superclass;
40 typedef itk::SmartPointer< Self > Pointer;
41 typedef itk::SmartPointer< const Self > ConstPointer;
43 typedef Parameters TParameters;
44 typedef std::set< vtkRenderWindowInteractor* > TInteractors;
45 typedef bool DialogResult;
48 itkTypeMacro( ProcessObject, Object );
49 cpPlugins_Id_Macro( ProcessObject, BaseObject );
51 itkBooleanMacro( Interactive );
52 itkGetConstMacro( Interactive, bool );
53 itkSetMacro( Interactive, bool );
55 itkGetConstObjectMacro( Parameters, TParameters );
56 itkGetObjectMacro( Parameters, TParameters );
59 virtual std::set< std::string > GetInputsNames( ) const;
60 virtual std::set< std::string > GetOutputsNames( ) const;
61 unsigned int GetNumberOfInputs( ) const;
62 unsigned int GetNumberOfOutputs( ) const;
64 virtual bool SetInput( const std::string& id, DataObject::Pointer* dobj );
66 virtual std::string Update( );
67 virtual void DisconnectOutputs( );
70 vtkRenderWindowInteractor* GetSingleInteractor( );
71 const vtkRenderWindowInteractor* GetSingleInteractor( ) const;
72 void SetSingleInteractor( vtkRenderWindowInteractor* interactor );
73 SimpleMPRWidget* GetMPRViewer( );
74 const SimpleMPRWidget* GetMPRViewer( ) const;
75 void SetMPRViewer( SimpleMPRWidget* wdg );
76 virtual bool ExecConfigurationDialog( QWidget* parent );
79 inline T* GetInputData( const std::string& id );
82 inline const T* GetInputData( const std::string& id ) const;
85 inline T* GetOutputData( const std::string& id );
88 inline const T* GetOutputData( const std::string& id ) const;
90 DataObject::Pointer* GetOutputPort( const std::string& id )
92 auto i = this->m_Outputs.find( id );
93 if( i != this->m_Outputs.end( ) )
99 const DataObject::Pointer* GetOutputPort( const std::string& id ) const
101 auto i = this->m_Outputs.find( id );
102 if( i != this->m_Outputs.end( ) )
110 virtual ~ProcessObject( );
112 virtual void _AddInput( const std::string& name );
115 inline void _AddOutput( const std::string& id );
118 inline F* _CreateITK( );
121 inline F* _CreateVTK( );
123 virtual std::string _GenerateData( ) = 0;
126 // Purposely not implemented
127 ProcessObject( const Self& );
128 Self& operator=( const Self& );
131 Parameters::Pointer m_Parameters;
132 ParametersQtDialog* m_ParametersDialog;
134 vtkSmartPointer< vtkRenderWindowInteractor > m_SingleInteractor;
135 SimpleMPRWidget* m_MPRViewer;
138 typedef std::map< std::string, DataObject::Pointer* > _TDataContainer;
139 _TDataContainer m_Inputs;
140 _TDataContainer m_Outputs;
147 #include <cpPlugins/Interface/ProcessObject.hxx>
149 #endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__