1 #include <cpPlugins/Interface/ProcessObject.h>
2 #include <cpPlugins/Interface/DataObject.h>
4 // -------------------------------------------------------------------------
5 cpPlugins::Interface::ProcessObject::
11 // -------------------------------------------------------------------------
12 cpPlugins::Interface::ProcessObject::
17 // -------------------------------------------------------------------------
18 std::string cpPlugins::Interface::ProcessObject::
21 return( "cpPlugins::Interface::ProcessObject" );
24 // -------------------------------------------------------------------------
25 const cpPlugins::Interface::ProcessObject::
26 TParameters& cpPlugins::Interface::ProcessObject::
27 GetDefaultParameters( ) const
29 return( this->m_DefaultParameters );
32 // -------------------------------------------------------------------------
33 void cpPlugins::Interface::ProcessObject::
34 SetParameters( const TParameters& params )
36 this->m_Parameters = params;
39 // -------------------------------------------------------------------------
40 unsigned int cpPlugins::Interface::ProcessObject::
41 GetNumberOfInputs( ) const
43 return( this->m_Inputs.size( ) );
46 // -------------------------------------------------------------------------
47 unsigned int cpPlugins::Interface::ProcessObject::
48 GetNumberOfOutputs( ) const
50 return( this->m_Outputs.size( ) );
53 // -------------------------------------------------------------------------
54 void cpPlugins::Interface::ProcessObject::
55 SetNumberOfInputs( unsigned int n )
57 this->m_Inputs.clear( );
58 this->m_Inputs.resize( n, NULL );
61 // -------------------------------------------------------------------------
62 void cpPlugins::Interface::ProcessObject::
63 SetNumberOfOutputs( unsigned int n )
65 this->m_Outputs.clear( );
66 this->m_Outputs.resize( n );
68 // Sync outputs with this source
69 for( unsigned int odx = 0; odx < this->m_Outputs.size( ); ++odx )
70 this->m_Outputs[ odx ].SetSource( this );
73 // -------------------------------------------------------------------------
74 void cpPlugins::Interface::ProcessObject::
76 unsigned int idx, const cpPlugins::Interface::DataObject* dobj
79 if( idx < this->m_Inputs.size( ) )
80 this->m_Inputs[ idx ] = dobj;
83 // -------------------------------------------------------------------------
84 cpPlugins::Interface::DataObject* cpPlugins::Interface::ProcessObject::
85 GetOutput( unsigned int idx )
87 if( idx < this->m_Outputs.size( ) )
88 return( &( this->m_Outputs[ idx ] ) );
93 // -------------------------------------------------------------------------
94 std::string cpPlugins::Interface::ProcessObject::
97 // Force upstream updates
98 for( unsigned int idx = 0; idx < this->m_Inputs.size( ); ++idx )
99 this->m_Inputs[ idx ]->GetSource( )->Update( );
102 std::string ret = this->_GenerateData( );
104 // Return error description, if any
108 // -------------------------------------------------------------------------
109 itk::DataObject* cpPlugins::Interface::ProcessObject::
110 _GetInput( unsigned int idx )
112 if( idx < this->m_Inputs.size( ) )
113 return( this->m_Inputs[ idx ]->GetDataObject( ) );
118 // -------------------------------------------------------------------------
119 void cpPlugins::Interface::ProcessObject::
120 _SetOutput( unsigned int idx, itk::DataObject* dobj )
122 if( idx < this->m_Outputs.size( ) )
123 this->m_Outputs[ idx ].SetDataObject( dobj );