#ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
#define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
-#include <map>
-#include <string>
-#include <itkDataObject.h>
-#include <cpPlugins/Interface/Object.h>
+#include <set>
+
+#include <cpPlugins/Interface/DataObject.h>
+#include <cpPlugins/Interface/Parameters.h>
+
+#include <itkProcessObject.h>
+#include <vtkSmartPointer.h>
+#include <vtkAlgorithm.h>
+
+// 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
+ class Plugins;
+#ifdef cpPlugins_Interface_QT4
+ class ParametersQtDialog;
+#else
+ typedef char ParametersQtDialog;
+#endif // cpPlugins_Interface_QT4
/**
*/
- class ProcessObject
+ class cpPlugins_Interface_EXPORT ProcessObject
: 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 Parameters TParameters;
+ typedef std::set< vtkRenderWindowInteractor* > TInteractors;
- typedef std::pair< std::string, std::string > TParameter;
- typedef std::map< std::string, TParameter > TParameters;
+ enum DialogResult
+ {
+ DialogResult_NoModal = 0,
+ DialogResult_Modal,
+ DialogResult_Cancel
+ };
public:
- ProcessObject( );
- virtual ~ProcessObject( );
+ itkTypeMacro( ProcessObject, Object );
+ cpPlugins_Id_Macro( ProcessObject, "BaseObject" );
+
+ itkBooleanMacro( Interactive );
+
+ itkGetConstObjectMacro( Parameters, TParameters );
+ itkGetObjectMacro( Parameters, TParameters );
+ itkGetConstMacro( Plugins, const Plugins* );
+ itkGetMacro( Plugins, Plugins* );
+ itkGetConstMacro( Interactive, bool );
- virtual std::string GetClassName( ) const;
- virtual const TParameters& GetDefaultParameters( ) const;
- virtual void SetParameters( const TParameters& params );
+ itkSetObjectMacro( Plugins, Plugins );
+ itkSetMacro( Interactive, bool );
- virtual unsigned int GetNumberOfInputs( ) const;
- virtual unsigned int GetNumberOfOutputs( ) const;
+ public:
+ // To impact pipeline
+ virtual void Modified( ) const;
+
+ virtual void GetInputsNames( std::set< std::string >& names ) const;
+ virtual void GetOutputsNames( std::set< std::string >& names ) const;
- virtual void SetNumberOfInputs( unsigned int n );
- virtual void SetNumberOfOutputs( unsigned int n );
+ virtual bool SetOutputObjectName(
+ const std::string& new_object_name,
+ const std::string& output_name
+ );
- virtual void SetInput( unsigned int idx, const DataObject* dobj );
- virtual DataObject* GetOutput( unsigned int idx );
+ virtual void SetInput( const std::string& id, DataObject* dobj );
virtual std::string Update( );
+ virtual void DisconnectOutputs( );
+
+ virtual void AddInteractor( vtkRenderWindowInteractor* interactor );
+ virtual DialogResult ExecConfigurationDialog( QWidget* parent );
+
+ template< class T >
+ inline T* GetITK( );
+
+ template< class T >
+ inline const T* GetITK( ) const;
+
+ template< class T >
+ inline T* GetVTK( );
+
+ template< class T >
+ inline const T* GetVTK( ) const;
+
+ 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 F >
+ inline F* _CreateITK( );
+
+ template< class F >
+ inline F* _CreateVTK( );
+
+ template< class O >
+ inline void _MakeOutput( const std::string& id );
+
virtual std::string _GenerateData( ) = 0;
- protected:
- TParameters m_DefaultParameters;
- TParameters m_Parameters;
+ private:
+ // Purposely not implemented
+ ProcessObject( const Self& );
+ Self& operator=( const Self& );
- std::vector< const DataObject* > m_Inputs;
- std::vector< DataObject > m_Outputs;
+ protected:
+ itk::ProcessObject::Pointer m_ITKObject;
+ vtkSmartPointer< vtkAlgorithm > m_VTKObject;
+
+ Parameters::Pointer m_Parameters;
+ ParametersQtDialog* m_ParametersDialog;
+ TInteractors m_Interactors;
+ Plugins* m_Plugins;
+ bool m_Interactive;
+
+ typedef std::map< std::string, DataObject::Pointer > _TDataContainer;
+ _TDataContainer m_Inputs;
+ _TDataContainer m_Outputs;
+ std::map< std::string, std::string > m_OutputObjectsNames;
};
+ /**
+ * Plugin provider
+ */
+ CPPLUGINS_PROVIDER_HEADER( ProcessObject );
+
} // ecapseman
} // ecapseman
+#include <cpPlugins/Interface/ProcessObject.hxx>
+
#endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
// eof - $RCSfile$