1 #ifndef __cpPlugins__Interface__Workspace__h__
2 #define __cpPlugins__Interface__Workspace__h__
4 #include <cpPlugins/Interface/Loader.h>
5 #include <cpPlugins/Pipeline/DataObject.h>
6 #include <cpPlugins/Pipeline/ProcessObject.h>
7 #include <cpPlugins/Pipeline/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::Pipeline::DataObject TDataObject;
28 typedef cpPlugins::Pipeline::ProcessObject TFilter;
29 typedef cpPlugins::Pipeline::Widget TWidget;
30 typedef cpPlugins::Interface::Loader TLoader;
32 typedef std::map< std::string, TFilter::Pointer > TFilters;
36 std::map< std::string, std::pair< std::string, std::string > >
42 itkTypeMacro( Workspace, itk::Object );
46 void Load( const std::string& fname );
47 void Save( const std::string& fname ) const;
53 std::vector< std::string > GetFiltersNames( ) const;
54 TFilter* GetFilter( const std::string& name );
55 const TFilter* GetFilter( const std::string& name ) const;
56 TWidget* GetWidget( const std::string& name );
57 const TWidget* GetWidget( const std::string& name ) const;
58 bool HasFilter( const std::string& name ) const;
59 bool HasWidget( const std::string& name ) const;
60 TFilter* CreateFilter(
61 const std::string& category, const std::string& filter
64 const std::string& old_name, const std::string& new_name
66 bool RemoveFilter( const std::string& name );
68 void SetPrintExecution( bool b );
69 void PrintExecutionOn( );
70 void PrintExecutionOff( );
73 void AddInteractor( vtkRenderWindowInteractor* iren );
75 // Connection management
77 const std::string& origin_filter,
78 const std::string& origin_output,
79 const std::string& destination_filter,
80 const std::string& destination_input
84 const std::string& destination_filter,
85 const std::string& destination_input
88 const std::string& origin_filter,
89 const std::string& origin_output,
90 const std::string& destination_filter,
91 const std::string& destination_input
95 std::vector< std::pair< std::string, std::string > > GetConnections(
96 const std::string& origin, const std::string& destination
99 const std::string& orig_filter, const std::string& dest_filter,
100 const std::string& output_name, const std::string& input_name
103 cpPlugins::Pipeline::DataObject* output,
104 const std::string& dest_filter, const std::string& input_name
107 cpPlugins::Pipeline::DataObject* output,
108 const std::string& exposed_input_name
111 const std::string& orig_filter, const std::string& dest_filter,
112 const std::string& output_name, const std::string& input_name
115 const std::string& dest_filter, const std::string& input_name
117 void Disconnect( const std::string& dest_filter );
120 // Pipeline execution
122 void Update( const std::string& name );
126 virtual ~Workspace( );
129 // Purposely not implemented
130 Workspace( const Self& other );
131 Self& operator=( const Self& other );
136 bool m_PrintExecution;
139 TExposedPorts m_ExposedInputs;
140 TExposedPorts m_ExposedOutputs;
143 std::set< vtkRenderWindowInteractor* > m_Interactors;
150 #endif // __cpPlugins__Interface__Workspace__h__