]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 18 Feb 2016 00:30:18 +0000 (19:30 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 18 Feb 2016 00:30:18 +0000 (19:30 -0500)
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h
lib/cpPlugins/Interface/ProcessObject.hxx
lib/cpPlugins/Interface/ProcessObjectPort.cxx
lib/cpPlugins/Interface/ProcessObjectPort.h
lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx

index 5bafb8097b2efa475272f69fe7dad296906fa18e..557c18844aeff8acee79a656e06a26a14b6cd661 100644 (file)
@@ -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 )
index e139c994d5e86f9107963ae6acea31fcd626d564..617ea74c0ac94f69cbc7006c2b224bd9a923cbc6 100644 (file)
@@ -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
index 54c2f37bb8ede077d0f7238dbf760f5ac3382ec3..9f15c81ea70d3efe93e12468fa96e96560d81841 100644 (file)
@@ -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 >
index 1174d2b085b15937dcc6af1c553c885b0f62ca58..240c4e3b2eac135536bc6d0c9ec9dcc80d0c537a 100644 (file)
@@ -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 );
 }
 
 // -------------------------------------------------------------------------
index 67186e515307e1ba861508c52a9c21d1ad7249b9..48cb07a9f8dae6dff58f4c780724ba1e6859137a 100644 (file)
@@ -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;
     };
index 957136d3187879ce34c35c1105b1d4dff64f436a..5ecc101cb3f5092394470375e46f0195e14ff90e 100644 (file)
@@ -1,5 +1,8 @@
 #include "InputDataReproducer.h"
 
+#include <cpPlugins/Interface/Image.h>
+#include <cpPlugins/Interface/PointList.h>
+
 // -------------------------------------------------------------------------
 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( "" );
 }