X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FcpPlugins%2FInterface%2FProcessObject.h;h=e139c994d5e86f9107963ae6acea31fcd626d564;hb=6ffc11d77924d6ab7e94db95d41105982ac73e00;hp=ec6cb2a53bb7a69fe96d3d166691f2ec8d58666c;hpb=1b600247da314fe62d007ca8a0ce24d0006931f4;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/ProcessObject.h b/lib/cpPlugins/Interface/ProcessObject.h index ec6cb2a..e139c99 100644 --- a/lib/cpPlugins/Interface/ProcessObject.h +++ b/lib/cpPlugins/Interface/ProcessObject.h @@ -1,20 +1,15 @@ #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ +#include #include #include - -#include +#include #include // Some forward declarations class vtkRenderWindowInteractor; -#ifdef cpPlugins_Interface_QT4 -class QWidget; -#else -typedef char QWidget; -#endif // cpPlugins_Interface_QT4 namespace cpPlugins { @@ -48,75 +43,60 @@ namespace cpPlugins itkTypeMacro( ProcessObject, Object ); cpPlugins_Id_Macro( ProcessObject, BaseObject ); - itkBooleanMacro( Interactive ); - itkGetConstMacro( Interactive, bool ); - itkSetMacro( Interactive, bool ); - itkGetConstObjectMacro( Parameters, TParameters ); + itkGetObjectMacro( Parameters, TParameters ); + itkGetMacro( ParametersDialog, ParametersQtDialog* ); + itkGetMacro( SingleInteractor, vtkRenderWindowInteractor* ); + itkGetMacro( MPRViewer, SimpleMPRWidget* ); + + itkSetObjectMacro( ParametersDialog, ParametersQtDialog ); + itkSetObjectMacro( SingleInteractor, vtkRenderWindowInteractor ); + itkSetObjectMacro( MPRViewer, SimpleMPRWidget ); public: - virtual std::set< std::string > GetInputsNames( ) const; - virtual std::set< std::string > GetOutputsNames( ) const; + virtual void SetITK( itk::LightObject* o ); + virtual void SetVTK( vtkObjectBase* o ); + + // IO management + std::set< std::string > GetInputsNames( ) const; + std::set< std::string > GetOutputsNames( ) const; unsigned int GetNumberOfInputs( ) const; unsigned int GetNumberOfOutputs( ) const; - virtual bool SetInput( const std::string& id, DataObject::Pointer* dobj ); - - virtual std::string Update( ); - virtual void DisconnectOutputs( ); - - // Widgets management - vtkRenderWindowInteractor* GetSingleInteractor( ); - const vtkRenderWindowInteractor* GetSingleInteractor( ) const; - void SetSingleInteractor( vtkRenderWindowInteractor* interactor ); - SimpleMPRWidget* GetMPRViewer( ); - const SimpleMPRWidget* GetMPRViewer( ) const; - void SetMPRViewer( SimpleMPRWidget* wdg ); - virtual bool ExecConfigurationDialog( QWidget* parent ); + OutputProcessObjectPort& GetOutput( const std::string& id ); + const OutputProcessObjectPort& GetOutput( const std::string& id ) const; template< class T > inline T* GetInputData( const std::string& id ); - template< class T > inline const T* GetInputData( const std::string& id ) const; - template< class T > inline T* GetOutputData( const std::string& id ); - template< class T > inline const T* GetOutputData( const std::string& id ) const; - DataObject::Pointer* GetOutputPort( const std::string& id ) - { - auto i = this->m_Outputs.find( id ); - if( i != this->m_Outputs.end( ) ) - return( i->second ); - else - return( NULL ); - } - - const DataObject::Pointer* GetOutputPort( const std::string& id ) const - { - auto i = this->m_Outputs.find( id ); - if( i != this->m_Outputs.end( ) ) - return( i->second ); - else - return( NULL ); - } + bool SetInput( + const std::string& id, const OutputProcessObjectPort& port + ); + + void DisconnectInputs( ); + void DisconnectOutputs( ); + void Disconnect( ); + + // Pipeline execution + virtual itk::ModifiedTimeType GetMTime( ) const; + virtual std::string Update( ); protected: ProcessObject( ); virtual ~ProcessObject( ); - virtual void _AddInput( const std::string& name ); - + void _AddInput( const std::string& name, bool required = true ); template< class O > - inline void _AddOutput( const std::string& id ); - + inline void _AddOutput( const std::string& name ); template< class F > inline F* _CreateITK( ); - template< class F > inline F* _CreateVTK( ); @@ -128,16 +108,17 @@ namespace cpPlugins Self& operator=( const Self& ); protected: + typedef std::map< std::string, InputProcessObjectPort > _TInputs; + typedef std::map< std::string, OutputProcessObjectPort > _TOutputs; + _TInputs m_Inputs; + _TOutputs m_Outputs; Parameters::Pointer m_Parameters; - ParametersQtDialog* m_ParametersDialog; - vtkSmartPointer< vtkRenderWindowInteractor > m_SingleInteractor; - SimpleMPRWidget* m_MPRViewer; - bool m_Interactive; + itk::ModifiedTimeType m_LastExecutionTime; - typedef std::map< std::string, DataObject::Pointer* > _TDataContainer; - _TDataContainer m_Inputs; - _TDataContainer m_Outputs; + ParametersQtDialog* m_ParametersDialog; + vtkRenderWindowInteractor* m_SingleInteractor; + SimpleMPRWidget* m_MPRViewer; }; } // ecapseman