]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 28 Jan 2016 00:40:10 +0000 (19:40 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 28 Jan 2016 00:40:10 +0000 (19:40 -0500)
28 files changed:
appli/cpPipelineEditor/App_cpPipelineEditor.cxx
lib/cpPipelineEditor/Editor.cxx
lib/cpPlugins/Interface/Object.cxx
lib/cpPlugins/Interface/Object.h
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h
lib/cpPlugins/Interface/ProcessObject.hxx
lib/cpPlugins/Interface/Workspace.cxx
lib/cpPlugins/Interface/Workspace.h
lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx
lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx [new file with mode: 0644]
lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.h [new file with mode: 0644]
lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx
lib/cpPlugins/Plugins/IO/ImageReader.cxx
lib/cpPlugins/Plugins/IO/ImageWriter.cxx
lib/cpPlugins/Plugins/IO/MeshReader.cxx
lib/cpPlugins/Plugins/IO/MeshWriter.cxx
lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx

index 6af4723eb068421654ea6a23a6e63ce3f0823123..6227c17ddd18998b2d8284b37edba19a19c4a758 100644 (file)
@@ -308,7 +308,7 @@ _ShowFilterOutput(
   auto filter = this->m_Workspace->GetFilter( filter_name );
   if( filter != NULL )
   {
-    auto output = filter->GetOutput< _TDataObject >( output_name );
+    auto output = filter->GetOutputData< _TDataObject >( output_name );
     if( output != NULL )
     {
       std::string data_name = output_name + "@" + filter_name;
index 736feccf567f3d70baa0f624896a1acac131945e..7dc6251618d039fcd0325da701ada99d6df5e4db 100644 (file)
@@ -132,7 +132,6 @@ bool cpPipelineEditor::Editor::
 deleteFilter( const std::string& name )\r
 {\r
   std::cout << name << std::endl;\r
-#error delete filter\r
   return( false );\r
 }\r
 \r
@@ -148,7 +147,6 @@ deleteConnection(
     << des << " "\r
     << in << " "\r
     << out << std::endl;\r
-#error delete connection\r
   return( false );\r
 }\r
 \r
index 61da5c1ba5365abf6c47dd449c7ad2a9ebb0aa7b..3e259169d517d949665405550f98c544c63aa32f 100644 (file)
@@ -22,6 +22,30 @@ SetViewCoords( float x, float y )
   this->SetViewY( y );
 }
 
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Object::
+SetITK( itk::LightObject* o )
+{
+  if( this->m_ITKObject.GetPointer( ) != o )
+  {
+    this->m_ITKObject = o;
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Object::
+SetVTK( vtkObjectBase* o )
+{
+  if( this->m_VTKObject.GetPointer( ) != o )
+  {
+    this->m_VTKObject = o;
+    this->Modified( );
+
+  } // fi
+}
+
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Object::
 Object( )
index 92de13cb646f4823107a073628e5558dc3e5c065..dd7d9b61d20aeb63d5baae08f1d0bac09a91a25d 100644 (file)
@@ -43,6 +43,9 @@ namespace cpPlugins
       virtual void Modified( ) const;
       void SetViewCoords( float x, float y );
 
+      void SetITK( itk::LightObject* o );
+      void SetVTK( vtkObjectBase* o );
+
       template< class T >
         inline T* GetITK( );
 
index c710a8ff823a1cbb912c6389cddbb8a984e03fe5..5434319fb09c1d9e7a8b47169e15185d83cda862 100644 (file)
@@ -46,7 +46,9 @@ GetNumberOfOutputs( ) const
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::ProcessObject::
-SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
+SetInput(
+  const std::string& id, cpPlugins::Interface::DataObject::Pointer* dobj
+  )
 {
   _TDataContainer::iterator i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
@@ -69,9 +71,9 @@ Update( )
   _TDataContainer::iterator i = this->m_Inputs.begin( );
   for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
   {
-    if( i->second.IsNotNull( ) )
+    if( i->second->IsNotNull( ) )
     {
-      Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
+      Self* src = dynamic_cast< Self* >( ( *( i->second ) )->GetSource( ) );
       if( src != NULL )
         r = src->Update( );
     }
@@ -94,8 +96,8 @@ DisconnectOutputs( )
 {
   _TDataContainer::iterator i = this->m_Outputs.begin( );
   for( ; i != this->m_Outputs.end( ); ++i )
-    if( i->second.IsNotNull( ) )
-      i->second->DisconnectPipeline( );
+    if( i->second->IsNotNull( ) )
+      ( *( i->second ) )->DisconnectPipeline( );
 }
 
 // -------------------------------------------------------------------------
@@ -184,14 +186,31 @@ cpPlugins::Interface::ProcessObject::
   if( this->m_ParametersDialog != NULL )
     delete this->m_ParametersDialog;
 #endif // cpPlugins_Interface_QT4
+
+  /*
+    auto iIt = this->m_Inputs.begin( );
+    for( ; iIt != this->m_Inputs.end( ); ++iIt )
+    delete iIt->second;
+    this->m_Inputs.clear( );
+  */
+
+  auto oIt = this->m_Outputs.begin( );
+  for( ; oIt != this->m_Outputs.end( ); ++oIt )
+    delete oIt->second;
+  this->m_Outputs.clear( );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::ProcessObject::
 _AddInput( const std::string& name )
 {
-  this->m_Inputs[ name ] = NULL;
-  this->Modified( );
+  auto i = this->m_Inputs.find( name );
+  if( i == this->m_Inputs.end( ) )
+  {
+    this->m_Inputs[ name ] = NULL;
+    this->Modified( );
+
+  } // fi
 }
 
 // eof - $RCSfile$
index b9deb925802afd32f701699b414c0c451183fe46..ec6cb2a53bb7a69fe96d3d166691f2ec8d58666c 100644 (file)
@@ -61,7 +61,7 @@ namespace cpPlugins
       unsigned int GetNumberOfInputs( ) const;
       unsigned int GetNumberOfOutputs( ) const;
 
-      virtual bool SetInput( const std::string& id, DataObject* dobj );
+      virtual bool SetInput( const std::string& id, DataObject::Pointer* dobj );
 
       virtual std::string Update( );
       virtual void DisconnectOutputs( );
@@ -76,16 +76,34 @@ namespace cpPlugins
       virtual bool ExecConfigurationDialog( QWidget* parent );
 
       template< class T >
-        inline T* GetInput( const std::string& id );
+        inline T* GetInputData( const std::string& id );
 
       template< class T >
-        inline const T* GetInput( const std::string& id ) const;
+        inline const T* GetInputData( const std::string& id ) const;
 
       template< class T >
-        inline T* GetOutput( const std::string& id );
+        inline T* GetOutputData( const std::string& id );
 
       template< class T >
-        inline const T* GetOutput( const std::string& id ) const;
+        inline const T* GetOutputData( const std::string& id ) const;
+
+      DataObject::Pointer* GetOutputPort( const std::string& id )
+      {
+        auto i = this->m_Outputs.find( id );
+        if( i != this->m_Outputs.end( ) )
+          return( i->second );
+        else
+          return( NULL );
+      }
+
+      const DataObject::Pointer* GetOutputPort( const std::string& id ) const
+      {
+        auto i = this->m_Outputs.find( id );
+        if( i != this->m_Outputs.end( ) )
+          return( i->second );
+        else
+          return( NULL );
+      }
 
     protected:
       ProcessObject( );
@@ -117,7 +135,7 @@ namespace cpPlugins
       SimpleMPRWidget*                             m_MPRViewer;
       bool                                         m_Interactive;
 
-      typedef std::map< std::string, DataObject::Pointer > _TDataContainer;
+      typedef std::map< std::string, DataObject::Pointer* > _TDataContainer;
       _TDataContainer m_Inputs;
       _TDataContainer m_Outputs;
     };
index 33b4a2022cb558bc9a943c4be8a8c4240038116d..a3362fc5b8ce25de6305aa15d636456cb575c7cc 100644 (file)
@@ -4,11 +4,11 @@
 // -------------------------------------------------------------------------
 template< class T >
 T* cpPlugins::Interface::ProcessObject::
-GetInput( const std::string& id )
+GetInputData( const std::string& id )
 {
   _TDataContainer::iterator i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
-    return( dynamic_cast< T* >( i->second.GetPointer( ) ) );
+    return( dynamic_cast< T* >( i->second->GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -16,11 +16,11 @@ GetInput( const std::string& id )
 // -------------------------------------------------------------------------
 template< class T >
 const T* cpPlugins::Interface::ProcessObject::
-GetInput( const std::string& id ) const
+GetInputData( const std::string& id ) const
 {
   _TDataContainer::const_iterator i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
-    return( dynamic_cast< const T* >( i->second.GetPointer( ) ) );
+    return( dynamic_cast< const T* >( i->second->GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -28,11 +28,11 @@ GetInput( const std::string& id ) const
 // -------------------------------------------------------------------------
 template< class T >
 T* cpPlugins::Interface::ProcessObject::
-GetOutput( const std::string& id )
+GetOutputData( const std::string& id )
 {
   _TDataContainer::iterator i = this->m_Outputs.find( id );
   if( i != this->m_Outputs.end( ) )
-    return( dynamic_cast< T* >( i->second.GetPointer( ) ) );
+    return( dynamic_cast< T* >( i->second->GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -40,11 +40,11 @@ GetOutput( const std::string& id )
 // -------------------------------------------------------------------------
 template< class T >
 const T* cpPlugins::Interface::ProcessObject::
-GetOutput( const std::string& id ) const
+GetOutputData( const std::string& id ) const
 {
   _TDataContainer::const_iterator i = this->m_Outputs.find( id );
   if( i != this->m_Outputs.end( ) )
-    return( dynamic_cast< const T* >( i->second.GetPointer( ) ) );
+    return( dynamic_cast< const T* >( i->second->GetPointer( ) ) );
   else
     return( NULL );
 }
@@ -54,8 +54,15 @@ template< class O >
 void cpPlugins::Interface::ProcessObject::
 _AddOutput( const std::string& id )
 {
-  this->m_Outputs[ id ] = O::New( );
-  this->m_Outputs[ id ]->SetSource( this );
+  auto oIt = this->m_Outputs.find( id );
+  if( oIt == this->m_Outputs.end( ) )
+  {
+    this->m_Outputs[ id ] = new DataObject::Pointer( );
+    oIt = this->m_Outputs.find( id );
+
+  } // fi
+  *( oIt->second ) = O::New( );
+  ( *( oIt->second ) )->SetSource( this );
   this->Modified( );
 }
 
index ab1891a1cd073859e0467c11e431e61677c50704..b37c2caa8b5c92d2418c6450515389847350f3a3 100644 (file)
@@ -106,11 +106,12 @@ HasFilter( const std::string& name ) const
 }
 
 // -------------------------------------------------------------------------
-bool cpPlugins::Interface::Workspace::
+cpPlugins::Interface::Workspace::
+TFilter* cpPlugins::Interface::Workspace::
 CreateFilter( const std::string& filter, const std::string& name )
 {
   if( this->m_Plugins == NULL )
-    return( false );
+    return( NULL );
 
   // Get or create new filter from name
   if( !( this->m_Graph->HasVertexIndex( name ) ) )
@@ -124,13 +125,12 @@ CreateFilter( const std::string& filter, const std::string& name )
       
       TObject::Pointer o = f.GetPointer( );
       this->m_Graph->SetVertex( name, o );
-      return( true );
-    }
-    else
-      return( false );
+
+    } // fi
+    return( f.GetPointer( ) );
   }
   else
-    return( true );
+    return( this->GetFilter( name ) );
 }
 
 // -------------------------------------------------------------------------
@@ -211,7 +211,7 @@ Connect(
     return( false );
 
   // Real connection
-  dest->SetInput( input_name, orig->GetOutput< TData >( output_name ) );
+  dest->SetInput( input_name, orig->GetOutputPort( output_name ) );
   this->m_Graph->AddEdge(
     orig_filter, dest_filter,
     TConnection( output_name, input_name )
@@ -221,7 +221,7 @@ Connect(
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Workspace::
-Connect( TData* input_object, const std::string& input_name )
+Connect( TData::Pointer* input_object, const std::string& input_name )
 {
   auto port = this->m_ExposedInputPorts.find( input_name );
   if( port != this->m_ExposedInputPorts.end( ) )
index ec55470ae96d9927ba0ad7c8d0b6ccddf616dd21..b4c464124765668b64e0508fdc10dd45c679cdf3 100644 (file)
@@ -70,7 +70,9 @@ namespace cpPlugins
       TFilter* GetFilter( const std::string& name );
       const TFilter* GetFilter( const std::string& name ) const;
       bool HasFilter( const std::string& name ) const;
-      bool CreateFilter( const std::string& filter, const std::string& name );
+      TFilter* CreateFilter(
+        const std::string& filter, const std::string& name
+        );
       bool RenameFilter(
         const std::string& old_name, const std::string& new_name
         );
@@ -90,7 +92,9 @@ namespace cpPlugins
         const std::string& orig_filter, const std::string& dest_filter,
         const std::string& output_name, const std::string& input_name
         );
-      bool Connect( TData* input_object, const std::string& exposed_port );
+      bool Connect(
+        TData::Pointer* input_object, const std::string& exposed_port
+        );
       void RemoveConnection(
         const std::string& dest_filter, const std::string& input_name
         );
index fb9d6ea704476436de736fccc1d4deaff65f334e..1bab79d5a70ac9279ad80411b7d03eb4f9fbd412 100644 (file)
@@ -27,8 +27,7 @@ cpPlugins::BasicFilters::BinaryErodeImageFilter::
 std::string cpPlugins::BasicFilters::BinaryErodeImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "BinaryErodeImageFilter: No input image." );
 
@@ -79,8 +78,7 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out != NULL )
   {
     out->SetITK< O >( filter->GetOutput( ) );
index 19561125bf368da562dc40a7d5cc74b28de590d7..5f159ce6410de2384beb69fd40b0a54e926be5be 100644 (file)
@@ -32,8 +32,7 @@ cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "BinaryThresholdImageFilter: No input image." );
 
@@ -85,8 +84,7 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out != NULL )
   {
     out->SetITK< O >( filter->GetOutput( ) );
index 3d3104f90b562239ce544450a398d31ffbb94b30..fcb0269e9841002dee52812de0fd121081acef2d 100644 (file)
@@ -29,10 +29,9 @@ std::string cpPlugins::BasicFilters::Cutter::
 _GenerateData( )
 {
   // Get inputs
-  cpPlugins::Interface::Mesh* mesh =
-    this->GetInput< cpPlugins::Interface::Mesh >( "InputMesh" );
-  cpPlugins::Interface::ImplicitFunction* function =
-    this->GetInput< cpPlugins::Interface::ImplicitFunction >(
+  auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "InputMesh" );
+  auto function =
+    this->GetInputData< cpPlugins::Interface::ImplicitFunction >(
       "InputFunction"
       );
   if( function == NULL )
@@ -47,8 +46,7 @@ _GenerateData( )
   cutter->Update( );
 
   // Execute filter
-  cpPlugins::Interface::Mesh* out =
-    this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
   out->SetVTK( cutter->GetOutput( ) );
 
   return( "" );
index 3f566e5834cbdc2df323037c65ba27f02d408d41..de007796337bc4cc84eb0f84467daf4a7ded6024 100644 (file)
@@ -28,8 +28,7 @@ cpPlugins::BasicFilters::ExtractSliceImageFilter::
 std::string cpPlugins::BasicFilters::ExtractSliceImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "ExtractSliceImageFilter: No input image." );
 
@@ -80,8 +79,7 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out != NULL )
   {
     out->SetITK< O >( filter->GetOutput( ) );
diff --git a/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx b/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx
new file mode 100644 (file)
index 0000000..78d5da4
--- /dev/null
@@ -0,0 +1,33 @@
+#include "InputDataReproducer.h"
+
+// -------------------------------------------------------------------------
+cpPlugins::BasicFilters::InputDataReproducer::
+InputDataReproducer( )
+  : Superclass( )
+{
+  this->_AddInput( "Input" );
+  this->_AddOutput< cpPlugins::Interface::DataObject >( "Output" );
+  this->m_Parameters->Clear( );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::BasicFilters::InputDataReproducer::
+~InputDataReproducer( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::BasicFilters::InputDataReproducer::
+_GenerateData( )
+{
+  auto i = this->m_Inputs.find( "Input" );
+  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 );
+  return( "" );
+}
+
+// eof - $RCSfile$
diff --git a/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.h b/lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.h
new file mode 100644 (file)
index 0000000..870266f
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef __CPPLUGINS__PLUGINS__INPUTDATAREPRODUCER__H__
+#define __CPPLUGINS__PLUGINS__INPUTDATAREPRODUCER__H__
+
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+
+namespace cpPlugins
+{
+  namespace BasicFilters
+  {
+    /**
+     */
+    class cpPluginsBasicFilters_EXPORT InputDataReproducer
+      : public cpPlugins::Interface::ProcessObject
+    {
+    public:
+      typedef InputDataReproducer                 Self;
+      typedef cpPlugins::Interface::ProcessObject Superclass;
+      typedef itk::SmartPointer< Self >           Pointer;
+      typedef itk::SmartPointer< const Self >     ConstPointer;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro(
+        InputDataReproducer,
+        cpPluginsInterfaceProcessObject
+        );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::InputDataReproducer,
+        PortObjects
+        );
+
+    protected:
+      InputDataReproducer( );
+      virtual ~InputDataReproducer( );
+
+      virtual std::string _GenerateData( );
+
+    private:
+      // Purposely not implemented
+      InputDataReproducer( const Self& );
+      Self& operator=( const Self& );
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__PLUGINS__INPUTDATAREPRODUCER__H__
+
+// eof - $RCSfile$
index 71b3af481495376306fb099683b047d7897e9858..4dfcd5a09be548afabfbc31dd74f52fbca6e85d7 100644 (file)
@@ -130,8 +130,7 @@ ExecConfigurationDialog( QWidget* parent )
   
   // Get bounding box
   double bbox[ 6 ];
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   bool input_found = false;
   if( image != NULL )
   {
@@ -139,8 +138,7 @@ ExecConfigurationDialog( QWidget* parent )
     input_found = true;
 
   } // fi
-  cpPlugins::Interface::Mesh* mesh =
-    this->GetInput< cpPlugins::Interface::Mesh >( "Input" );
+  auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
   if( mesh != NULL )
   {
     mesh->GetVTK< vtkPolyData >( )->GetBounds( bbox );
@@ -218,12 +216,10 @@ cpPlugins::BasicFilters::MacheteFilter::
 std::string cpPlugins::BasicFilters::MacheteFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image != NULL )
     return( this->_FromImage( image ) );
-  cpPlugins::Interface::Mesh* mesh =
-    this->GetInput< cpPlugins::Interface::Mesh >( "Input" );
+  auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
   if( mesh == NULL )
     return( this->_FromMesh( mesh ) );
   return( "MacheteFilter: No valid input." );
@@ -290,23 +286,23 @@ _RealImage( itk::DataObject* dobj )
   filter->Update( );
 
   // Get output names
-  auto pos_name = this->GetOutput< _TObj >( "PositiveOutput" )->GetName( );
-  auto neg_name = this->GetOutput< _TObj >( "NegativeOutput" )->GetName( );
+  auto pos_name = this->GetOutputData< _TObj >( "PositiveOutput" )->GetName( );
+  auto neg_name = this->GetOutputData< _TObj >( "NegativeOutput" )->GetName( );
 
   // Connect outputs (and correct their types and names)
-  _TImage* pos_out = this->GetOutput< _TImage >( "PositiveOutput" );
+  _TImage* pos_out = this->GetOutputData< _TImage >( "PositiveOutput" );
   if( pos_out == NULL )
   {
     this->_AddOutput< _TImage >( "PositiveOutput" );
-    pos_out = this->GetOutput< _TImage >( "PositiveOutput" );
+    pos_out = this->GetOutputData< _TImage >( "PositiveOutput" );
     pos_out->SetName( pos_name );
 
   } // fi
-  _TImage* neg_out = this->GetOutput< _TImage >( "NegativeOutput" );
+  _TImage* neg_out = this->GetOutputData< _TImage >( "NegativeOutput" );
   if( neg_out == NULL )
   {
     this->_AddOutput< _TImage >( "NegativeOutput" );
-    neg_out = this->GetOutput< _TImage >( "NegativeOutput" );
+    neg_out = this->GetOutputData< _TImage >( "NegativeOutput" );
     neg_out->SetName( neg_name );
 
   } // fi
index 980ba8d01602b3d05ee55218b1b84d9ae0005fc3..a488ba9772f971cd8c8a463ab2ff18a247ddefd9 100644 (file)
@@ -38,8 +38,7 @@ cpPlugins::BasicFilters::MacheteImageFilter::
 std::string cpPlugins::BasicFilters::MacheteImageFilter::
 _GenerateData()
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >("Input");
+  auto image = this->GetInputData< cpPlugins::Interface::Image >("Input");
   if (image == NULL)
     return("MacheteImageFilter: No input image.");
 
@@ -90,8 +89,7 @@ _RealGD(itk::DataObject* image)
   filter->Update();
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >("Output");
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >("Output");
   if (out != NULL)
   {
     out->SetITK< O >( filter->GetOutput( ) );
index ce6aa32fba7b3ab1372ffde0e1a19320482de8c4..95ede25066c8db58751483cac71ea0d71a7f9464 100644 (file)
@@ -28,8 +28,7 @@ std::string cpPlugins::BasicFilters::MarchingCubes::
 _GenerateData( )
 {
   // Get input
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "MarchingCubes: Input data is not a valid image." );
   vtkImageData* vtk_image = image->GetVTK< vtkImageData >( );
@@ -62,8 +61,7 @@ _GenerateData( )
     return( "MarchingCubes: Input data does not have a valid dimension." );
 
   // Execute filter
-  cpPlugins::Interface::Mesh* out =
-    this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
   out->SetVTK( pd );
   return( "" );
 }
index a74714c6bb3a125ba7eb1a38218f2d0eabe3e180..02eed731418a90726004d466725161087068b050 100644 (file)
@@ -25,8 +25,7 @@ cpPlugins::BasicFilters::MedianImageFilter::
 std::string cpPlugins::BasicFilters::MedianImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "MedianImageFilter: No input image." );
 
@@ -70,8 +69,7 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out != NULL )
   {
     out->SetITK< O >( filter->GetOutput( ) );
index dd2bd1ca346960af8ded4c3af10a0d8a02705d5f..3a3f12c12fe4dce14bbf9f7aa04ad622a285ddba 100644 (file)
@@ -30,8 +30,7 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "OtsuThresholdImageFilter: No input image." );
 
@@ -78,8 +77,7 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out != NULL )
   {
     out->SetITK< O >( filter->GetOutput( ) );
index 433c0fae8bafc32d367c537553f89bb31d4a23df..f06cda81fff5b0c477b35c6ea3e9a9606c3dfe3b 100644 (file)
@@ -32,8 +32,7 @@ cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "RGBImageToOtherChannelsFilter: No input image." );
 
@@ -86,8 +85,7 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out != NULL )
   {
     out->SetITK< _O >( filter->GetOutput( ) );
index 147855535c944a96c4957950860e7465d49539fb..1487e387c6ecb957024676b214385a6a6f679926 100644 (file)
@@ -38,8 +38,7 @@ cpPlugins::BasicFilters::SignedMaurerDistanceMapImageFilter::
 std::string cpPlugins::BasicFilters::SignedMaurerDistanceMapImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "SignedMaurerDistanceMapImageFilter: No input image." );
 
@@ -98,8 +97,7 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out != NULL )
   {
     out->SetITK< O >( filter->GetOutput( ) );
index cad8eb80535cca632641a426017003274788195f..f989635f039427972112ff8ff2a97faeae78cdf7 100644 (file)
@@ -50,8 +50,7 @@ _GenerateData( )
   src->Update( );
 
   // Execute filter
-  cpPlugins::Interface::Mesh* out =
-    this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
   out->SetVTK( src->GetOutput( ) );
   return( "" );
 }
index d2d619c9920eb98e041bca08f4239c537c56e468..c093e210b3d103ded7a434714a0a1d8b738c7336 100644 (file)
@@ -360,8 +360,7 @@ template< class I >
 std::string cpPlugins::IO::ImageReader::
 _RealGD( const TStringList& names )
 {
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out == NULL )
     return( "ImageReader: No output object properly created." );
 
index 5b2f89be3ec2a144880424e755544374d15dd103..a06f2d21062b9781d0b58d9b34b16ceb08261b8b 100644 (file)
@@ -77,8 +77,7 @@ template< unsigned int D >
 std::string cpPlugins::IO::ImageWriter::
 _GD0_Image( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "ImageWriter: No input image." );
 
@@ -95,8 +94,7 @@ template< unsigned int D >
 std::string cpPlugins::IO::ImageWriter::
 _GD0_VectorImage( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "ImageWriter: No input image." );
 
index 27d8f559e7601e352be172245a76fe2f768c46ca..d1410e8666e06daf2db44da0ee9d896dd06a9e13 100644 (file)
@@ -103,8 +103,7 @@ _GD1( )
   pdr->SetFileName( fname.c_str( ) );
   pdr->Update( );
 
-  cpPlugins::Interface::Mesh* out =
-    this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
   if( out != NULL )
     out->SetVTK( pdr->GetOutput( ) );
   else
index feb05ad5e40f5064ef09224f59fcc612be05efa3..37b936c022439b21ee467cd30d6075da9eb681ac 100644 (file)
@@ -64,8 +64,7 @@ cpPlugins::IO::MeshWriter::
 std::string cpPlugins::IO::MeshWriter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Mesh* mesh =
-    this->GetInput< cpPlugins::Interface::Mesh >( "Input" );
+  auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
   if( mesh == NULL )
     return( "MeshWriter: No input mesh." );
   vtkPolyData* i = mesh->GetVTK< vtkPolyData >( );
index 8dbaf9fe96ddcd372fb098cd5e409b8c41ab989e..c5c8383eb2a6813e802184a78e96aa48bbb9e97a 100644 (file)
@@ -33,8 +33,8 @@ _GenerateData( )
   typedef itk::ImageBase< 2 > _2DImage;
   typedef itk::ImageBase< 3 > _3DImage;
 
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "ReferenceImage" );
+  auto image =
+    this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
   if( image == NULL )
     return( "SeedWidget: No input image." );
 
@@ -60,8 +60,8 @@ _GD0( itk::DataObject* image )
   typedef cpExtensions::Interaction::ImageInteractorStyle _S;
 
   I* base_image = dynamic_cast< I* >( image );
-  cpPlugins::Interface::PointList* out =
-    this->GetOutput< cpPlugins::Interface::PointList >( "Output" );
+  auto out =
+    this->GetOutputData< cpPlugins::Interface::PointList >( "Output" );
   double aux_pnt[ 3 ];
   unsigned int dim = ( I::ImageDimension < 3 )? I::ImageDimension: 3;