1 #ifndef __cpPlugins__Interface__Workspace__h__
2 #define __cpPlugins__Interface__Workspace__h__
4 #include <cpPlugins/Interface/Plugins.h>
5 #include <cpPlugins/BaseObjects/DataObject.h>
6 #include <cpPlugins/BaseObjects/ProcessObject.h>
9 class vtkRenderWindowInteractor;
15 /** \brief A complex pipeline
17 class cpPlugins_EXPORT Workspace
21 typedef Workspace Self;
22 typedef itk::Object Superclass;
23 typedef itk::SmartPointer< Self > Pointer;
24 typedef itk::SmartPointer< const Self > ConstPointer;
26 typedef cpPlugins::BaseObjects::ProcessObject TProcess;
27 typedef cpPlugins::Interface::Plugins TInterface;
29 typedef std::map< std::string, TProcess::Pointer > TFilters;
31 std::map< std::string, std::pair< std::string, std::string > >
36 itkTypeMacro( Workspace, itk::Object );
40 void Load( const std::string& fname );
41 void Save( const std::string& fname ) const;
47 std::vector< std::string > GetFiltersNames( ) const;
49 const std::string& name
51 const TProcess* GetFilter(
52 const std::string& name
54 bool HasFilter( const std::string& name ) const;
55 TProcess* CreateFilter(
56 const std::string& category,
57 const std::string& filter,
58 const std::string& name
61 const std::string& old_name, const std::string& new_name
63 bool RemoveFilter( const std::string& name );
65 void SetPrintExecution( bool b );
66 void PrintExecutionOn( );
67 void PrintExecutionOff( );
70 void AddInteractor( vtkRenderWindowInteractor* iren );
73 const TExposedPorts& GetExposedInputs( ) const;
74 const TExposedPorts& GetExposedOutputs( ) const;
75 cpPlugins::BaseObjects::DataObject* GetExposedOutput(
76 const std::string& name
78 const cpPlugins::BaseObjects::DataObject* GetExposedOutput(
79 const std::string& name
82 const std::string& name,
83 const std::string& filter, const std::string& filter_input
86 const std::string& name,
87 const std::string& filter, const std::string& filter_output
89 void HideInput( const std::string& name );
90 void HideOutput( const std::string& name );
91 bool RenameExposedInput(
92 const std::string& old_name,
93 const std::string& new_name
95 bool RenameExposedOutput(
96 const std::string& old_name,
97 const std::string& new_name
100 // Connection management
101 std::vector< std::pair< std::string, std::string > > GetConnections(
102 const std::string& origin, const std::string& destination
105 const std::string& orig_filter, const std::string& dest_filter,
106 const std::string& output_name, const std::string& input_name
109 cpPlugins::BaseObjects::DataObject* output,
110 const std::string& dest_filter, const std::string& input_name
113 cpPlugins::BaseObjects::DataObject* output,
114 const std::string& exposed_input_name
117 const std::string& orig_filter, const std::string& dest_filter,
118 const std::string& output_name, const std::string& input_name
121 const std::string& dest_filter, const std::string& input_name
123 void Disconnect( const std::string& dest_filter );
125 // Pipeline execution
127 void Execute( const std::string& name );
131 virtual ~Workspace( );
134 // Purposely not implemented
135 Workspace( const Self& other );
136 Self& operator=( const Self& other );
140 bool m_PrintExecution;
142 TExposedPorts m_ExposedInputs;
143 TExposedPorts m_ExposedOutputs;
145 std::set< vtkRenderWindowInteractor* > m_Interactors;
152 #endif // __cpPlugins__Interface__Workspace__h__