X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FProcessObject.h;h=ddd1c21aa150ad2cd38987e82ad1bfb4f76d3677;hb=35d769c683c10f5c18d17a3e423d89f5b30a5b77;hp=aa7dea35fbf39d724e74ea8d066b27593f0518c4;hpb=c29448936abc15d110205b2da435035131398a87;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/ProcessObject.h b/lib/cpPlugins/Interface/ProcessObject.h index aa7dea3..ddd1c21 100644 --- a/lib/cpPlugins/Interface/ProcessObject.h +++ b/lib/cpPlugins/Interface/ProcessObject.h @@ -1,17 +1,33 @@ #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ -#include -#include +#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 { namespace Interface { - class DataObject; + // Some forward declarations +#ifdef cpPlugins_Interface_QT4 + class ParametersQtDialog; + class SimpleMPRWidget; +#else + typedef char ParametersQtDialog; + typedef char SimpleMPRWidget; +#endif // cpPlugins_Interface_QT4 /** */ @@ -19,48 +35,104 @@ namespace cpPlugins : public Object { public: - typedef ProcessObject Self; - typedef Object Superclass; + typedef ProcessObject Self; + typedef Object Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; - typedef std::pair< std::string, std::string > TParameter; - typedef std::map< std::string, TParameter > TParameters; + typedef Parameters TParameters; + typedef std::set< vtkRenderWindowInteractor* > TInteractors; + typedef bool DialogResult; public: - ProcessObject( ); - virtual ~ProcessObject( ); + itkTypeMacro( ProcessObject, Object ); + cpPlugins_Id_Macro( ProcessObject, BaseObject ); - virtual std::string GetClassName( ) const; - virtual const TParameters& GetDefaultParameters( ) const; - virtual void SetParameters( const TParameters& params ); + itkBooleanMacro( Interactive ); + itkGetConstMacro( Interactive, bool ); + itkSetMacro( Interactive, bool ); - virtual unsigned int GetNumberOfInputs( ) const; - virtual unsigned int GetNumberOfOutputs( ) const; + itkGetConstObjectMacro( Parameters, TParameters ); + itkGetObjectMacro( Parameters, TParameters ); - virtual void SetNumberOfInputs( unsigned int n ); - virtual void SetNumberOfOutputs( unsigned int n ); + public: + virtual std::set< std::string > GetInputsNames( ) const; + virtual std::set< std::string > GetOutputsNames( ) const; + unsigned int GetNumberOfInputs( ) const; + unsigned int GetNumberOfOutputs( ) const; - virtual void SetInput( unsigned int idx, const DataObject* dobj ); - virtual DataObject* GetOutput( unsigned int idx ); + virtual bool SetInput( const std::string& id, DataObject* 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 ); + + template< class T > + inline T* GetInput( const std::string& id ); + + template< class T > + inline const T* GetInput( const std::string& id ) const; + + template< class T > + inline T* GetOutput( const std::string& id ); + + template< class T > + inline const T* GetOutput( const std::string& id ) const; protected: - virtual itk::DataObject* _GetInput( unsigned int idx ); - virtual void _SetOutput( unsigned int idx, itk::DataObject* dobj ); + ProcessObject( ); + virtual ~ProcessObject( ); + + virtual void _AddInput( const std::string& name ); + + template< class O > + inline void _AddOutput( const std::string& id ); + + template< class F > + inline F* _CreateITK( ); + + template< class F > + inline F* _CreateVTK( ); + virtual std::string _GenerateData( ) = 0; + private: + // Purposely not implemented + ProcessObject( const Self& ); + Self& operator=( const Self& ); + protected: - TParameters m_DefaultParameters; - TParameters m_Parameters; + Parameters::Pointer m_Parameters; + ParametersQtDialog* m_ParametersDialog; + + vtkSmartPointer< vtkRenderWindowInteractor > m_SingleInteractor; + SimpleMPRWidget* m_MPRViewer; + bool m_Interactive; - std::vector< const DataObject* > m_Inputs; - std::vector< DataObject > m_Outputs; + typedef std::map< std::string, DataObject::Pointer > _TDataContainer; + _TDataContainer m_Inputs; + _TDataContainer m_Outputs; }; + /** + * Plugin provider + */ + CPPLUGINS_PROVIDER_HEADER( ProcessObject ); + } // ecapseman } // ecapseman +#include + #endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ // eof - $RCSfile$