]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Wed, 30 Nov 2016 02:50:01 +0000 (21:50 -0500)
committerLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Wed, 30 Nov 2016 02:50:01 +0000 (21:50 -0500)
appli/PipelineEditor/PipelineEditor.cxx
lib/cpBaseQtApplication/MainWindow.cxx
plugins/ITKDistanceMapFilters/SignedMaurerDistanceMapImageFilter.cxx

index f49c2a43ad05d1f542d7da7e357c017944687740..fec6efdeee90f9f1076b48cb46f8a5543af97de7 100644 (file)
@@ -48,94 +48,92 @@ PipelineEditor::
 void PipelineEditor::
 _slotView( const std::string& name, bool show )
 {
-  /* TODO
-     typedef cpExtensions::QT::ActorsWidgetInterface _TViewer;
+  typedef cpExtensions::QT::ActorsWidgetInterface _TViewer;
 
-     // Get filter parameters
-     std::vector< std::string > tokens;
-     cpPlugins::Tokenize( tokens, name, "@" );
-     if( tokens.size( ) != 2 )
-     return;
-     auto filter_name = tokens[ 1 ];
-     auto output_name = tokens[ 0 ];
+  // Get filter parameters
+  std::vector< std::string > tokens;
+  cpPlugins::Tokenize( tokens, name, "@" );
+  if( tokens.size( ) != 2 )
+    return;
+  auto filter_name = tokens[ 1 ];
+  auto output_name = tokens[ 0 ];
 
-     // Process data
-     if( show )
-     {
-     try
-     {
-     auto ws = this->workspace( this->m_ActiveWS );
-     auto filter = ws->GetFilter( filter_name );
-     cpBaseQtApplication_Execute( filter->Update( ) );
-     auto image = filter->GetOutputData< vtkImageData >( output_name );
-     auto mesh = filter->GetOutputData< vtkPolyData >( output_name );
-     _TViewer* viewer = NULL;
-     if( image != NULL )
-     {
-     int dim = image->GetDataDimension( );
-     if( dim == 2 )
-     viewer =
-     this->_configureViewer< cpExtensions::QT::ImageWidget >(
-     this->m_UI->Viewer
-     );
-     else if( dim == 3 )
-     viewer =
-     this->_configureViewer< cpExtensions::QT::SimpleMPRWidget >(
-     this->m_UI->Viewer
-     );
-     }
-     else if( mesh != NULL )
-     {
-     viewer =
-     this->_configureViewer< cpExtensions::QT::SimpleMPRWidget >(
-     this->m_UI->Viewer
-     );
+  // Process data
+  if( show )
+  {
+    try
+    {
+      auto ws = this->workspace( );
+      auto filter = ws->GetFilter( filter_name );
+      cpBaseQtApplication_Execute( filter->Update( ) );
+      auto image = filter->GetOutputData< vtkImageData >( output_name );
+      auto mesh = filter->GetOutputData< vtkPolyData >( output_name );
+      _TViewer* viewer = NULL;
+      if( image != NULL )
+      {
+        int dim = image->GetDataDimension( );
+        if( dim == 2 )
+          viewer =
+            this->_configureViewer< cpExtensions::QT::ImageWidget >(
+              this->m_UI->Viewer
+              );
+        else if( dim == 3 )
+          viewer =
+            this->_configureViewer< cpExtensions::QT::SimpleMPRWidget >(
+              this->m_UI->Viewer
+              );
+      }
+      else if( mesh != NULL )
+      {
+        viewer =
+          this->_configureViewer< cpExtensions::QT::SimpleMPRWidget >(
+            this->m_UI->Viewer
+            );
 
-     } // fi
-     if(
-     dynamic_cast< QWidget* >( viewer ) !=
-     dynamic_cast< QWidget* >( this->m_UI->Viewer )
-     )
-     {
-     delete this->m_UI->Viewer;
-     this->m_UI->Viewer = dynamic_cast< QWidget* >( viewer );
-     this->m_UI->MainSplitter->insertWidget( 0, this->m_UI->Viewer );
-     this->setViewer( viewer );
+      } // fi
+      if(
+        dynamic_cast< QWidget* >( viewer ) !=
+        dynamic_cast< QWidget* >( this->m_UI->Viewer )
+        )
+      {
+        delete this->m_UI->Viewer;
+        this->m_UI->Viewer = dynamic_cast< QWidget* >( viewer );
+        this->m_UI->MainSplitter->insertWidget( 0, this->m_UI->Viewer );
+        this->setViewer( viewer );
 
-     } // fi
-     if( image != NULL )
-     {
-     this->m_Blocker.block( );
-     auto mpr = dynamic_cast< cpExtensions::QT::SimpleMPRWidget* >( viewer );
-     auto imv = dynamic_cast< cpExtensions::QT::ImageWidget* >( viewer );
-     if( mpr != NULL )
-     mpr->SetImage( image, name );
-     else if( imv != NULL )
-     imv->SetImage( image, name );
-     this->m_Blocker.unblock( );
-     }
-     else if( mesh != NULL )
-     {
-     this->m_Blocker.block( );
-     auto mpr = dynamic_cast< cpExtensions::QT::SimpleMPRWidget* >( viewer );
-     if( mpr != NULL )
-     mpr->Add( mesh, name );
-     this->m_Blocker.unblock( );
+      } // fi
+      if( image != NULL )
+      {
+        this->m_Blocker.block( );
+        auto mpr = dynamic_cast< cpExtensions::QT::SimpleMPRWidget* >( viewer );
+        auto imv = dynamic_cast< cpExtensions::QT::ImageWidget* >( viewer );
+        if( mpr != NULL )
+          mpr->SetImage( image, name );
+        else if( imv != NULL )
+          imv->SetImage( image, name );
+        this->m_Blocker.unblock( );
+      }
+      else if( mesh != NULL )
+      {
+        this->m_Blocker.block( );
+        auto mpr = dynamic_cast< cpExtensions::QT::SimpleMPRWidget* >( viewer );
+        if( mpr != NULL )
+          mpr->Add( mesh, name );
+        this->m_Blocker.unblock( );
 
-     } // fi
-     }
-     catch( std::exception& err )
-     {
-     QMessageBox::critical(
-     NULL,
-     QMessageBox::tr( "Error showing data" ),
-     QMessageBox::tr( err.what( ) )
-     );
+      } // fi
+    }
+    catch( std::exception& err )
+    {
+      QMessageBox::critical(
+        NULL,
+        QMessageBox::tr( "Error showing data" ),
+        QMessageBox::tr( err.what( ) )
+        );
 
-     } // yrt
+    } // yrt
 
-     } // fi
-  */
+  } // fi
 }
 
 // -------------------------------------------------------------------------
index ac8858ed934da7028651f2cb0b9d7e29261a13fa..1bdca767b08be6428f5c5336d663c35d78a176d9 100644 (file)
@@ -79,6 +79,9 @@ void cpBaseQtApplication::MainWindow::
 setCanvas( cpBaseQtApplication::Pipeline::Canvas* c )
 {
   this->m_Canvas = c;
+  if( this->m_Canvas != NULL )
+    this->m_Canvas->setWorkspace( this->m_Workspace );
+
 }
 
 // -------------------------------------------------------------------------
index 5f5cc64827f14cf5925724aa452cc8b84cf0a20b..e62f1df171c70def845edad9cc433a3163a3274a 100644 (file)
@@ -35,7 +35,6 @@ void cpPluginsITKDistanceMapFilters::SignedMaurerDistanceMapImageFilter::
 _GenerateData( )
 {
   auto o = this->GetInputData( "Input" );
-  std::cout << o << std::endl;
   cpPlugins_Demangle_Image_ScalarPixels_VisualDims_1( o, _GD0 )
     this->_Error( "Invalid input image dimension." );
 }
@@ -60,7 +59,6 @@ _GD1( _TImage* image )
   typedef
     itk::SignedMaurerDistanceMapImageFilter< _TImage, _TDMap >
     _TFilter;
-  std::cout << "_Z" << typeid( _TFilter ).name( ) << std::endl;
 
   // Get parameters
   double bv = this->m_Parameters.GetReal( "BackgroundValue" );