]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ProcessObject.h
...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.h
index 3381fa818e77c4685f54286c31253c545865b7ff..ddd1c21aa150ad2cd38987e82ad1bfb4f76d3677 100644 (file)
@@ -1,17 +1,34 @@
 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
 
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/Object.h>
+#include <set>
+
+#include <itkDataObject.h>
+
 #include <cpPlugins/Interface/DataObject.h>
 #include <cpPlugins/Interface/Parameters.h>
 
-#include <itkProcessObject.h>
+// Some forward declarations
+class vtkRenderWindowInteractor;
+#ifdef cpPlugins_Interface_QT4
+class QWidget;
+#else
+typedef char QWidget;
+#endif // cpPlugins_Interface_QT4
 
 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
@@ -23,43 +40,67 @@ namespace cpPlugins
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
+      typedef Parameters TParameters;
+      typedef std::set< vtkRenderWindowInteractor* > TInteractors;
+      typedef bool DialogResult;
+
     public:
       itkTypeMacro( ProcessObject, Object );
+      cpPlugins_Id_Macro( ProcessObject, BaseObject );
 
-    public:
-      virtual const Parameters& GetDefaultParameters( ) const;
-      virtual void SetParameters( const Parameters& 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, DataObject* dobj );
-      virtual DataObject* GetOutput( unsigned int idx );
+      virtual bool SetInput( const std::string& id, DataObject* dobj );
 
       virtual std::string Update( );
       virtual void DisconnectOutputs( );
 
-    protected:
-      ProcessObject( );
-      virtual ~ProcessObject( );
-
-      template< class O >
-        inline void _MakeOutput( unsigned int idx );
+      // 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* _Input( unsigned int idx );
+        inline T* GetInput( const std::string& id );
 
       template< class T >
-        inline const T* _Input( unsigned int idx ) const;
+        inline const T* GetInput( const std::string& id ) const;
 
       template< class T >
-        inline T* _Output( unsigned int idx );
+        inline T* GetOutput( const std::string& id );
 
       template< class T >
-        inline const T* _Output( unsigned int idx ) const;
+        inline const T* GetOutput( const std::string& id ) const;
+
+    protected:
+      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;
 
@@ -69,14 +110,23 @@ namespace cpPlugins
       Self& operator=( const Self& );
 
     protected:
-      itk::ProcessObject::Pointer m_RealProcessObject;
-      Parameters m_DefaultParameters;
-      Parameters m_Parameters;
+      Parameters::Pointer m_Parameters;
+      ParametersQtDialog* m_ParametersDialog;
+
+      vtkSmartPointer< vtkRenderWindowInteractor > m_SingleInteractor;
+      SimpleMPRWidget*                             m_MPRViewer;
+      bool                                         m_Interactive;
 
-      std::vector< DataObject::Pointer > m_Inputs;
-      std::vector< DataObject::Pointer > m_Outputs;
+      typedef std::map< std::string, DataObject::Pointer > _TDataContainer;
+      _TDataContainer m_Inputs;
+      _TDataContainer m_Outputs;
     };
 
+    /**
+     * Plugin provider
+     */
+    CPPLUGINS_PROVIDER_HEADER( ProcessObject );
+
   } // ecapseman
 
 } // ecapseman