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>
7 #include <cpPlugins/BaseObjects/Widget.h>
10 class vtkRenderWindowInteractor;
16 /** \brief A complex pipeline
18 class cpPlugins_EXPORT Workspace
22 typedef Workspace Self;
23 typedef itk::Object Superclass;
24 typedef itk::SmartPointer< Self > Pointer;
25 typedef itk::SmartPointer< const Self > ConstPointer;
27 typedef cpPlugins::BaseObjects::ProcessObject TProcess;
28 typedef cpPlugins::BaseObjects::Widget TWidget;
29 typedef cpPlugins::Interface::Plugins TInterface;
31 typedef std::map< std::string, TProcess::Pointer > TFilters;
33 std::map< std::string, std::pair< std::string, std::string > >
38 itkTypeMacro( Workspace, itk::Object );
42 void Load( const std::string& fname );
43 void Save( const std::string& fname ) const;
49 std::vector< std::string > GetFiltersNames( ) const;
51 const std::string& name
53 const TProcess* GetFilter(
54 const std::string& name
57 const std::string& name
59 const TWidget* GetWidget(
60 const std::string& name
62 bool HasFilter( const std::string& name ) const;
63 bool HasWidget( const std::string& name ) const;
64 TProcess* CreateFilter(
65 const std::string& category,
66 const std::string& filter,
67 const std::string& name
70 const std::string& old_name, const std::string& new_name
72 bool RemoveFilter( const std::string& name );
74 void SetPrintExecution( bool b );
75 void PrintExecutionOn( );
76 void PrintExecutionOff( );
79 void AddInteractor( vtkRenderWindowInteractor* iren );
82 const TExposedPorts& GetExposedInputs( ) const;
83 const TExposedPorts& GetExposedOutputs( ) const;
84 cpPlugins::BaseObjects::DataObject* GetExposedOutput(
85 const std::string& name
87 const cpPlugins::BaseObjects::DataObject* GetExposedOutput(
88 const std::string& name
91 const std::string& name,
92 const std::string& filter, const std::string& filter_input
95 const std::string& name,
96 const std::string& filter, const std::string& filter_output
98 void HideInput( const std::string& name );
99 void HideOutput( const std::string& name );
100 bool RenameExposedInput(
101 const std::string& old_name,
102 const std::string& new_name
104 bool RenameExposedOutput(
105 const std::string& old_name,
106 const std::string& new_name
109 // Connection management
110 std::vector< std::pair< std::string, std::string > > GetConnections(
111 const std::string& origin, const std::string& destination
114 const std::string& orig_filter, const std::string& dest_filter,
115 const std::string& output_name, const std::string& input_name
118 cpPlugins::BaseObjects::DataObject* output,
119 const std::string& dest_filter, const std::string& input_name
122 cpPlugins::BaseObjects::DataObject* output,
123 const std::string& exposed_input_name
126 const std::string& orig_filter, const std::string& dest_filter,
127 const std::string& output_name, const std::string& input_name
130 const std::string& dest_filter, const std::string& input_name
132 void Disconnect( const std::string& dest_filter );
134 // Pipeline execution
136 void Execute( const std::string& name );
140 virtual ~Workspace( );
143 // Purposely not implemented
144 Workspace( const Self& other );
145 Self& operator=( const Self& other );
149 bool m_PrintExecution;
151 TExposedPorts m_ExposedInputs;
152 TExposedPorts m_ExposedOutputs;
154 std::set< vtkRenderWindowInteractor* > m_Interactors;
161 #endif // __cpPlugins__Interface__Workspace__h__