From: Leonardo Florez-Valencia Date: Thu, 18 Feb 2016 00:30:18 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~236 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8ad95abe02b030bef4c1da5e827a5309c560aea2;p=cpPlugins.git ... --- diff --git a/lib/cpPlugins/Interface/ProcessObject.cxx b/lib/cpPlugins/Interface/ProcessObject.cxx index 5bafb80..557c188 100644 --- a/lib/cpPlugins/Interface/ProcessObject.cxx +++ b/lib/cpPlugins/Interface/ProcessObject.cxx @@ -84,6 +84,54 @@ GetOutput( const std::string& id ) const return( i->second ); } +// ------------------------------------------------------------------------- +cpPlugins::Interface:: +DataObject* cpPlugins::Interface::ProcessObject:: +GetInputData( const std::string& id ) +{ + auto i = this->m_Inputs.find( id ); + if( i != this->m_Inputs.end( ) ) + return( dynamic_cast< DataObject* >( i->second.GetPointer( ) ) ); + else + return( NULL ); +} + +// ------------------------------------------------------------------------- +const cpPlugins::Interface:: +DataObject* cpPlugins::Interface::ProcessObject:: +GetInputData( const std::string& id ) const +{ + auto i = this->m_Inputs.find( id ); + if( i != this->m_Inputs.end( ) ) + return( dynamic_cast< const DataObject* >( i->second.GetPointer( ) ) ); + else + return( NULL ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface:: +DataObject* cpPlugins::Interface::ProcessObject:: +GetOutputData( const std::string& id ) +{ + auto i = this->m_Outputs.find( id ); + if( i != this->m_Outputs.end( ) ) + return( dynamic_cast< DataObject* >( i->second.GetPointer( ) ) ); + else + return( NULL ); +} + +// ------------------------------------------------------------------------- +const cpPlugins::Interface:: +DataObject* cpPlugins::Interface::ProcessObject:: +GetOutputData( const std::string& id ) const +{ + auto i = this->m_Outputs.find( id ); + if( i != this->m_Outputs.end( ) ) + return( dynamic_cast< const DataObject* >( i->second.GetPointer( ) ) ); + else + return( NULL ); +} + // ------------------------------------------------------------------------- bool cpPlugins::Interface::ProcessObject:: SetInput( const std::string& id, const OutputProcessObjectPort& port ) diff --git a/lib/cpPlugins/Interface/ProcessObject.h b/lib/cpPlugins/Interface/ProcessObject.h index e139c99..617ea74 100644 --- a/lib/cpPlugins/Interface/ProcessObject.h +++ b/lib/cpPlugins/Interface/ProcessObject.h @@ -67,14 +67,20 @@ namespace cpPlugins OutputProcessObjectPort& GetOutput( const std::string& id ); const OutputProcessObjectPort& GetOutput( const std::string& id ) const; - template< class T > - inline T* GetInputData( const std::string& id ); - template< class T > - inline const T* GetInputData( const std::string& id ) const; - template< class T > - inline T* GetOutputData( const std::string& id ); - template< class T > - inline const T* GetOutputData( const std::string& id ) const; + /* TODO + template< class T > + inline T* GetInputData( const std::string& id ); + template< class T > + inline const T* GetInputData( const std::string& id ) const; + template< class T > + inline T* GetOutputData( const std::string& id ); + template< class T > + inline const T* GetOutputData( const std::string& id ) const; + */ + DataObject* GetInputData( const std::string& id ); + const DataObject* GetInputData( const std::string& id ) const; + DataObject* GetOutputData( const std::string& id ); + const DataObject* GetOutputData( const std::string& id ) const; bool SetInput( const std::string& id, const OutputProcessObjectPort& port diff --git a/lib/cpPlugins/Interface/ProcessObject.hxx b/lib/cpPlugins/Interface/ProcessObject.hxx index 54c2f37..9f15c81 100644 --- a/lib/cpPlugins/Interface/ProcessObject.hxx +++ b/lib/cpPlugins/Interface/ProcessObject.hxx @@ -2,6 +2,7 @@ #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__ // ------------------------------------------------------------------------- +/* TODO template< class T > T* cpPlugins::Interface::ProcessObject:: GetInputData( const std::string& id ) @@ -48,6 +49,7 @@ GetOutputData( const std::string& id ) const else return( NULL ); } +*/ // ------------------------------------------------------------------------- template< class O > diff --git a/lib/cpPlugins/Interface/ProcessObjectPort.cxx b/lib/cpPlugins/Interface/ProcessObjectPort.cxx index 1174d2b..240c4e3 100644 --- a/lib/cpPlugins/Interface/ProcessObjectPort.cxx +++ b/lib/cpPlugins/Interface/ProcessObjectPort.cxx @@ -27,7 +27,7 @@ cpPlugins::Interface::ProcessObjectPort:: Self& cpPlugins::Interface::ProcessObjectPort:: operator=( const Self& other ) { - this->m_Data = other.m_Data.GetPointer( ); + this->m_Data = other.m_Data; return( *this ); } @@ -35,7 +35,7 @@ operator=( const Self& other ) bool cpPlugins::Interface::ProcessObjectPort:: IsValid( ) const { - return( this->m_Data.IsNotNull( ) ); + return( this->m_Data.GetPointer( ) != NULL ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Interface/ProcessObjectPort.h b/lib/cpPlugins/Interface/ProcessObjectPort.h index 67186e5..48cb07a 100644 --- a/lib/cpPlugins/Interface/ProcessObjectPort.h +++ b/lib/cpPlugins/Interface/ProcessObjectPort.h @@ -30,6 +30,9 @@ namespace cpPlugins inline DataObject* operator->( ) const { return( this->m_Data.GetPointer( ) ); } + inline void SetPointer( DataObject* ptr ) + { this->m_Data = ptr; } + protected: cpPlugins::Interface::DataObject::Pointer m_Data; }; diff --git a/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx b/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx index 957136d..5ecc101 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx @@ -1,5 +1,8 @@ #include "InputDataReproducer.h" +#include +#include + // ------------------------------------------------------------------------- cpPlugins::BasicFilters::InputDataReproducer:: InputDataReproducer( ) @@ -24,9 +27,8 @@ _GenerateData( ) auto o = this->m_Outputs.find( "Output" ); if( i == this->m_Inputs.end( ) || o == this->m_Outputs.end( ) ) return( "InputDataReproducer: No input/output ports." ); - - // Connect output - o->second = i->second; + o->second->SetITK( i->second->GetITK< itk::LightObject >( ) ); + o->second->SetVTK( i->second->GetVTK< vtkObjectBase >( ) ); return( "" ); }