]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Mon, 21 Nov 2016 23:01:38 +0000 (18:01 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Mon, 21 Nov 2016 23:01:38 +0000 (18:01 -0500)
appli/PipelineEditor/PipelineEditor.cxx
lib/cpInstances/CMakeLists.txt
lib/cpInstances/DistanceMapFilters.i
lib/cpInstances/ImageInterpolators.i [new file with mode: 0644]
plugins/CMakeLists.txt

index edac828cd0a5c0e0860eedf82e9e6e3b40a85025..a83a797febcdae4883e7d8ae6ce06eeeb4c031e0 100644 (file)
@@ -1,13 +1,15 @@
 #include <PipelineEditor.h>
 #include <ui_PipelineEditor.h>
 
-#include <cpPlugins/Utility.h>
-#include <cpExtensions/QT/SimpleMPRWidget.h>
-#include <cpExtensions/QT/ImageWidget.h>
-#include <cpExtensions/QT/ConfigurationChooser.h>
-#include <cpExtensions/QT/ActorsWidgetInterface.h>
-#include <vtkImageData.h>
-#include <vtkPolyData.h>
+/* TODO
+   #include <cpPlugins/Utility.h>
+   #include <cpExtensions/QT/SimpleMPRWidget.h>
+   #include <cpExtensions/QT/ImageWidget.h>
+   #include <cpExtensions/QT/ConfigurationChooser.h>
+   #include <cpExtensions/QT/ActorsWidgetInterface.h>
+   #include <vtkImageData.h>
+   #include <vtkPolyData.h>
+*/
 
 // -------------------------------------------------------------------------
 PipelineEditor::
@@ -16,37 +18,17 @@ PipelineEditor( int argc, char* argv[], QWidget* parent )
     m_UI( new Ui::PipelineEditor ),
     m_ActiveWS( "ws" )
 {
+  // Basic configuration
   this->m_UI->setupUi( this );
+  this->setCanvas( this->m_UI->Canvas );
+  this->setNavigator( this->m_UI->Navigator );
   this->m_UI->Navigator->Update( );
 
-  cpBaseQtApplication_ConnectAction(
-    actionLoadDirectory, _loadPluginsFromPath
-    );
-  cpBaseQtApplication_ConnectAction(
-    actionLoadLibrary, _loadPlugins
-    );
-
-  this->connect(
-    this->m_UI->actionOpenWorkspace, SIGNAL( triggered( ) ),
-    this, SLOT( _slotOpenWorkspace( ) )
-    );
-  this->connect(
-    this->m_UI->actionSaveWorkspace, SIGNAL( triggered( ) ),
-    this, SLOT( _slotSaveWorkspace( ) )
-    );
-  this->connect(
-    this->m_UI->actionSaveWorkspaceAs, SIGNAL( triggered( ) ),
-    this, SLOT( _slotSaveWorkspaceAs( ) )
-    );
-  this->connect(
-    this->m_UI->actionActorsProperties, SIGNAL( triggered( ) ),
-    this, SLOT( _slotActorsProperties( ) )
-    );
-  this->m_UI->Canvas->connectOutputPortSlot(
-    this, SLOT( _slotView( const std::string&, bool ) )
-    );
+  // Connect slots <-> signals
+  cpBaseQtApplication_ConnectAction( actionLoadDirectory, _loadPluginsFromPath );
+  cpBaseQtApplication_ConnectAction( actionLoadLibrary, _loadPlugins );
 
-  // Load command-line given workspace
+  // Load command-line given workspace (if any)
   if( argc > 1 )
   {
     this->_loadWorkspace( argv[ 1 ] );
@@ -54,16 +36,40 @@ PipelineEditor( int argc, char* argv[], QWidget* parent )
   }
   else
     this->_addWorkspace( this->m_ActiveWS );
-  this->m_UI->Canvas->setWorkspace( this->workspace( this->m_ActiveWS ) );
-  this->setWindowTitle(
-    (
-      std::string( "PipelineEditor - " ) +
-      this->m_ActiveWS
-      ).c_str( )
-    );
+  /* TODO
+     this->m_UI->Canvas->setWorkspace( this->workspace( this->m_ActiveWS ) );
+     this->setWindowTitle(
+     (
+     std::string( "PipelineEditor - " ) +
+     this->m_ActiveWS
+     ).c_str( )
+     );
+  */
 
-  this->setCanvas( this->m_UI->Canvas );
-  this->setNavigator( this->m_UI->Navigator );
+  /* TODO
+     this->connect(
+     this->m_UI->actionOpenWorkspace, SIGNAL( triggered( ) ),
+     this, SLOT( _slotOpenWorkspace( ) )
+     );
+     this->connect(
+     this->m_UI->actionSaveWorkspace, SIGNAL( triggered( ) ),
+     this, SLOT( _slotSaveWorkspace( ) )
+     );
+     this->connect(
+     this->m_UI->actionSaveWorkspaceAs, SIGNAL( triggered( ) ),
+     this, SLOT( _slotSaveWorkspaceAs( ) )
+     );
+     this->connect(
+     this->m_UI->actionActorsProperties, SIGNAL( triggered( ) ),
+     this, SLOT( _slotActorsProperties( ) )
+     );
+     this->m_UI->Canvas->connectOutputPortSlot(
+     this, SLOT( _slotView( const std::string&, bool ) )
+     );
+  */
+
+
+  // Associate qt-based objects
 }
 
 // -------------------------------------------------------------------------
@@ -78,190 +84,205 @@ template< class _TWidget >
 std::pair< _TWidget*, bool > PipelineEditor::
 _configureViewer( )
 {
-  auto new_viewer = dynamic_cast< _TWidget* >( this->m_UI->Viewer );
-  bool ok = false;
-  if( new_viewer == NULL )
-  {
-    new_viewer = new _TWidget( );
-    delete this->m_UI->Viewer;
-    this->m_UI->Viewer = new_viewer;
-    ok = true;
+  /* TODO
+     auto new_viewer = dynamic_cast< _TWidget* >( this->m_UI->Viewer );
+     bool ok = false;
+     if( new_viewer == NULL )
+     {
+     new_viewer = new _TWidget( );
+     delete this->m_UI->Viewer;
+     this->m_UI->Viewer = new_viewer;
+     ok = true;
 
-    auto interactors = new_viewer->GetInteractors( );
-    for( auto w : this->m_Workspaces )
-      for( auto i : interactors )
-        w.second->AddInteractor( i );
+     auto interactors = new_viewer->GetInteractors( );
+     for( auto w : this->m_Workspaces )
+     for( auto i : interactors )
+     w.second->AddInteractor( i );
 
-  } // fi
-  this->m_UI->MainSplitter->insertWidget( 0, this->m_UI->Viewer );
-  return( std::pair< _TWidget*, bool >( new_viewer, ok ) );
+     } // fi
+     this->m_UI->MainSplitter->insertWidget( 0, this->m_UI->Viewer );
+     return( std::pair< _TWidget*, bool >( new_viewer, ok ) );
+  */
+  return( std::pair< _TWidget*, bool >( NULL, false ) );
 }
 
 // -------------------------------------------------------------------------
 void PipelineEditor::
 _addWorkspace( const std::string& name )
 {
-  typedef cpExtensions::QT::ActorsWidgetInterface _TInterface;
+  /* TODO
+     typedef cpExtensions::QT::ActorsWidgetInterface _TInterface;
 
-  this->Superclass::_addWorkspace( name );
-  auto ws = this->m_Workspaces.find( name );
-  if( ws != this->m_Workspaces.end( ) )
-  {
-    ws->second->PrintExecutionOn( );
-    auto wdg = dynamic_cast< _TInterface* >( this->m_UI->Viewer );
-    if( wdg == NULL )
-      return;
-    auto interactors = wdg->GetInteractors( );
-    for( auto i : interactors )
-      ws->second->AddInteractor( i );
+     this->Superclass::_addWorkspace( name );
+     auto ws = this->m_Workspaces.find( name );
+     if( ws != this->m_Workspaces.end( ) )
+     {
+     ws->second->PrintExecutionOn( );
+     auto wdg = dynamic_cast< _TInterface* >( this->m_UI->Viewer );
+     if( wdg == NULL )
+     return;
+     auto interactors = wdg->GetInteractors( );
+     for( auto i : interactors )
+     ws->second->AddInteractor( i );
 
-  } // fi
+     } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
 void PipelineEditor::
 _slotOpenWorkspace( )
 {
-  this->m_LastSaveFileName = "";
-  this->_loadWorkspace( );
-  if( this->m_Workspaces.size( ) == 2 )
-  {
-    auto wIt = this->m_Workspaces.find( this->m_ActiveWS );
-    this->m_Workspaces.erase( wIt );
-    this->m_ActiveWS = this->m_Workspaces.begin( )->first;
-  }
-  else if( this->m_Workspaces.size( ) == 1 )
-  {
-    this->m_ActiveWS = this->m_Workspaces.begin( )->first;
-  }
-  else
-  {
-    this->m_ActiveWS = "ws";
-    this->_addWorkspace( this->m_ActiveWS );
+  /* TODO
+     this->m_LastSaveFileName = "";
+     this->_loadWorkspace( );
+     if( this->m_Workspaces.size( ) == 2 )
+     {
+     auto wIt = this->m_Workspaces.find( this->m_ActiveWS );
+     this->m_Workspaces.erase( wIt );
+     this->m_ActiveWS = this->m_Workspaces.begin( )->first;
+     }
+     else if( this->m_Workspaces.size( ) == 1 )
+     {
+     this->m_ActiveWS = this->m_Workspaces.begin( )->first;
+     }
+     else
+     {
+     this->m_ActiveWS = "ws";
+     this->_addWorkspace( this->m_ActiveWS );
 
-  } // fi
-  this->m_UI->Canvas->setWorkspace( this->workspace( this->m_ActiveWS ) );
-  this->setWindowTitle(
-    (
-      std::string( "PipelineEditor - " ) +
-      this->m_ActiveWS
-      ).c_str( )
-    );
+     } // fi
+     this->m_UI->Canvas->setWorkspace( this->workspace( this->m_ActiveWS ) );
+     this->setWindowTitle(
+     (
+     std::string( "PipelineEditor - " ) +
+     this->m_ActiveWS
+     ).c_str( )
+     );
+  */
 }
 
 // -------------------------------------------------------------------------
 void PipelineEditor::
 _slotSaveWorkspace( )
 {
-  this->_saveWorkspace( this->m_ActiveWS, false );
-  this->setWindowTitle(
-    (
-      std::string( "PipelineEditor - " ) +
-      this->m_LastSaveFileName
-      ).c_str( )
-    );
+  /* TODO
+     this->_saveWorkspace( this->m_ActiveWS, false );
+     this->setWindowTitle(
+     (
+     std::string( "PipelineEditor - " ) +
+     this->m_LastSaveFileName
+     ).c_str( )
+     );
+  */
 }
 
 // -------------------------------------------------------------------------
 void PipelineEditor::
 _slotSaveWorkspaceAs( )
 {
-  this->_saveWorkspace( this->m_ActiveWS, true );
-  this->setWindowTitle(
-    (
-      std::string( "PipelineEditor - " ) +
-      this->m_LastSaveFileName
-      ).c_str( )
-    );
+  /* TODO
+     this->_saveWorkspace( this->m_ActiveWS, true );
+     this->setWindowTitle(
+     (
+     std::string( "PipelineEditor - " ) +
+     this->m_LastSaveFileName
+     ).c_str( )
+     );
+  */
 }
 
 // -------------------------------------------------------------------------
 void PipelineEditor::
 _slotView( const std::string& name, bool show )
 {
-  std::vector< std::string > tokens;
-  cpPlugins::Tokenize( tokens, name, "@" );
-  if( tokens.size( ) != 2 )
-    return;
-  try
-  {
-    auto ws = this->workspace( this->m_ActiveWS );
-    auto filter = ws->GetFilter( tokens[ 1 ] );
-    if( filter != NULL )
-    {
-      cpBaseQtApplication_Execute( filter->Update( ) );
-      auto image = filter->GetOutputData< vtkImageData >( tokens[ 0 ] );
-      auto mesh = filter->GetOutputData< vtkPolyData >( tokens[ 0 ] );
-      if( image != NULL )
-      {
-        int dim = image->GetDataDimension( );
-        if( dim == 2 )
-        {
-          auto viewer =
-            this->_configureViewer< cpExtensions::QT::ImageWidget >( );
-          this->m_Blocker.block( );
-          viewer.first->SetImage( image, 2, name );
-          viewer.first->ResetCamera( );
-          viewer.first->Render( );
-          this->m_Blocker.unblock( );
-        }
-        else if( dim == 3 )
-        {
-          auto viewer =
-            this->_configureViewer< cpExtensions::QT::SimpleMPRWidget >( );
-          this->m_Blocker.block( );
-          viewer.first->SetImage( image, name );
-          viewer.first->ResetCameras( );
-          viewer.first->Render( );
-          this->m_Blocker.unblock( );
+  /* TODO
+     std::vector< std::string > tokens;
+     cpPlugins::Tokenize( tokens, name, "@" );
+     if( tokens.size( ) != 2 )
+     return;
+     try
+     {
+     auto ws = this->workspace( this->m_ActiveWS );
+     auto filter = ws->GetFilter( tokens[ 1 ] );
+     if( filter != NULL )
+     {
+     cpBaseQtApplication_Execute( filter->Update( ) );
+     auto image = filter->GetOutputData< vtkImageData >( tokens[ 0 ] );
+     auto mesh = filter->GetOutputData< vtkPolyData >( tokens[ 0 ] );
+     if( image != NULL )
+     {
+     int dim = image->GetDataDimension( );
+     if( dim == 2 )
+     {
+     auto viewer =
+     this->_configureViewer< cpExtensions::QT::ImageWidget >( );
+     this->m_Blocker.block( );
+     viewer.first->SetImage( image, 2, name );
+     viewer.first->ResetCamera( );
+     viewer.first->Render( );
+     this->m_Blocker.unblock( );
+     }
+     else if( dim == 3 )
+     {
+     auto viewer =
+     this->_configureViewer< cpExtensions::QT::SimpleMPRWidget >( );
+     this->m_Blocker.block( );
+     viewer.first->SetImage( image, name );
+     viewer.first->ResetCameras( );
+     viewer.first->Render( );
+     this->m_Blocker.unblock( );
 
-        } // fi
-      }
-      else if( mesh != NULL )
-      {
-        auto viewer =
-          dynamic_cast< cpExtensions::QT::SimpleMPRWidget* >(
-            this->m_UI->Viewer
-            );
-        if( viewer != NULL )
-        {
-          this->m_Blocker.block( );
-          viewer->Add( mesh, name );
-          viewer->Render( );
-          this->m_Blocker.unblock( );
+     } // fi
+     }
+     else if( mesh != NULL )
+     {
+     auto viewer =
+     dynamic_cast< cpExtensions::QT::SimpleMPRWidget* >(
+     this->m_UI->Viewer
+     );
+     if( viewer != NULL )
+     {
+     this->m_Blocker.block( );
+     viewer->Add( mesh, name );
+     viewer->Render( );
+     this->m_Blocker.unblock( );
 
-        } // fi
+     } // fi
 
-      } // fi
+     } // fi
 
-    } // 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
+  */
 }
 
 // -------------------------------------------------------------------------
 void PipelineEditor::
 _slotActorsProperties( )
 {
-  auto data =
-    dynamic_cast< cpExtensions::QT::ActorsWidgetInterface* >(
-      this->m_UI->Viewer
-      );
-  if( data != NULL )
-  {
-    auto dlg = new cpExtensions::QT::ConfigurationChooser( this );
-    dlg->setData( data );
-    dlg->exec( );
+  /* TODO
+     auto data =
+     dynamic_cast< cpExtensions::QT::ActorsWidgetInterface* >(
+     this->m_UI->Viewer
+     );
+     if( data != NULL )
+     {
+     auto dlg = new cpExtensions::QT::ConfigurationChooser( this );
+     dlg->setData( data );
+     dlg->exec( );
 
-  } // fi
+     } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
index 4f27cc490d3bf4b77a9b0382bc34b24953767ed7..eac073aa8eb411da12cb07163f9920cd1b0f6653 100644 (file)
@@ -12,6 +12,7 @@ SET(
   MatrixImages
   Image
   ImageIterators
+  ImageInterpolators
   NeighborhoodImageIterators
   BaseImageFilters
   ComplexImageFilters
@@ -47,7 +48,7 @@ ENDFOREACH(_d)
 ## =====================
 
 SET(_pfx cpInstances)
-TARGET_LINK_LIBRARIES(${_pfx}BoundingBox ${_pfx}BaseObjects)
+TARGET_LINK_LIBRARIES(${_pfx}BoundingBox ${_pfx}BaseObjects cpPlugins)
 TARGET_LINK_LIBRARIES(${_pfx}Transforms ${_pfx}BaseObjects)
 TARGET_LINK_LIBRARIES(${_pfx}Mesh ${_pfx}BoundingBox)
 TARGET_LINK_LIBRARIES(${_pfx}ScalarImages ${_pfx}BaseObjects)
@@ -65,6 +66,7 @@ TARGET_LINK_LIBRARIES(
   cpPlugins
   )
 TARGET_LINK_LIBRARIES(${_pfx}ImageIterators ${_pfx}Image)
+TARGET_LINK_LIBRARIES(${_pfx}ImageInterpolators ${_pfx}Image)
 TARGET_LINK_LIBRARIES(${_pfx}NeighborhoodImageIterators ${_pfx}Image)
 TARGET_LINK_LIBRARIES(${_pfx}BaseImageFilters ${_pfx}ImageIterators)
 TARGET_LINK_LIBRARIES(${_pfx}ComplexImageFilters ${_pfx}ImageIterators)
@@ -104,6 +106,7 @@ TARGET_LINK_LIBRARIES(
   )
 TARGET_LINK_LIBRARIES(
   ${_pfx}Simple3DCurve
+  cpExtensions
   cpPlugins
   )
 TARGET_LINK_LIBRARIES(
@@ -115,6 +118,7 @@ TARGET_LINK_LIBRARIES(
   ${_pfx}Image
   ${_pfx}ImageIterators
   ${_pfx}NeighborhoodImageIterators
+  ${_pfx}ImageInterpolators
   ${_pfx}BaseImageFilters
   ${_pfx}ComplexImageFilters
   ${_pfx}ExtractImageFilters
index ea1236fc45ed59e6809acc76f7f2c9e666417442..415549c698b06498a776679cb2df63abf8ca02ca 100644 (file)
@@ -1,11 +1,15 @@
 header #define ITK_MANUAL_INSTANTIATION
 
-define filters=BinaryContourImageFilter;SignedMaurerDistanceMapImageFilter
+define i_scalars=#scalar_pixels#
+define o_scalars=#scalar_pixels#
+define filters=SignedMaurerDistanceMapImageFilter
 
 tinclude itkProgressReporter:h|h
 tinclude itkImageRegionIterator:h|h
+tinclude itkBinaryContourImageFilter:h|hxx
 tinclude itk#filters#:h|hxx
 
+instances itk::BinaryContourImageFilter< itk::Image< #i_scalars#, #visual_dims# >, itk::Image< #o_scalars#, #visual_dims# > >
 instances itk::#filters#< itk::Image< #scalar_pixels#, #visual_dims# >, itk::Image< #real_types#, #visual_dims# > >
 
 ** eof - $RCSfile$
diff --git a/lib/cpInstances/ImageInterpolators.i b/lib/cpInstances/ImageInterpolators.i
new file mode 100644 (file)
index 0000000..c9214b4
--- /dev/null
@@ -0,0 +1,17 @@
+header #define ITK_MANUAL_INSTANTIATION
+
+define i_real=#real_types#
+define o_real=#real_types#
+define interp=Linear
+
+tinclude itkImageFunction:h|hxx
+tinclude itk#interp#InterpolateImageFunction:h|hxx
+
+NearestNeighbor
+
+cinclude itkImage.h
+
+instances itk::ImageFunction< itk::Image< #scalar_pixels#, #process_dims# >, #i_real#, #o_real# >
+instances itk::#interp#InterpolateImageFunction< itk::Image< #scalar_pixels#, #process_dims# >, #real_types# >
+
+** eof - $RCSfile$
index b1290e789c0b409dfdabf53ee386e7a0a703d69c..feabf0ecfa7e39e48f7a39e78bbaebc3a16abedf 100644 (file)
@@ -12,6 +12,7 @@ SET(
   ITKUnaryFunctorFilters
   ITKBinaryFunctorFilters
   ITKDistanceMapFilters
+  ITKSliceFilters
   ITKSeparableFilters
   ITKGenericFilters
   ImageParaMorphologyFilters