1 #include <cpPlugins/Interface/ProcessObject.h>
3 // -------------------------------------------------------------------------
4 std::string cpPlugins::Interface::ProcessObject::
7 return( "cpPlugins::Interface::ProcessObject" );
10 // -------------------------------------------------------------------------
11 std::string cpPlugins::Interface::ProcessObject::
14 return( "ProcessObject" );
17 // -------------------------------------------------------------------------
18 const cpPlugins::Interface::Parameters&
19 cpPlugins::Interface::ProcessObject::
20 GetDefaultParameters( ) const
22 return( this->m_DefaultParameters );
25 // -------------------------------------------------------------------------
26 void cpPlugins::Interface::ProcessObject::
27 SetParameters( const cpPlugins::Interface::Parameters& params )
29 this->m_Parameters = params;
33 // -------------------------------------------------------------------------
34 unsigned int cpPlugins::Interface::ProcessObject::
35 GetNumberOfInputs( ) const
37 return( this->m_Inputs.size( ) );
40 // -------------------------------------------------------------------------
41 unsigned int cpPlugins::Interface::ProcessObject::
42 GetNumberOfOutputs( ) const
44 return( this->m_Outputs.size( ) );
47 // -------------------------------------------------------------------------
48 void cpPlugins::Interface::ProcessObject::
49 SetNumberOfInputs( unsigned int n )
51 this->m_Inputs.clear( );
52 this->m_Inputs.resize( n );
56 // -------------------------------------------------------------------------
57 void cpPlugins::Interface::ProcessObject::
58 SetNumberOfOutputs( unsigned int n )
60 this->m_Outputs.clear( );
61 this->m_Outputs.resize( n );
65 // -------------------------------------------------------------------------
66 void cpPlugins::Interface::ProcessObject::
67 SetInput( unsigned int idx, cpPlugins::Interface::DataObject* dobj )
69 if( idx < this->m_Inputs.size( ) )
71 this->m_Inputs[ idx ] = dobj;
77 // -------------------------------------------------------------------------
78 cpPlugins::Interface::DataObject* cpPlugins::Interface::ProcessObject::
79 GetOutput( unsigned int idx )
81 if( idx < this->m_Outputs.size( ) )
82 return( this->m_Outputs[ idx ] );
87 // -------------------------------------------------------------------------
88 std::string cpPlugins::Interface::ProcessObject::
93 // Force upstream updates
94 for( unsigned int i = 0; i < this->m_Inputs.size( ) && r == ""; ++i )
96 Self* src = dynamic_cast< Self* >( this->m_Inputs[ i ]->GetSource( ) );
104 r = this->_GenerateData( );
106 // Return error description, if any
110 // -------------------------------------------------------------------------
111 void cpPlugins::Interface::ProcessObject::
114 for( unsigned int idx = 0; idx < this->m_Outputs.size( ); ++idx )
115 if( this->m_Outputs[ idx ].IsNotNull( ) )
116 this->m_Outputs[ idx ]->DisconnectPipeline( );
119 // -------------------------------------------------------------------------
120 cpPlugins::Interface::ProcessObject::
126 // -------------------------------------------------------------------------
127 cpPlugins::Interface::ProcessObject::
132 // -------------------------------------------------------------------------
133 itk::DataObject* cpPlugins::Interface::ProcessObject::
134 _GetInput( unsigned int idx )
136 if( idx < this->m_Inputs.size( ) )
137 return( this->m_Inputs[ idx ]->GetRealDataObject( ) );
142 // -------------------------------------------------------------------------
143 void cpPlugins::Interface::ProcessObject::
144 _SetOutput( unsigned int idx, itk::DataObject* dobj )
146 if( idx < this->m_Outputs.size( ) )
147 if( this->m_Outputs[ idx ].IsNotNull( ) )
148 this->m_Outputs[ idx ]->SetRealDataObject( dobj );