X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPipeline%2FProcessObject.hxx;fp=lib%2FcpPlugins%2FPipeline%2FProcessObject.hxx;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=47cd480974ab4892a73fe600fddbe65637e4dda7;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/cpPlugins/Pipeline/ProcessObject.hxx b/lib/cpPlugins/Pipeline/ProcessObject.hxx deleted file mode 100644 index 47cd480..0000000 --- a/lib/cpPlugins/Pipeline/ProcessObject.hxx +++ /dev/null @@ -1,293 +0,0 @@ -#ifndef __cpPlugins__Pipeline__ProcessObject__hxx__ -#define __cpPlugins__Pipeline__ProcessObject__hxx__ - -// ------------------------------------------------------------------------- -template< class _TType > -_TType* cpPlugins::Pipeline::ProcessObject:: -GetInput( const std::string& n, unsigned int i ) -{ - auto it = this->m_Inputs.find( n ); - if( it != this->m_Inputs.end( ) ) - return( dynamic_cast< _TType* >( it->second->Get( i ) ) ); - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -const _TType* cpPlugins::Pipeline::ProcessObject:: -GetInput( const std::string& n, unsigned int i ) const -{ - auto it = this->m_Inputs.find( n ); - if( it != this->m_Inputs.end( ) ) - return( dynamic_cast< const _TType* >( it->second->Get( i ) ) ); - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -_TType* cpPlugins::Pipeline::ProcessObject:: -GetInputData( const std::string& n, unsigned int i ) -{ - auto d = this->GetInput( n, i ); - if( d != NULL ) - { - auto oi = d->m_ITK.GetPointer( ); - auto ov = d->m_VTK.GetPointer( ); - if( oi != NULL && ov != NULL ) - { - auto di = dynamic_cast< _TType* >( oi ); - auto dv = dynamic_cast< _TType* >( ov ); - if ( di != NULL ) return( di ); - else if( dv != NULL ) return( dv ); - else return( NULL ); - } - else if( oi != NULL && ov == NULL ) - { - auto di = dynamic_cast< _TType* >( oi ); - if( di == NULL ) - return( d->GetVTK< _TType >( ) ); - else - return( di ); - } - else if( oi == NULL && ov != NULL ) - { - auto dv = dynamic_cast< _TType* >( ov ); - if( dv == NULL ) - return( d->GetITK< _TType >( ) ); - else - return( dv ); - } - else - return( NULL ); - } - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -const _TType* cpPlugins::Pipeline::ProcessObject:: -GetInputData( const std::string& n, unsigned int i ) const -{ - auto d = this->GetInput( n, i ); - if( d != NULL ) - { - auto oi = d->m_ITK.GetPointer( ); - auto ov = d->m_VTK.GetPointer( ); - if( oi != NULL && ov != NULL ) - { - auto di = dynamic_cast< const _TType* >( oi ); - auto dv = dynamic_cast< const _TType* >( ov ); - if ( di != NULL ) return( di ); - else if( dv != NULL ) return( dv ); - else return( NULL ); - } - else if( oi != NULL && ov == NULL ) - { - auto di = dynamic_cast< const _TType* >( oi ); - if( di == NULL ) - return( d->GetVTK< _TType >( ) ); - else - return( di ); - } - else if( oi == NULL && ov != NULL ) - { - auto dv = dynamic_cast< const _TType* >( ov ); - if( dv == NULL ) - return( d->GetITK< _TType >( ) ); - else - return( dv ); - } - else - return( NULL ); - } - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -_TType* cpPlugins::Pipeline::ProcessObject:: -GetOutput( const std::string& n ) -{ - auto it = this->m_Outputs.find( n ); - if( it != this->m_Outputs.end( ) ) - return( dynamic_cast< _TType* >( it->second->Get( ) ) ); - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -const _TType* cpPlugins::Pipeline::ProcessObject:: -GetOutput( const std::string& n ) const -{ - auto it = this->m_Outputs.find( n ); - if( it != this->m_Outputs.end( ) ) - return( dynamic_cast< const _TType* >( it->second->Get( ) ) ); - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -_TType* cpPlugins::Pipeline::ProcessObject:: -GetOutputData( const std::string& n ) -{ - auto d = this->GetOutput( n ); - if( d != NULL ) - { - auto oi = d->m_ITK.GetPointer( ); - auto ov = d->m_VTK.GetPointer( ); - if( oi != NULL && ov != NULL ) - { - auto di = dynamic_cast< _TType* >( oi ); - auto dv = dynamic_cast< _TType* >( ov ); - if ( di != NULL ) return( di ); - else if( dv != NULL ) return( dv ); - else return( NULL ); - } - else if( oi != NULL && ov == NULL ) - { - auto di = dynamic_cast< _TType* >( oi ); - if( di == NULL ) - return( d->GetVTK< _TType >( ) ); - else - return( di ); - } - else if( oi == NULL && ov != NULL ) - { - auto dv = dynamic_cast< _TType* >( ov ); - if( dv == NULL ) - return( d->GetITK< _TType >( ) ); - else - return( dv ); - } - else - return( NULL ); - } - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -const _TType* cpPlugins::Pipeline::ProcessObject:: -GetOutputData( const std::string& n ) const -{ - auto d = this->GetOutput( n ); - if( d != NULL ) - { - auto oi = d->m_ITK.GetPointer( ); - auto ov = d->m_VTK.GetPointer( ); - if( oi != NULL && ov != NULL ) - { - auto di = dynamic_cast< const _TType* >( oi ); - auto dv = dynamic_cast< const _TType* >( ov ); - if ( di != NULL ) return( di ); - else if( dv != NULL ) return( dv ); - else return( NULL ); - } - else if( oi != NULL && ov == NULL ) - { - auto di = dynamic_cast< const _TType* >( oi ); - if( di == NULL ) - return( d->GetVTK< _TType >( ) ); - else - return( di ); - } - else if( oi == NULL && ov != NULL ) - { - auto dv = dynamic_cast< const _TType* >( ov ); - if( dv == NULL ) - return( d->GetITK< _TType >( ) ); - else - return( dv ); - } - else - return( NULL ); - } - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -void cpPlugins::Pipeline::ProcessObject:: -_ConfigureInput( const std::string& name, bool required, bool multiple ) -{ - auto it = this->m_Inputs.find( name ); - if( it == this->m_Inputs.end( ) ) - { - Port* port; - if( multiple ) port = new MultipleInputsPort( required ); - else port = new InputPort( required ); - port->Configure< _TType >( ); - this->m_Inputs[ name ] = port; - this->Modified( ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< class _TType > -void cpPlugins::Pipeline::ProcessObject:: -_ConfigureOutput( const std::string& name ) -{ - auto it = this->m_Outputs.find( name ); - if( it == this->m_Outputs.end( ) ) - { - Port* port = new OutputPort( true ); - port->Configure< _TType >( ); - port->Add( _TType::New( ) ); - port->Get( )->SetSource( this ); - this->m_Outputs[ name ] = port; - this->Modified( ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< class _TFilter > -_TFilter* cpPlugins::Pipeline::ProcessObject:: -_CreateITK( ) -{ - // TODO: why this lead to synch issues??? - _TFilter* filter = this->GetITK< _TFilter >( ); - if( filter == NULL ) - { - typename _TFilter::Pointer filter_ptr = _TFilter::New( ); - this->m_ITK = filter_ptr; - this->m_VTK = NULL; - filter = filter_ptr.GetPointer( ); - this->Modified( ); - - } // fi - return( filter ); -} - -// ------------------------------------------------------------------------- -template< class _TFilter > -_TFilter* cpPlugins::Pipeline::ProcessObject:: -_CreateVTK( ) -{ - // TODO: why this lead to synch issues??? - _TFilter* filter = this->GetVTK< _TFilter >( ); - if( filter == NULL ) - { - vtkSmartPointer< _TFilter > filter_ptr = - vtkSmartPointer< _TFilter >::New( ); - this->m_ITK = NULL; - this->m_VTK = filter_ptr; - filter = filter_ptr.GetPointer( ); - this->Modified( ); - - } // fi - return( filter ); -} - -#endif // __cpPlugins__Pipeline__ProcessObject__hxx__ - -// eof - $RCSfile$