X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FProcessObject.h;h=e139c994d5e86f9107963ae6acea31fcd626d564;hb=6ffc11d77924d6ab7e94db95d41105982ac73e00;hp=b84ad3ed6dd956fd02b9895f39b66931859e8a71;hpb=f2f39f66027a98bd8dac50bade5618e0136bbefa;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/ProcessObject.h b/lib/cpPlugins/Interface/ProcessObject.h index b84ad3e..e139c99 100644 --- a/lib/cpPlugins/Interface/ProcessObject.h +++ b/lib/cpPlugins/Interface/ProcessObject.h @@ -1,27 +1,29 @@ #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ -#include -#include -#include -#include -#include - -#ifdef cpPlugins_Interface_QT4 -class QWidget; -#else -typedef char QWidget -#endif // cpPlugins_Interface_QT4 +#include +#include -#include +#include +#include +#include -#include -#include +// Some forward declarations +class vtkRenderWindowInteractor; namespace cpPlugins { namespace Interface { + // Some forward declarations +#ifdef cpPlugins_Interface_QT4 + class ParametersQtDialog; + class SimpleMPRWidget; +#else + typedef char ParametersQtDialog; + typedef char SimpleMPRWidget; +#endif // cpPlugins_Interface_QT4 + /** */ class cpPlugins_Interface_EXPORT ProcessObject @@ -33,66 +35,71 @@ namespace cpPlugins typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; - public: - itkTypeMacro( ProcessObject, Object ); - cpPlugins_Id_Macro( - cpPlugins::Interface::ProcessObject, "BaseObject" - ); + typedef Parameters TParameters; + typedef std::set< vtkRenderWindowInteractor* > TInteractors; + typedef bool DialogResult; public: - virtual const Parameters& GetDefaultParameters( ) const; - virtual void SetParameters( const Parameters& params ); + itkTypeMacro( ProcessObject, Object ); + cpPlugins_Id_Macro( ProcessObject, BaseObject ); - virtual unsigned int GetNumberOfInputs( ) const; - virtual unsigned int GetNumberOfOutputs( ) const; + itkGetConstObjectMacro( Parameters, TParameters ); - virtual void SetNumberOfInputs( unsigned int n ); - virtual void SetNumberOfOutputs( unsigned int n ); + itkGetObjectMacro( Parameters, TParameters ); + itkGetMacro( ParametersDialog, ParametersQtDialog* ); + itkGetMacro( SingleInteractor, vtkRenderWindowInteractor* ); + itkGetMacro( MPRViewer, SimpleMPRWidget* ); - virtual void SetInput( unsigned int idx, DataObject* dobj ); + itkSetObjectMacro( ParametersDialog, ParametersQtDialog ); + itkSetObjectMacro( SingleInteractor, vtkRenderWindowInteractor ); + itkSetObjectMacro( MPRViewer, SimpleMPRWidget ); - virtual std::string Update( ); - virtual void DisconnectOutputs( ); + public: + virtual void SetITK( itk::LightObject* o ); + virtual void SetVTK( vtkObjectBase* o ); - virtual bool ExecConfigurationDialog( QWidget* parent ); + // IO management + std::set< std::string > GetInputsNames( ) const; + std::set< std::string > GetOutputsNames( ) const; + unsigned int GetNumberOfInputs( ) const; + unsigned int GetNumberOfOutputs( ) const; - template< class T > - inline T* GetITK( ); + OutputProcessObjectPort& GetOutput( const std::string& id ); + const OutputProcessObjectPort& GetOutput( const std::string& id ) const; template< class T > - inline const T* GetITK( ) const; - + inline T* GetInputData( const std::string& id ); template< class T > - inline T* GetVTK( ); - + inline const T* GetInputData( const std::string& id ) const; template< class T > - inline const T* GetVTK( ) const; - + inline T* GetOutputData( const std::string& id ); template< class T > - inline T* GetInput( unsigned int idx ); + inline const T* GetOutputData( const std::string& id ) const; - template< class T > - inline const T* GetInput( unsigned int idx ) const; + bool SetInput( + const std::string& id, const OutputProcessObjectPort& port + ); - template< class T > - inline T* GetOutput( unsigned int idx ); + void DisconnectInputs( ); + void DisconnectOutputs( ); + void Disconnect( ); - template< class T > - inline const T* GetOutput( unsigned int idx ) const; + // Pipeline execution + virtual itk::ModifiedTimeType GetMTime( ) const; + virtual std::string Update( ); protected: ProcessObject( ); virtual ~ProcessObject( ); + void _AddInput( const std::string& name, bool required = true ); + template< class O > + inline void _AddOutput( const std::string& name ); template< class F > inline F* _CreateITK( ); - template< class F > inline F* _CreateVTK( ); - template< class O > - inline void _MakeOutput( unsigned int idx ); - virtual std::string _GenerateData( ) = 0; private: @@ -101,14 +108,17 @@ namespace cpPlugins Self& operator=( const Self& ); protected: - itk::ProcessObject::Pointer m_ITKObject; - vtkSmartPointer< vtkAlgorithm > m_VTKObject; + typedef std::map< std::string, InputProcessObjectPort > _TInputs; + typedef std::map< std::string, OutputProcessObjectPort > _TOutputs; + _TInputs m_Inputs; + _TOutputs m_Outputs; + Parameters::Pointer m_Parameters; - Parameters m_DefaultParameters; - Parameters m_Parameters; + itk::ModifiedTimeType m_LastExecutionTime; - std::vector< DataObject::Pointer > m_Inputs; - std::vector< DataObject::Pointer > m_Outputs; + ParametersQtDialog* m_ParametersDialog; + vtkRenderWindowInteractor* m_SingleInteractor; + SimpleMPRWidget* m_MPRViewer; }; } // ecapseman