X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FProcessObject.cxx;h=79fc2ab7f84880c3cdb59bdd002d38e8abc94f34;hb=c29448936abc15d110205b2da435035131398a87;hp=cd88ea67ba637162b0938bd3474eb5a37cc9294b;hpb=8c23766af88a29c3e830299dffc4b95d9fe61df9;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/ProcessObject.cxx b/lib/cpPlugins/Interface/ProcessObject.cxx index cd88ea6..79fc2ab 100644 --- a/lib/cpPlugins/Interface/ProcessObject.cxx +++ b/lib/cpPlugins/Interface/ProcessObject.cxx @@ -1,4 +1,5 @@ #include +#include // ------------------------------------------------------------------------- cpPlugins::Interface::ProcessObject:: @@ -49,6 +50,26 @@ GetNumberOfOutputs( ) const return( this->m_Outputs.size( ) ); } +// ------------------------------------------------------------------------- +void cpPlugins::Interface::ProcessObject:: +SetNumberOfInputs( unsigned int n ) +{ + this->m_Inputs.clear( ); + this->m_Inputs.resize( n, NULL ); +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::ProcessObject:: +SetNumberOfOutputs( unsigned int n ) +{ + this->m_Outputs.clear( ); + this->m_Outputs.resize( n ); + + // Sync outputs with this source + for( unsigned int odx = 0; odx < this->m_Outputs.size( ); ++odx ) + this->m_Outputs[ odx ].SetSource( this ); +} + // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: SetInput( @@ -61,10 +82,10 @@ SetInput( // ------------------------------------------------------------------------- cpPlugins::Interface::DataObject* cpPlugins::Interface::ProcessObject:: -GetOutput( unsigned int idx ) const +GetOutput( unsigned int idx ) { if( idx < this->m_Outputs.size( ) ) - return( this->m_Outputs[ idx ] ); + return( &( this->m_Outputs[ idx ] ) ); else return( NULL ); } @@ -75,17 +96,31 @@ Update( ) { // Force upstream updates for( unsigned int idx = 0; idx < this->m_Inputs.size( ); ++idx ) - this->m_Inputs->GetSource( )->Update( ); + this->m_Inputs[ idx ]->GetSource( )->Update( ); // Current update std::string ret = this->_GenerateData( ); - // Sync outputs - for( unsigned int odx = 0; odx < this->m_Outputs.size( ); ++odx ) - this->m_Outputs->SetSource( this ); - + // Return error description, if any return( ret ); } +// ------------------------------------------------------------------------- +itk::DataObject* cpPlugins::Interface::ProcessObject:: +_GetInput( unsigned int idx ) +{ + if( idx < this->m_Inputs.size( ) ) + return( this->m_Inputs[ idx ]->GetDataObject( ) ); + else + return( NULL ); +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::ProcessObject:: +_SetOutput( unsigned int idx, itk::DataObject* dobj ) +{ + if( idx < this->m_Outputs.size( ) ) + this->m_Outputs[ idx ].SetDataObject( dobj ); +} // eof - $RCSfile$