]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 21 Apr 2016 15:57:42 +0000 (10:57 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 21 Apr 2016 15:57:42 +0000 (10:57 -0500)
30 files changed:
appli/PipelineEditor/PipelineEditor.cxx
appli/examples/extensions/example_ImageSlice.cxx
appli/examples/plugins/QT/example_MPRViewer/example_MPRViewer.cxx
appli/examples/plugins/example_ReadWriteImage.cxx
appli/examples/plugins/example_ShowImage.cxx
lib/cpExtensions/QT/SimpleMPRWidget.cxx
lib/cpExtensions/QT/SimpleMPRWidget.h
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpExtensions/Visualization/ImageSliceActors.h
lib/cpPlugins/ProcessObject.cxx
lib/cpPlugins/ProcessObject.h
lib/cpPlugins/ProcessObject.hxx
lib/cpPlugins/Workspace.cxx
plugins/cpPluginsGenericFilters/JoinBoundingBoxes.cxx
plugins/cpPluginsIO/ImageWriter.cxx
plugins/cpPluginsIO/MeshReader.cxx
plugins/cpPluginsIO/MeshWriter.cxx
plugins/cpPluginsImageFilters/AndImageFilter.cxx
plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx
plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx
plugins/cpPluginsImageFilters/CastImageFilter.cxx
plugins/cpPluginsImageFilters/MultiScaleGaussianImageFilter.cxx
plugins/cpPluginsImageFilters/OrImageFilter.cxx
plugins/cpPluginsImageFilters/ResampleImageFilter.cxx
plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx
plugins/cpPluginsImageMeshFilters/MarchingCubes.cxx
plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx
plugins/cpPluginsMeshFilters/AppendMeshesFilter.cxx
plugins/cpPluginsWidgets/NoInteractiveSeedWidget.cxx
plugins/cpPluginsWidgets/SeedWidget.cxx

index 7c06aac5af584e0432a6264c967e55e090fab3bc..0f2d3fde2d6d5cf1efc60b1010b0f7ce59f01a2e 100644 (file)
@@ -1,9 +1,13 @@
 #include "PipelineEditor.h"
 #include "ui_PipelineEditor.h"
 
+#include <QMessageBox>
+
 #include <cpPipelineEditor/Editor.h>
 #include <cpExtensions/QT/PropertyWidget.h>
-#include <QMessageBox>
+
+#include <vtkImageData.h>
+#include <vtkPolyData.h>
 #include <vtkRenderWindowInteractor.h>
 
 // -------------------------------------------------------------------------
@@ -76,8 +80,6 @@ _ShowFilterOutput(
   const std::string& filter_name, const std::string& output_name
   )
 {
-  typedef cpPlugins::DataObject _TDataObject;
-
   // Update filter, if needed
   this->_ExecFilter( filter_name );
 
@@ -85,47 +87,34 @@ _ShowFilterOutput(
   auto filter = this->m_Workspace.GetFilter( filter_name );
   if( filter != NULL )
   {
-    auto output = filter->GetOutputData( output_name );
-    if( output != NULL )
+    auto id = filter->GetOutputData< vtkImageData >( output_name );
+    auto md = filter->GetOutputData< vtkPolyData >( output_name );
+    if( id != NULL )
     {
-      std::string data_name = output_name + "@" + filter_name;
-      auto idata = output->GetVTK< vtkImageData >( );
-      auto mdata = output->GetVTK< vtkPolyData >( );
-      if( idata != NULL )
-      {
-        if( this->m_UI->Viewer->AddData( idata, data_name, "" ) )
-        {
-          if( this->m_UI->Viewer->GetNumberOfData( ) > 1 )
-            this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 );
-          else
-            this->m_UI->Viewer->SetMainImage( data_name );
-          this->_Block( );
-          this->m_UI->Viewer->ShowData( data_name );
-          this->_UnBlock( );
-
-        } // fi
-      }
-      else if( mdata != NULL )
-      {
-        if( this->m_UI->Viewer->AddData( mdata, data_name ) )
-        {
-          this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 );
-          this->_Block( );
-          this->m_UI->Viewer->ShowData( data_name );
-          this->_UnBlock( );
-
-        } // fi
-      }
-      else
-        QMessageBox::critical(
-          this,
-          QMessageBox::tr( "Error showing data" ),
-          QMessageBox::tr( "No known VTK conversion!" )
-          );
-
-    } // fi
-
-  } // fi
+      this->_Block( );
+      this->m_UI->Viewer->Clear( );
+      this->m_UI->Viewer->SetMainImage( id );
+      this->_UnBlock( );
+    }
+    else if( md != NULL )
+    {
+      this->_Block( );
+      this->m_UI->Viewer->AddMesh( md );
+      this->_UnBlock( );
+    }
+    else
+      QMessageBox::critical(
+        this,
+        QMessageBox::tr( "Error showing data" ),
+        QMessageBox::tr( "No known VTK conversion!" )
+        );
+  }
+  else
+    QMessageBox::critical(
+      this,
+      QMessageBox::tr( "Error showing data" ),
+      QMessageBox::tr( "Unknown filter." )
+      );
 }
 
 // -------------------------------------------------------------------------
@@ -134,6 +123,7 @@ _HideFilterOutput(
   const std::string& filter_name, const std::string& output_name
   )
 {
+  /*
   // Get output
   auto filter = this->m_Workspace.GetFilter( filter_name );
   if( filter != NULL )
@@ -147,6 +137,7 @@ _HideFilterOutput(
     } // fi
 
   } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
@@ -155,6 +146,7 @@ _PropertiesFilterOutput(
   const std::string& filter_name, const std::string& output_name
   )
 {
+  /*
   // Get output
   auto filter = this->m_Workspace.GetFilter( filter_name );
   if( filter != NULL )
@@ -179,6 +171,7 @@ _PropertiesFilterOutput(
         );
 
   } // fi
+  */
 }
 
 // eof - $RCSfile$
index 86dc891b63bdb9884322d73ae0f05a331380d536..b45588a128dad8b02168dca6fdce12c34f358bb1 100644 (file)
@@ -24,7 +24,7 @@ int main( int argc, char* argv[] )
   // Prepate slice objects
   vtkSmartPointer< cpExtensions::Visualization::ImageSliceActors > actors =
     vtkSmartPointer< cpExtensions::Visualization::ImageSliceActors >::New( );
-  actors->SetInputConnection( reader->GetOutputPort( ) );
+  actors->SetInputConnection( reader->GetOutputPort( ), 2  );
 
   // Prepare scene
   vtkSmartPointer< vtkRenderer > ren =
index 698b082a1726b56f221894d4b58bc751f0125b32..eb6daff534ca78898aede3ee93e12029a4e2449f 100644 (file)
@@ -66,7 +66,7 @@ example_MPRViewer( int argc, char* argv[], QWidget* parent )
   } // yrt
 
   this->m_UI->Viewer->SetMainImage(
-    this->m_Reader->GetOutputData( "Output" )->GetVTK< vtkImageData >( )
+    this->m_Reader->GetOutputData< vtkImageData >( "Output" )
     );
 }
 
index 5532068d1fda42aa8aa5324da6a5a1fa5ca0f849..7da797cf4336428b1b9dc22976915d33ea02e346 100644 (file)
@@ -61,7 +61,7 @@ int main( int argc, char* argv[] )
     writer_params->SetSaveFileName( "FileName", argv[ argc - 1 ] );
 
     // Connect filters
-    writer->SetInput( "Input", reader->GetOutput( "Output" ) );
+    writer->SetInputPort( "Input", reader->GetOutputPort( "Output" ) );
 
     // Execute filters
     try
index d08cc146f7f866b6ff7055c2b086742ba198bf92..7a74ff19db52bccd6bc85fd51918774b36cf77e0 100644 (file)
@@ -59,9 +59,7 @@ int main( int argc, char* argv[] )
   // Prepate slice objects
   vtkSmartPointer< cpExtensions::Visualization::ImageSliceActors > actors =
     vtkSmartPointer< cpExtensions::Visualization::ImageSliceActors >::New( );
-  actors->SetInputData(
-    reader->GetOutputData( "Output" )->GetVTK< vtkImageData >( ), 1
-    );
+  actors->SetInputData( reader->GetOutputData< vtkImageData >( "Output" ), 2 );
 
   // Prepare scene
   vtkSmartPointer< vtkRenderer > ren =
index f3f1eb3c10cf7bafbe6dce11a366b67e33c42666..d335f538456d2439f6da9ff5e50cfe22963aec7d 100644 (file)
@@ -75,6 +75,23 @@ cpExtensions::QT::SimpleMPRWidget::
   delete this->m_UI;
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+Clear( )
+{
+  for( unsigned int i = 0; i < 4; ++i )
+    this->m_Renderers[ i ]->RemoveAllViewProps( );
+  for( unsigned int i = 0; i < 3; ++i )
+  {
+    if( this->m_2DSlices[ i ].GetPointer( ) != NULL )
+      this->m_2DSlices[ i ]->Clear( );
+    if( this->m_3DSlices[ i ].GetPointer( ) != NULL )
+      this->m_3DSlices[ i ]->Clear( );
+
+  } // rof
+  this->m_PolyDatas.clear( );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
 SetMainImage( vtkImageData* image )
@@ -122,6 +139,36 @@ SetMainImage( vtkImageData* image )
   this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+AddMesh( vtkPolyData* mesh )
+{
+  PolyDataActor a;
+  a.Configure( mesh );
+  this->m_PolyDatas[ mesh ] = a;
+  this->m_Renderers[ 3 ]->AddViewProp( a.Actor );
+
+  bool has_main_image = false;
+  for( unsigned int i = 0; i < 3; ++i )
+  {
+    if( this->m_2DSlices[ i ].GetPointer( ) != NULL )
+    {
+      if( this->m_2DSlices[ i ]->GetInputData( ) != NULL )
+      {
+        has_main_image = true;
+        this->m_2DSlices[ i ]->AddMesh( mesh );
+        this->m_2DSlices[ i ]->Render( );
+
+      } // fi
+
+    } // fi
+
+  } // rof
+  if( !has_main_image )
+    this->m_Renderers[ 3 ]->ResetCamera( );
+  this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
 _SyncBottom( int a, int b )
index 3dd23098fa40f43b7918daa10c7a7aff7e18bcd8..42a09f667a2f02abe30f6353c75a00ed8c7d4209 100644 (file)
@@ -5,14 +5,16 @@
 
 #ifdef cpExtensions_QT4
 
+#include <map>
 #include <QWidget>
-
-#include <cpExtensions/Visualization/ImageSliceActors.h>
+#include <vtkPolyDataNormals.h>
+#include <vtkQuadricLODActor.h>
 #include <vtkRenderer.h>
+#include <vtkStripper.h>
 #include <vtkSmartPointer.h>
+#include <cpExtensions/Visualization/ImageSliceActors.h>
 
 /*
-  #include <map>
   #include <string>
   #include <vtkSmartPointer.h>
   #include <vtkImageData.h>
@@ -64,12 +66,50 @@ namespace cpExtensions
          typedef TMPRObjects::TLeaveCommand              TLeaveCommand;
       */
 
+      struct PolyDataActor
+      {
+        vtkSmartPointer< vtkPolyData >        Data;
+        vtkSmartPointer< vtkPolyDataNormals > Normals;
+        vtkSmartPointer< vtkStripper >        Stripper;
+        vtkSmartPointer< vtkPolyDataMapper >  Mapper;
+        vtkSmartPointer< vtkQuadricLODActor > Actor;
+
+        void Configure( vtkPolyData* data )
+          {
+            this->Data = data;
+            double r[ 2 ];
+            this->Data->GetScalarRange( r );
+
+            this->Normals  = vtkSmartPointer< vtkPolyDataNormals >::New( );
+            this->Stripper = vtkSmartPointer< vtkStripper >::New( );
+            this->Mapper   = vtkSmartPointer< vtkPolyDataMapper >::New( );
+            this->Actor    = vtkSmartPointer< vtkQuadricLODActor >::New( );
+
+            this->Normals->SetInputData( this->Data );
+            this->Normals->SetFeatureAngle( 60.0 );
+            this->Stripper->SetInputConnection(
+              this->Normals->GetOutputPort( )
+              );
+            this->Mapper->SetInputConnection(
+              this->Stripper->GetOutputPort( )
+              );
+            this->Mapper->UseLookupTableScalarRangeOff( );
+            this->Mapper->SetScalarRange(
+              r[ 0 ], ( ( r[ 1 ] - r[ 0 ] ) * 0.75 ) + r[ 0 ]
+              );
+            this->Actor->SetMapper( this->Mapper );
+            this->Actor->DeferLODConstructionOff( );
+          }
+      };
+
     public:
       explicit SimpleMPRWidget( QWidget* parent = 0 );
       virtual ~SimpleMPRWidget( );
 
       // Data management
+      void Clear( );
       void SetMainImage( vtkImageData* image );
+      void AddMesh( vtkPolyData* mesh );
       
       /* TODO
          unsigned int GetNumberOfData( ) const;
@@ -115,6 +155,8 @@ namespace cpExtensions
       vtkSmartPointer< TActors >     m_2DSlices[ 3 ];
       vtkSmartPointer< TActors >     m_3DSlices[ 3 ];
 
+      std::map< vtkPolyData*, PolyDataActor > m_PolyDatas;
+
       /* TODO
          static double cm_Colors[ 8 ][ 3 ];
          vtkSmartPointer< TMPRObjects > m_MPRObjects;
index be7efe304e83bbbed5911152a98d3e0f56673518..3fae553897c08cb62803721c7c9d0cac8137170d 100644 (file)
@@ -4,6 +4,7 @@
 #include <vtkCamera.h>
 #include <vtkImageData.h>
 #include <vtkImageProperty.h>
+#include <vtkPlane.h>
 #include <vtkProperty.h>
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
@@ -81,6 +82,37 @@ SetInputData( vtkImageData* data, int orientation )
   this->_ConfigureInput( orientation );
 }
 
+// -------------------------------------------------------------------------
+vtkImageData* cpExtensions::Visualization::ImageSliceActors::
+GetInputData( )
+{
+  if( this->m_Mapper.GetPointer( ) != NULL )
+    return( this->m_Mapper->GetInput( ) );
+  else
+    return( NULL );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+AddMesh( vtkPolyData* mesh )
+{
+  SourceActor< vtkCutter > a;
+  a.Create( );
+  a.Source->SetInputData( mesh );
+  a.Source->SetCutFunction( this->m_Mapper->GetSlicePlane( ) );
+  a.Source->SetValue( 0, 0 );
+  a.Source->GenerateTrianglesOff( );
+  a.Source->Update( );
+  a.Modified( );
+  this->m_Meshes[ mesh ] = a;
+  this->AddItem( a.Actor );
+
+  auto ren = this->m_Style->GetCurrentRenderer( );
+  if( ren != NULL )
+    if( ren->HasViewProp( this->m_Actor ) )
+      ren->AddViewProp( a.Actor );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 AssociateSlice( Self* slice )
index 4e29dc516916d5a0d3313f136a97a30208ca691e..7ff8838cc3fc83b540e20766a3503a3111060f8f 100644 (file)
@@ -4,8 +4,10 @@
 #include <cpExtensions/cpExtensions_Export.h>
 
 #include <cpExtensions/Interaction/ImageInteractorStyle.h>
+#include <map>
 #include <vtkActor.h>
 #include <vtkCursor3D.h>
+#include <vtkCutter.h>
 #include <vtkImageActor.h>
 #include <vtkImageSliceMapper.h>
 #include <vtkPolyDataMapper.h>
@@ -67,7 +69,6 @@ namespace cpExtensions
             this->Actor->Modified( );
           }
       };
-        
 
     public:
       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
@@ -82,6 +83,9 @@ namespace cpExtensions
       void Clear( );
       void SetInputConnection( vtkAlgorithmOutput* aout, int orientation );
       void SetInputData( vtkImageData* data, int orientation );
+      vtkImageData* GetInputData( );
+
+      void AddMesh( vtkPolyData* mesh );
 
       void AssociateSlice( Self* slice );
       void CleanAssociatedSlices( );
@@ -150,6 +154,9 @@ namespace cpExtensions
       // Secondary slices
       std::vector< vtkSmartPointer< Self > > m_AssociatedSlices;
 
+      // Associated meshes
+      std::map< vtkPolyData*, SourceActor< vtkCutter > > m_Meshes;
+
       // Cursor
       SourceActor< vtkCursor3D > m_Cursor;
 
index 050a2571269bd51040ad24feb4e85cbd1c7574bc..29e14f8c2514cab19dead2bd8e37f7a4fb37d314 100644 (file)
@@ -68,7 +68,7 @@ GetNumberOfOutputs( ) const
 // -------------------------------------------------------------------------
 cpPlugins::
 OutputPort& cpPlugins::ProcessObject::
-GetOutput( const std::string& id )
+GetOutputPort( const std::string& id )
 {
   static OutputPort null_port;
   auto i = this->m_Outputs.find( id );
@@ -84,7 +84,7 @@ GetOutput( const std::string& id )
 // -------------------------------------------------------------------------
 const cpPlugins::
 OutputPort& cpPlugins::ProcessObject::
-GetOutput( const std::string& id ) const
+GetOutputPort( const std::string& id ) const
 {
   static const OutputPort null_port;
   auto i = this->m_Outputs.find( id );
@@ -97,7 +97,7 @@ GetOutput( const std::string& id ) const
 // -------------------------------------------------------------------------
 cpPlugins::
 DataObject* cpPlugins::ProcessObject::
-GetInputData( const std::string& id )
+GetInput( const std::string& id )
 {
   auto i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
@@ -109,7 +109,7 @@ GetInputData( const std::string& id )
 // -------------------------------------------------------------------------
 const cpPlugins::
 DataObject* cpPlugins::ProcessObject::
-GetInputData( const std::string& id ) const
+GetInput( const std::string& id ) const
 {
   auto i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
@@ -121,7 +121,7 @@ GetInputData( const std::string& id ) const
 // -------------------------------------------------------------------------
 cpPlugins::
 DataObject* cpPlugins::ProcessObject::
-GetOutputData( const std::string& id )
+GetOutput( const std::string& id )
 {
   auto i = this->m_Outputs.find( id );
   if( i != this->m_Outputs.end( ) )
@@ -133,7 +133,7 @@ GetOutputData( const std::string& id )
 // -------------------------------------------------------------------------
 const cpPlugins::
 DataObject* cpPlugins::ProcessObject::
-GetOutputData( const std::string& id ) const
+GetOutput( const std::string& id ) const
 {
   auto i = this->m_Outputs.find( id );
   if( i != this->m_Outputs.end( ) )
@@ -144,7 +144,7 @@ GetOutputData( const std::string& id ) const
 
 // -------------------------------------------------------------------------
 bool cpPlugins::ProcessObject::
-SetInput( const std::string& id, const OutputPort& port )
+SetInputPort( const std::string& id, const OutputPort& port )
 {
   auto i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
index 908fd92f6a979f592dec46612f02e61d52f55ff4..1f888a9db864f9efcdbba1e48e3cefdf1489a43d 100644 (file)
@@ -43,15 +43,21 @@ namespace cpPlugins
     unsigned int GetNumberOfInputs( ) const;
     unsigned int GetNumberOfOutputs( ) const;
 
-    OutputPort& GetOutput( const std::string& id );
-    const OutputPort& GetOutput( const std::string& id ) const;
+    OutputPort& GetOutputPort( const std::string& id );
+    const OutputPort& GetOutputPort( 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;
+    DataObject* GetInput( const std::string& id );
+    const DataObject* GetInput( const std::string& id ) const;
+    DataObject* GetOutput( const std::string& id );
+    const DataObject* GetOutput( const std::string& id ) const;
 
-    bool SetInput( const std::string& id, const OutputPort& port );
+    template< class _TType >
+      _TType* GetInputData( const std::string& name );
+
+    template< class _TType >
+      _TType* GetOutputData( const std::string& name );
+
+    bool SetInputPort( const std::string& id, const OutputPort& port );
 
     void DisconnectInputs( );
     void DisconnectOutputs( );
index 73e87433ba6d92af212d0f45a6148d04916667b5..f0f2cd0d7c17a763b82637d14ab2aa6f33cfa6a9 100644 (file)
@@ -1,6 +1,42 @@
 #ifndef __CPPLUGINS__PROCESSOBJECT__HXX__
 #define __CPPLUGINS__PROCESSOBJECT__HXX__
 
+// -------------------------------------------------------------------------
+template< class _TType >
+_TType* cpPlugins::ProcessObject::
+GetInputData( const std::string& name )
+{
+  auto in = this->GetInput( name );
+  if( in != NULL )
+  {
+    auto i = in->GetITK< _TType >( );
+    auto v = in->GetVTK< _TType >( );
+    if     ( i != NULL ) return( i );
+    else if( v != NULL ) return( v );
+    else                 return( NULL );
+  }
+  else
+    return( NULL );
+}
+
+// -------------------------------------------------------------------------
+template< class _TType >
+_TType* cpPlugins::ProcessObject::
+GetOutputData( const std::string& name )
+{
+  auto out = this->GetOutput( name );
+  if( out != NULL )
+  {
+    auto i = out->GetITK< _TType >( );
+    auto v = out->GetVTK< _TType >( );
+    if     ( i != NULL ) return( i );
+    else if( v != NULL ) return( v );
+    else                 return( NULL );
+  }
+  else
+    return( NULL );
+}
+
 // -------------------------------------------------------------------------
 template< class O >
 void cpPlugins::ProcessObject::
index b29309a77b2377aedb220345d270957f9c7a6e1d..84188a7ebbbd31e10b368202a7dd8219608fccb9 100644 (file)
@@ -251,7 +251,7 @@ Connect(
     return( false );
 
   // Real connection
-  if( dest->SetInput( input_name, orig->GetOutput( output_name ) ) )
+  if( dest->SetInputPort( input_name, orig->GetOutputPort( output_name ) ) )
   {
     this->m_Graph->AddEdge(
       orig_filter, dest_filter,
@@ -272,7 +272,7 @@ Connect( const OutputPort& port, const std::string& exposed_port )
   {
     ProcessObject* filter = this->GetFilter( i->second.first );
     if( filter != NULL )
-      return( filter->SetInput( i->second.second, port ) );
+      return( filter->SetInputPort( i->second.second, port ) );
     else
       return( false );
   }
@@ -397,7 +397,7 @@ GetExposedOutput( const std::string& name )
   {
     ProcessObject* filter = this->GetFilter( i->second.first );
     if( filter != NULL )
-      return( filter->GetOutput( i->second.second ) );
+      return( filter->GetOutputPort( i->second.second ) );
 
   } // fi
   return( null_port );
@@ -415,7 +415,7 @@ GetExposedOutput( const std::string& name ) const
   {
     const ProcessObject* filter = this->GetFilter( i->second.first );
     if( filter != NULL )
-      return( filter->GetOutput( i->second.second ) );
+      return( filter->GetOutputPort( i->second.second ) );
 
   } // fi
   return( null_port );
index 3fcd0094ff5ef8c4c2f11060fc7499c6708c3b7c..d53c71b38874df6bc808bc3efe63d8314c63d19b 100644 (file)
@@ -30,13 +30,13 @@ _GenerateData( )
   typedef cpPlugins::BoundingBox _TBB;
   _TDO* dobjs[ 5 ];
   
-  auto do0   = dynamic_cast< _TDO* >( this->GetInputData( "Input0" ) );
-  dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input1" ) );
-  dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input2" ) );
-  dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input3" ) );
-  dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input4" ) );
-  dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input5" ) );
-  auto out = dynamic_cast< _TBB* >( this->GetOutputData( "Output" ) );
+  auto do0   = dynamic_cast< _TDO* >( this->GetInput( "Input0" ) );
+  dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInput( "Input1" ) );
+  dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInput( "Input2" ) );
+  dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInput( "Input3" ) );
+  dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInput( "Input4" ) );
+  dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInput( "Input5" ) );
+  auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) );
 
   out->SetDataObject( do0 );
   for( unsigned int d = 0; d < 5; ++d )
index 1855f2e989a01bedd260b9f68dbe2a1d4507744d..c1239b07312d7304e68151f061616b5a9e09fb06 100644 (file)
@@ -26,7 +26,7 @@ cpPluginsIO::ImageWriter::
 void cpPluginsIO::ImageWriter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
   cpPlugins_Image_Demangle_Dim     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Dim( _GD0, image, 3 );
   else this->_Error( "No valid input image dimension" );
index 6eb04da043221761e5ae6314beb28836c102951d..3a40e4277acc32be20c875ee97ad6df1c7efc36c 100644 (file)
@@ -79,7 +79,7 @@ _GD1( )
     stlr->SetFileName( fname.c_str( ) );
     stlr->Update( );
 
-    this->GetOutputData( "Output" )->SetVTK( stlr->GetOutput( ) );
+    this->GetOutput( "Output" )->SetVTK( stlr->GetOutput( ) );
   }
   else if( ext == "obj" )
   {
@@ -87,7 +87,7 @@ _GD1( )
     objr->SetFileName( fname.c_str( ) );
     objr->Update( );
 
-    this->GetOutputData( "Output" )->SetVTK( objr->GetOutput( ) );
+    this->GetOutput( "Output" )->SetVTK( objr->GetOutput( ) );
   }
   else if( ext == "vtk" )
   {
@@ -95,7 +95,7 @@ _GD1( )
     pdr->SetFileName( fname.c_str( ) );
     pdr->Update( );
 
-    this->GetOutputData( "Output" )->SetVTK( pdr->GetOutput( ) );
+    this->GetOutput( "Output" )->SetVTK( pdr->GetOutput( ) );
   }
   else
     this->_Error( "Input file format not recognized." );
index 7cddc75a02b5a683cb00f36c71cb465ff531c16d..e69fc411cc54382bd5a9ff2d4ea8a512e3b2cf36 100644 (file)
@@ -31,7 +31,7 @@ cpPluginsIO::MeshWriter::
 void cpPluginsIO::MeshWriter::
 _GenerateData( )
 {
-  auto mesh = this->GetInputData( "Input" )->GetVTK< vtkPolyData >( );
+  auto mesh = this->GetInputData< vtkPolyData >( "Input" );
   if( mesh == NULL )
     this->_Error( "No suitable input." );
 
index ecb6a37c66c5c298cb5246786c091fdbf0aa60b1..4744f9d40fa6652e44806da0a8b1cb92a31415f0 100644 (file)
@@ -22,7 +22,7 @@ cpPluginsImageFilters::AndImageFilter::
 void cpPluginsImageFilters::AndImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input0" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input0" );
   cpPlugins_Image_Demangle_Pixel_AllInts      ( _GD0, image, 1 );
   else cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 3 );
@@ -42,7 +42,7 @@ _GD0( _TImage* image0 )
   typedef itk::AndImageFilter< _TImage, _TImage > _TFilter;
   if( image0 != NULL )
   {
-    auto image1 = this->GetInputData( "Input1" )->GetITK< _TImage >( );
+    auto image1 = this->GetInputData< _TImage >( "Input1" );
     if( image1 != NULL )
     {
       // Configure filter
@@ -52,7 +52,7 @@ _GD0( _TImage* image0 )
       filter->Update( );
 
       // Connect output
-      this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+      this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
     }
     else
       this->_Error( "No valid second input image." );
index 2d45cd43f2938f53414692fd9288226c8cc69ba0..5d3bcadaa6c8c3bc2f5a371b57e3a454524e3f11 100644 (file)
@@ -34,7 +34,7 @@ cpPluginsImageFilters::BinaryContourImageFilter::
 void cpPluginsImageFilters::BinaryContourImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
   cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
   else this->_Error( "No valid input image." );
@@ -80,7 +80,7 @@ _GD1( _TImage* image )
   filter->Update( );
 
   // Connect output
-  this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
 }
 
 // eof - $RCSfile$
index 9fcbc43a62ac15d8f9b2315336478fb38c8896f8..b14cca9a737e2c79cc8c7c6231ccd2f8fa381dd4 100644 (file)
@@ -32,7 +32,7 @@ cpPluginsImageFilters::BinaryThresholdImageFilter::
 void cpPluginsImageFilters::BinaryThresholdImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
   cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
   else this->_Error( "No valid input image." );
@@ -74,7 +74,7 @@ _GD1( _TImage* image )
   filter->Update( );
 
   // Connect output
-  this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
 }
 
 // eof - $RCSfile$
index 0743b2a6568dc72e67c1d8b630b7b68957daac0f..87f96712baa71968e0a0b0e49dc8c74046419dbe 100644 (file)
@@ -35,7 +35,7 @@ cpPluginsImageFilters::CastImageFilter::
 void cpPluginsImageFilters::CastImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
   cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 1 );
   else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
@@ -87,7 +87,7 @@ _GD1( _TInputImage* image )
   filter->Update( );
 
   // Connect output
-  this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
 }
 
 // eof - $RCSfile$
index f528e8eea64f4ffd4f95936dd9609801bfda7a46..bbdaa987de191fcf0baa67d1efb7dc288a26d200 100644 (file)
@@ -29,7 +29,7 @@ cpPluginsImageFilters::MultiScaleGaussianImageFilter::
 void cpPluginsImageFilters::MultiScaleGaussianImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
   cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
   else this->_Error( "No valid input image." );
@@ -74,7 +74,7 @@ _GD1( _TImage* image )
   filter->Update( );
 
   // Connect output
-  this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
 }
 
 // eof - $RCSfile$
index 5eb50ad924e08d8bd43438bb119ed7bcd29bd583..f45774cce4f99fb2d66280d9ff3ecd9c6e901179 100644 (file)
@@ -22,7 +22,7 @@ cpPluginsImageFilters::OrImageFilter::
 void cpPluginsImageFilters::OrImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input0" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input0" );
   cpPlugins_Image_Demangle_Pixel_AllInts      ( _GD0, image, 1 );
   else cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 3 );
@@ -42,7 +42,7 @@ _GD0( _TImage* image0 )
   typedef itk::OrImageFilter< _TImage, _TImage > _TFilter;
   if( image0 != NULL )
   {
-    auto image1 = this->GetInputData( "Input1" )->GetITK< _TImage >( );
+    auto image1 = this->GetInputData< _TImage >( "Input1" );
     if( image1 != NULL )
     {
       // Configure filter
@@ -52,7 +52,7 @@ _GD0( _TImage* image0 )
       filter->Update( );
 
       // Connect output
-      this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+      this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
     }
     else
       this->_Error( "No valid second input image." );
index 8508189e2371f9ab34187938266dfb7606b92292..ea45ac402933a91d7b34ed3ecee7f507923ca36c 100644 (file)
@@ -26,7 +26,7 @@ cpPluginsImageFilters::ResampleImageFilter::
 void cpPluginsImageFilters::ResampleImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
   cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
   else this->_Error( "No valid input image." );
@@ -67,7 +67,7 @@ _GD1( _TImage* image )
   filter->SetInput( image );
 
   // Connect output
-  this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
 }
 
 // eof - $RCSfile$
index 05b9620d19591d6bcc7ba9bfa0ffcf23799bd6b8..cabe80d103a7aef0486c9b8850c8ae9d5601ebda 100644 (file)
@@ -37,7 +37,7 @@ cpPluginsImageFilters::SignedMaurerDistanceMapImageFilter::
 void cpPluginsImageFilters::SignedMaurerDistanceMapImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
   cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
   else this->_Error( "No valid input image." );
@@ -87,7 +87,7 @@ _GD1( _TImage* image )
   filter->Update( );
 
   // Connect output
-  this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
 }
 
 // eof - $RCSfile$
index 365cf49e72645cb4c06fbff8584a3379001573e3..5dc5826ffcb97922c6a0cc15ec48f53b38ce96b4 100644 (file)
@@ -27,7 +27,7 @@ void cpPluginsImageMeshFilters::MarchingCubes::
 _GenerateData( )
 {
   // Get input
-  auto image = this->GetInputData( "Input" );
+  auto image = this->GetInput( "Input" );
   vtkImageData* vtk_image = image->GetVTK< vtkImageData >( );
   if( vtk_image == NULL )
     this->_Error( "Input does not have a valid VTK conversion." );
@@ -58,7 +58,7 @@ _GenerateData( )
     this->_Error( "Input data does not have a valid dimension." );
 
   // Connect output
-  this->GetOutputData( "Output" )->SetVTK( pd );
+  this->GetOutput( "Output" )->SetVTK( pd );
 }
 
 // eof - $RCSfile$
index 4ee256fc2fc0f5f5eba0a5fff60693f5f0c8d33d..c2442a690047f6d7b6c9fe43bf86e7b6a9682420 100644 (file)
@@ -36,8 +36,8 @@ _GenerateData( )
   typedef itk::Mesh< float, 3 >  _3F;
   typedef itk::Mesh< double, 3 > _3D;
 
-  auto _3f = this->GetInputData( "Input" )->GetITK< _3F >( );
-  auto _3d = this->GetInputData( "Input" )->GetITK< _3D >( );
+  auto _3f = this->GetInputData< _3F >( "Input" );
+  auto _3d = this->GetInputData< _3D >( "Input" );
   if     ( _3f != NULL ) this->_GD0( _3f );
   else if( _3d != NULL ) this->_GD0( _3d );
   else this->_Error( "No valid input mesh." );
@@ -65,7 +65,7 @@ _GD1( _TMesh* mesh )
 
   _TFilter* filter = this->_CreateITK< _TFilter >( );
 
-  auto in_bb = dynamic_cast< _TBB* >( this->GetInputData( "BoundingBox" ) );
+  auto in_bb = dynamic_cast< _TBB* >( this->GetInput( "BoundingBox" ) );
   _TPoint minBB, maxBB;
   if( in_bb == NULL )
   {
@@ -127,8 +127,7 @@ _GD1( _TMesh* mesh )
   filter->Update( );
 
   // Connect output
-  auto out = this->GetOutputData( "Output" );
-  out->SetITK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
 }
 
 // eof - $RCSfile$
index f96327485d37e47896c745a5c6b2d7eb9f2e34e6..b3fd5a6f45c8cdc2c1c36ac8bf5fb135e5ecd2d8 100644 (file)
@@ -27,12 +27,12 @@ cpPluginsMeshFilters::AppendMeshesFilter::
 void cpPluginsMeshFilters::AppendMeshesFilter::
 _GenerateData( )
 {
-  auto m0 = this->GetInputData( "Input0" )->GetVTK< vtkPolyData >( );
-  auto m1 = this->GetInputData( "Input1" )->GetVTK< vtkPolyData >( );
-  auto m2 = this->GetInputData( "Input2" );
-  auto m3 = this->GetInputData( "Input3" );
-  auto m4 = this->GetInputData( "Input4" );
-  auto m5 = this->GetInputData( "Input5" );
+  auto m0 = this->GetInputData< vtkPolyData >( "Input0" );
+  auto m1 = this->GetInputData< vtkPolyData >( "Input1" );
+  auto m2 = this->GetInput( "Input2" );
+  auto m3 = this->GetInput( "Input3" );
+  auto m4 = this->GetInput( "Input4" );
+  auto m5 = this->GetInput( "Input5" );
 
   if( m0 == NULL || m1 == NULL )
     this->_Error( "Invalid inputs." );
@@ -46,7 +46,7 @@ _GenerateData( )
   if( m5 != NULL ) filter->AddInputData( m5->GetVTK< vtkPolyData >( ) );
   filter->Update( );
 
-  this->GetOutputData( "Output" )->SetVTK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetVTK( filter->GetOutput( ) );
 }
 
 // eof - $RCSfile$
index 85ff0597f0a49da302e1b13f674b629d88b95ef2..5f2bd3b305379b1c32b3c1b8bd7dd175fb38847e 100644 (file)
@@ -26,7 +26,7 @@ cpPluginsWidgets::NoInteractiveSeedWidget::
 void cpPluginsWidgets::NoInteractiveSeedWidget::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "ReferenceImage" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "ReferenceImage" );
   cpPlugins_Image_Demangle_Dim     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Dim( _GD0, image, 3 );
   else this->_Error( "No valid input image." );
@@ -57,7 +57,7 @@ _GD0( _TImage* image )
     if( image->TransformPhysicalPointToIndex( seed, idx ) )
       container->Get( ).push_back( idx );
     container->SetReferenceImage( image );
-    this->GetOutputData( "Output" )->SetITK( container );
+    this->GetOutput( "Output" )->SetITK( container );
   }
   else
     this->_Error( "Input image dimension not supported." );
index da3109de3b2fe44f2af5cc143dce1897e29710f6..9e7a408b33d0d559622991c825438cea27bb1fff 100644 (file)
@@ -36,7 +36,7 @@ cpPluginsWidgets::SeedWidget::
 void cpPluginsWidgets::SeedWidget::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "ReferenceImage" )->GetITK< itk::DataObject >( );
+  auto image = this->GetInputData< itk::DataObject >( "ReferenceImage" );
   cpPlugins_Image_Demangle_Dim     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Dim( _GD0, image, 3 );
   else this->_Error( "No valid input image." );
@@ -47,13 +47,15 @@ template< class _TImage >
 void cpPluginsWidgets::SeedWidget::
 _GD0( _TImage* image )
 {
-  typedef
+
+  /*
+    typedef
     cpExtensions::DataStructures::ImageIndexesContainer< _TImage::ImageDimension >
     _TContainer;
-  typedef cpExtensions::Interaction::ImageInteractorStyle _S;
+    typedef cpExtensions::Interaction::ImageInteractorStyle _S;
 
-  if( image != NULL )
-  {
+    if( image != NULL )
+    {
     auto container = this->_CreateITK< _TContainer >( );
     double aux_pnt[ 3 ];
     unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
@@ -62,34 +64,34 @@ _GD0( _TImage* image )
     // MPR
     if( this->m_MPRViewer != NULL )
     {
-      for( unsigned int i = 0; i < 4; ++i )
-      {
-        _S* s =
-          dynamic_cast< _S* >(
-            this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
-            );
-        if( s != NULL )
-        {
-          if( this->m_Configured )
-          {
-            for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
-            {
-              s->GetSeedAsPoint( i, aux_pnt );
-              typename _TImage::PointType seed;
-              for( unsigned int d = 0; d < dim; ++d )
-                seed[ d ] = aux_pnt[ d ];
-              typename _TImage::IndexType idx;
-              if( image->TransformPhysicalPointToIndex( seed, idx ) )
-                container->Get( ).push_back( idx );
-
-            } // rof
-          }
-          else
-            s->SeedWidgetOn( );
-
-        } // fi
-
-      } // rof
+    for( unsigned int i = 0; i < 4; ++i )
+    {
+    _S* s =
+    dynamic_cast< _S* >(
+    this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
+    );
+    if( s != NULL )
+    {
+    if( this->m_Configured )
+    {
+    for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+    {
+    s->GetSeedAsPoint( i, aux_pnt );
+    typename _TImage::PointType seed;
+    for( unsigned int d = 0; d < dim; ++d )
+    seed[ d ] = aux_pnt[ d ];
+    typename _TImage::IndexType idx;
+    if( image->TransformPhysicalPointToIndex( seed, idx ) )
+    container->Get( ).push_back( idx );
+
+    } // rof
+    }
+    else
+    s->SeedWidgetOn( );
+
+    } // fi
+
+    } // rof
 
     } // fi
 
@@ -97,30 +99,31 @@ _GD0( _TImage* image )
     _S* s = dynamic_cast< _S* >( this->m_SingleInteractor );
     if( s != NULL )
     {
-      if( this->m_Configured )
-      {
-        for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
-        {
-          s->GetSeedAsPoint( i, aux_pnt );
-          typename _TImage::PointType seed;
-          for( unsigned int d = 0; d < dim; ++d )
-            seed[ d ] = aux_pnt[ d ];
-          typename _TImage::IndexType idx;
-          if( image->TransformPhysicalPointToIndex( seed, idx ) )
-            container->Get( ).push_back( idx );
-
-        } // rof
-      }
-      else
-        s->SeedWidgetOn( );
+    if( this->m_Configured )
+    {
+    for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+    {
+    s->GetSeedAsPoint( i, aux_pnt );
+    typename _TImage::PointType seed;
+    for( unsigned int d = 0; d < dim; ++d )
+    seed[ d ] = aux_pnt[ d ];
+    typename _TImage::IndexType idx;
+    if( image->TransformPhysicalPointToIndex( seed, idx ) )
+    container->Get( ).push_back( idx );
+
+    } // rof
+    }
+    else
+    s->SeedWidgetOn( );
 
     } // fi
     this->m_Configured = true;
     container->SetReferenceImage( image );
     this->GetOutputData( "Output" )->SetITK( container );
-  }
-  else
+    }
+    else
     this->_Error( "Input image dimension not supported." );
+  */
 }
 
 // eof - $RCSfile$