]> Creatis software - cpPlugins.git/commitdiff
Tree data updated.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 27 Oct 2015 22:55:10 +0000 (17:55 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 27 Oct 2015 22:55:10 +0000 (17:55 -0500)
27 files changed:
appli/ImageMPR/ImageMPR.cxx
appli/ImageMPR/ImageMPR.h
appli/ImageMPR/ImageMPR.ui
appli/examples/CMakeLists.txt
appli/examples/example_TestQuadSplitter.cxx [deleted file]
lib/cpExtensions/Interaction/BaseInteractorStyle.cxx
lib/cpExtensions/Interaction/BaseInteractorStyle.h
lib/cpExtensions/Interaction/ImageInteractorStyle.h
lib/cpExtensions/QT/QuadSplitter.cxx [deleted file]
lib/cpExtensions/QT/QuadSplitter.h [deleted file]
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpExtensions/Visualization/ImageSliceActors.h
lib/cpExtensions/Visualization/MPRActors.cxx
lib/cpExtensions/Visualization/MPRActors.h
lib/cpExtensions/Visualization/MPRObjects.cxx
lib/cpExtensions/Visualization/MPRObjects.h
lib/cpPlugins/Interface/BaseMPRWidget.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/BaseMPRWidget.h [new file with mode: 0644]
lib/cpPlugins/Interface/BaseMPRWidget.ui [new file with mode: 0644]
lib/cpPlugins/Interface/BaseMPRWindow.cxx [deleted file]
lib/cpPlugins/Interface/BaseMPRWindow.h [deleted file]
lib/cpPlugins/Interface/CMakeLists.txt
lib/cpPlugins/Interface/Mesh.cxx
lib/cpPlugins/Interface/Mesh.h
lib/cpPlugins/Interface/Plugins.cxx
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h

index a83a5d6b7898c3651f289ccd03eaa3aeb98ec877..47c3622e4e7430af2663940ea6a32de22d1e7de2 100644 (file)
@@ -15,8 +15,7 @@ ImageMPR::
 ImageMPR( QWidget* parent )
   : QMainWindow( parent ),
     m_UI( new Ui::ImageMPR ),
-    m_Plugins( new TPlugins ),
-    m_MainImage( NULL )
+    m_Plugins( new TPlugins )
 {
   this->m_UI->setupUi( this );
   this->m_Plugins->SetWidget( this );
@@ -53,11 +52,19 @@ ImageMPR::
 void ImageMPR::
 _aOpenImage( )
 {
-  if( this->m_MainImage.IsNotNull( ) )
+  // Clear all, since we are loading the main image
+  if( this->m_Objects.size( ) > 0 )
+  {
     this->m_UI->MPR->ClearAll( );
-  if( this->m_Plugins->ReadImage( this->m_MainImage, true ) )
+    this->m_Objects.clear( );
+
+  } // fi
+
+  // Read and show image, if possible
+  TPlugins::TImage::Pointer image;
+  if( this->m_Plugins->ReadImage( image, true ) )
   {
-    vtkImageData* vimage = this->m_MainImage->GetVTK< vtkImageData >( );
+    vtkImageData* vimage = image->GetVTK< vtkImageData >( );
     if( vimage == NULL )
       QMessageBox::critical(
         this,
@@ -67,7 +74,11 @@ _aOpenImage( )
           )
         );
     else
-      this->m_UI->MPR->ShowImage( vimage );
+      this->m_UI->MPR->ShowImage( vimage, image->GetName( ) );
+
+    // Keep a track on a local data tree
+    this->m_Objects[ image->GetName( ) ] =
+      TTreeNode( "", image.GetPointer( ) );
 
   } // fi
 }
@@ -76,11 +87,19 @@ _aOpenImage( )
 void ImageMPR::
 _aOpenDICOMSeries( )
 {
-  if( this->m_MainImage.IsNotNull( ) )
+  // Clear all, since we are loading the main image
+  if( this->m_Objects.size( ) > 0 )
+  {
     this->m_UI->MPR->ClearAll( );
-  if( this->m_Plugins->ReadDicomSeries( this->m_MainImage ) )
+    this->m_Objects.clear( );
+
+  } // fi
+
+  // Read and show image, if possible
+  TPlugins::TImage::Pointer image;
+  if( this->m_Plugins->ReadDicomSeries( image ) )
   {
-    vtkImageData* vimage = this->m_MainImage->GetVTK< vtkImageData >( );
+    vtkImageData* vimage = image->GetVTK< vtkImageData >( );
     if( vimage == NULL )
       QMessageBox::critical(
         this,
@@ -90,7 +109,11 @@ _aOpenDICOMSeries( )
           )
         );
     else
-      this->m_UI->MPR->ShowImage( vimage );
+      this->m_UI->MPR->ShowImage( vimage, image->GetName( ) );
+
+    // Keep a track on a local data tree
+    this->m_Objects[ image->GetName( ) ] =
+      TTreeNode( "", image.GetPointer( ) );
 
   } // fi
 }
@@ -115,8 +138,10 @@ _aOpenPolyData( )
 void ImageMPR::
 _aSaveImage( )
 {
-  if( this->m_MainImage.IsNotNull( ) )
+  /*
+    if( this->m_MainImage.IsNotNull( ) )
     this->m_Plugins->WriteImage( this->m_MainImage, true );
+  */
 }
 
 // -------------------------------------------------------------------------
@@ -163,6 +188,13 @@ _aShowPlugins( )
 void ImageMPR::
 _execPlugin( )
 {
+  /*
+  typedef std::map< std::string, TPlugins::TImage::Pointer > _TImages;
+  typedef std::map< std::string, TPlugins::TMesh::Pointer >  _TMeshes;
+
+  // Get selected data
+  // std::string data_name = this->m_UI->MPR->GetSelectedData( );
+
   // Get filter name
   QAction* action = dynamic_cast< QAction* >( this->sender( ) );
   if( action == NULL )
@@ -170,40 +202,124 @@ _execPlugin( )
   QMenu* menu = dynamic_cast< QMenu* >( action->parentWidget( ) );
   if( menu == NULL )
     return;
-  std::string cate = menu->title( ).toStdString( );
-  std::string name = action->text( ).toStdString( );
-  std::string err = "";
+  std::string filter_cate = menu->title( ).toStdString( );
+  std::string filter_name = action->text( ).toStdString( );
 
+  // Create filter
   TPlugins::TProcessObject::Pointer filter;
-  if( this->m_Plugins->CreateFilter( filter, name ) )
+  if( !( this->m_Plugins->CreateFilter( filter, filter_name ) ) )
+  {
+    QMessageBox::critical(
+      this,
+      tr( "Error creating filter" ),
+      tr( (
+            std::string( "No valid filter \"" ) +
+            filter_name +
+            std::string( "\"defined." )
+            ).c_str( ) )
+      );
+    return;
+
+  } // fi
+
+  // Assign inputs
+  std::vector< std::string > inputs_names = filter->GetInputsNames( );
+  if( inputs_names.size( ) == 1 )
+  {
+       std::string data_name = this->m_UI->MPR->GetSelectedData( );
+       _TImages::iterator iIt = this->m_Images.find( data_name );
+       _TImages::iterator mIt = this->m_Meshes.find( data_name );
+       filter->SetInput( inputs_names[ 0 ]);
+  }
+  else if( inputs_names.size( ) > 1 )
+  {
+  } // fi
+
+  // Get outputs
+  std::vector< std::string > outputs_names = filter->GetOutputsNames( );
+  */
+
+  /*
+
+  // Choose inputs
+  if( filter_cate == "ImageToMeshFilter" )
   {
-    if( cate == "ImageToMeshFilter" )
+    // Check inputs
+    _TImages::iterator iIt = this->m_Images.find( data_name );
+    if( iIt == this->m_Images.end( ) )
     {
-      if( filter->ExecConfigurationDialog( this ) )
-      {
-        filter->SetInput( "Input", this->m_MainImage );
-        this->_Block( );
-        err = filter->Update( );
-        this->_Unblock( );
-        TPlugins::TMesh::Pointer mesh =
-          filter->GetOutput< TPlugins::TMesh >( "Output" );
-        this->m_Meshes.push_back( mesh );
-        mesh->CreateVTKActor( );
-        vtkActor* actor = mesh->GetVTKActor( );
-        if( actor != NULL )
-          this->m_UI->MPR->Add3DActor( actor );
+      QMessageBox::critical(
+        this,
+        tr( "Error creating filter" ),
+        tr( "No valid input selected." )
+        );
+      return;
 
-      } // fi
+    } // fi
+
+    // Execute configuration dialog
+    if( !( filter->ExecConfigurationDialog( this ) ) )
+      return;
+
+    // Execute filter
+    filter->SetInput( "Input", iIt->second );
+    this->_Block( );
+    std::string filter_err = filter->Update( );
+    this->_Unblock( );
+    if( filter_err != "" )
+    {
+      QMessageBox::critical(
+        this,
+        tr( "Error executing" ),
+        tr( filter_err.c_str( ) )
+        );
+      return;
 
     } // fi
-  }
-  else
-    QMessageBox::critical(
-      this,
-      tr( "Error creating filter" ),
-      tr( "No valid filter defined." )
+
+    // Keep and show results
+    TPlugins::TMesh::Pointer mesh =
+      filter->GetOutput< TPlugins::TMesh >( "Output" );
+    this->m_Meshes[ filter_name ] = mesh;
+    this->_Block( );
+    this->m_UI->MPR->ShowMesh(
+      mesh->GetVTK< vtkPolyData >( ),
+      filter_name,
+      data_name
       );
+    this->_Unblock( );
 
+  } // fi
+  */
+
+  /*
+    if( this->m_Plugins->CreateFilter( filter, name ) )
+    {
+    if( filter->ExecConfigurationDialog( this ) )
+    {
+    filter->SetInput( "Input", this->m_MainImage );
+    this->_Block( );
+    err = filter->Update( );
+    this->_Unblock( );
+    TPlugins::TMesh::Pointer mesh =
+    filter->GetOutput< TPlugins::TMesh >( "Output" );
+    this->m_Meshes.push_back( mesh );
+    mesh->CreateVTKActor( );
+    vtkActor* actor = mesh->GetVTKActor( );
+    if( actor != NULL )
+    this->m_UI->MPR->Add3DActor( actor );
+
+    } // fi
+    
+    } // fi
+    }
+    else
+    QMessageBox::critical(
+    this,
+    tr( "Error creating filter" ),
+    tr( "No valid filter defined." )
+    );
+  */
   /*
     if( name == "cpPlugins::BasicFilters::FloodFillImageFilter" )
     {
index 56b4623e1771ae71db61ea52844be193cbfaf1c9..c4d43e33d37b8aee02f8a092812ec7f78ea5e238 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __IMAGEMPR__H__
 #define __IMAGEMPR__H__
 
+#include <map>
 #include <vector>
 
 // Qt stuff
@@ -175,8 +176,9 @@ private:
   TPlugins*     m_Plugins;
 
   // Objects
-  TPlugins::TImage::Pointer m_MainImage;
-  std::vector< TPlugins::TMesh::Pointer > m_Meshes;
+  typedef std::pair< std::string, TPlugins::TDataObject::Pointer > TTreeNode;
+  typedef std::map< std::string, TTreeNode > TTree;
+  TTree m_Objects;
 
   // Plugins objects
   /*
index d37cab641b1a074ae23c5237f91cf9c27e32faa5..26dfe1efbdd0ac0af2a884db20d734ed07c32c80 100644 (file)
   <widget class="QWidget" name="CentralWidget">
    <layout class="QGridLayout" name="gridLayout">
     <item row="0" column="0">
-     <widget class="cpPlugins::Interface::BaseMPRWindow" name="MPR"/>
+     <widget class="cpPlugins::Interface::BaseMPRWidget" name="MPR" native="true">
+      <property name="minimumSize">
+       <size>
+        <width>562</width>
+        <height>406</height>
+       </size>
+      </property>
+     </widget>
     </item>
    </layout>
   </widget>
  <layoutdefault spacing="6" margin="11"/>
  <customwidgets>
   <customwidget>
-   <class>cpPlugins::Interface::BaseMPRWindow</class>
-   <extends>QFrame</extends>
-   <header location="global">cpPlugins/Interface/BaseMPRWindow.h</header>
+   <class>cpPlugins::Interface::BaseMPRWidget</class>
+   <extends>QWidget</extends>
+   <header location="global">cpPlugins/Interface/BaseMPRWidget.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>
index 5d197de7ed4745bcaf65001cfbf49ac57616ceec..02733dfb48f490c507152d4a06370b0531f1ed7b 100644 (file)
@@ -5,7 +5,6 @@
 
 SET(
   EXAMPLES_PROGRAMS_ONLY_EXTENSIONS
-  #example_TestQuadSplitter
   )
 
 FOREACH(prog ${EXAMPLES_PROGRAMS_ONLY_EXTENSIONS})
diff --git a/appli/examples/example_TestQuadSplitter.cxx b/appli/examples/example_TestQuadSplitter.cxx
deleted file mode 100644 (file)
index e1c9d1b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <QApplication>
-#include <QTextEdit>
-#include <cpExtensions/QT/QuadSplitter.h>
-
-int main( int argc, char* argv[] )
-{
-  int ret = 0;
-#ifdef cpExtensions_Interface_QT4
-  QApplication app( argc, argv );
-
-  QTextEdit* t1 = new QTextEdit;
-  QTextEdit* t2 = new QTextEdit;
-  QTextEdit* t3 = new QTextEdit;
-  QTextEdit* t4 = new QTextEdit;
-
-  cpExtensions::QT::QuadSplitter quadSplit;
-  quadSplit.addWidgets( t1, t2, t3, t4 );
-  quadSplit.show( );
-  ret = app.exec( );
-#endif // cpExtensions_Interface_QT4
-  return( ret );
-}
-
-// eof - $RCSfile$
index a384eb0df57c71021b320f60e938a946bed85f74..7cc717886f89fc6a9bfe560fe3eedf8c213164c7 100644 (file)
@@ -18,231 +18,6 @@ SetSetDoubleClickDelay( long delay )
   Self::_TMouseButtonEvent::MaxDoubleClick = delay;
 }
 
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddMouseMoveCommand( TMouseCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_MouseMoveCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddMouseClickCommand( TMouseCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_MouseClickCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddMouseDoubleClickCommand( TMouseCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_MouseDoubleClickCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddMouseWheelCommand( TMouseWheelCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_MouseWheelCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddKeyCommand( TKeyCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_KeyCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddExposeCommand( TVoidCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_ExposeCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddConfigureCommand( TVoidCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_ConfigureCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddEnterCommand( TVoidCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_EnterCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddLeaveCommand( TVoidCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_LeaveCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveMouseMoveCommand( TMouseCommand command )
-{
-  auto i = this->m_MouseMoveCommands.find( command );
-  if( i != this->m_MouseMoveCommands.end( ) )
-  {
-    this->m_MouseMoveCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveMouseClickCommand( TMouseCommand command )
-{
-  auto i = this->m_MouseClickCommands.find( command );
-  if( i != this->m_MouseClickCommands.end( ) )
-  {
-    this->m_MouseClickCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveMouseDoubleClickCommand( TMouseCommand command )
-{
-  auto i = this->m_MouseDoubleClickCommands.find( command );
-  if( i != this->m_MouseDoubleClickCommands.end( ) )
-  {
-    this->m_MouseDoubleClickCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveMouseWheelCommand( TMouseWheelCommand command )
-{
-  auto i = this->m_MouseWheelCommands.find( command );
-  if( i != this->m_MouseWheelCommands.end( ) )
-  {
-    this->m_MouseWheelCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveKeyCommand( TKeyCommand command )
-{
-  auto i = this->m_KeyCommands.find( command );
-  if( i != this->m_KeyCommands.end( ) )
-  {
-    this->m_KeyCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveExposeCommand( TVoidCommand command )
-{
-  auto i = this->m_ExposeCommands.find( command );
-  if( i != this->m_ExposeCommands.end( ) )
-  {
-    this->m_ExposeCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveConfigureCommand( TVoidCommand command )
-{
-  auto i = this->m_ConfigureCommands.find( command );
-  if( i != this->m_ConfigureCommands.end( ) )
-  {
-    this->m_ConfigureCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveEnterCommand( TVoidCommand command )
-{
-  auto i = this->m_EnterCommands.find( command );
-  if( i != this->m_EnterCommands.end( ) )
-  {
-    this->m_EnterCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveLeaveCommand( TVoidCommand command )
-{
-  auto i = this->m_LeaveCommands.find( command );
-  if( i != this->m_LeaveCommands.end( ) )
-  {
-    this->m_LeaveCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
 // -------------------------------------------------------------------------
 void cpExtensions::Interaction::BaseInteractorStyle::
 DelegateTDxEvent( unsigned long event, void* calldata )
@@ -451,172 +226,35 @@ OnRightButtonUp( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnLeftClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Get mouse pointer position
-  static int idx[ 2 ];
-  static double pos[ 3 ];
-  if( !( this->_PickPosition( idx, pos ) ) )
-    return;
-
-  // Invoke possible events
-  auto i = this->m_MouseClickCommands.begin( );
-  for( ; i != this->m_MouseClickCommands.end( ); ++i )
-    i->first(
-      i->second,
-      Self::ButtonID_Left,
-      idx, pos,
-      rwi->GetAltKey( ) == 1,
-      rwi->GetControlKey( ) == 1,
-      rwi->GetShiftKey( ) == 1
-      );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnLeftDoubleClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Get mouse pointer position
-  static int idx[ 2 ];
-  static double pos[ 3 ];
-  if( !( this->_PickPosition( idx, pos ) ) )
-    return;
-
-  // Invoke possible events
-  auto i = this->m_MouseDoubleClickCommands.begin( );
-  for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
-    i->first(
-      i->second,
-      Self::ButtonID_Left,
-      idx, pos,
-      rwi->GetAltKey( ) == 1,
-      rwi->GetControlKey( ) == 1,
-      rwi->GetShiftKey( ) == 1
-      );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnMiddleClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Get mouse pointer position
-  static int idx[ 2 ];
-  static double pos[ 3 ];
-  if( !( this->_PickPosition( idx, pos ) ) )
-    return;
-
-  // Invoke possible events
-  auto i = this->m_MouseClickCommands.begin( );
-  for( ; i != this->m_MouseClickCommands.end( ); ++i )
-    i->first(
-      i->second,
-      Self::ButtonID_Middle,
-      idx, pos,
-      rwi->GetAltKey( ) == 1,
-      rwi->GetControlKey( ) == 1,
-      rwi->GetShiftKey( ) == 1
-      );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnMiddleDoubleClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Get mouse pointer position
-  static int idx[ 2 ];
-  static double pos[ 3 ];
-  if( !( this->_PickPosition( idx, pos ) ) )
-    return;
-
-  // Invoke possible events
-  auto i = this->m_MouseDoubleClickCommands.begin( );
-  for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
-    i->first(
-      i->second,
-      Self::ButtonID_Middle,
-      idx, pos,
-      rwi->GetAltKey( ) == 1,
-      rwi->GetControlKey( ) == 1,
-      rwi->GetShiftKey( ) == 1
-      );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnRightClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Get mouse pointer position
-  static int idx[ 2 ];
-  static double pos[ 3 ];
-  if( !( this->_PickPosition( idx, pos ) ) )
-    return;
-
-  // Invoke possible events
-  auto i = this->m_MouseClickCommands.begin( );
-  for( ; i != this->m_MouseClickCommands.end( ); ++i )
-    i->first(
-      i->second,
-      Self::ButtonID_Right,
-      idx, pos,
-      rwi->GetAltKey( ) == 1,
-      rwi->GetControlKey( ) == 1,
-      rwi->GetShiftKey( ) == 1
-      );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnRightDoubleClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Get mouse pointer position
-  static int idx[ 2 ];
-  static double pos[ 3 ];
-  if( !( this->_PickPosition( idx, pos ) ) )
-    return;
+#define cpExtensions_BaseInteractorStyle_Click( S, T )          \
+  void cpExtensions::Interaction::BaseInteractorStyle::         \
+  On##S##T( )                                                   \
+  {                                                             \
+    vtkRenderWindowInteractor* rwi = this->GetInteractor( );    \
+    if( rwi == NULL )                                           \
+      return;                                                   \
+    static int idx[ 2 ];                                        \
+    static double pos[ 3 ];                                     \
+    if( !( this->_PickPosition( idx, pos ) ) )                  \
+      return;                                                   \
+    auto i = this->m_Mouse##T##Commands.begin( );               \
+    for( ; i != this->m_Mouse##T##Commands.end( ); ++i )        \
+      i->first(                                                 \
+        i->second,                                              \
+        Self::ButtonID_##S,                                     \
+        idx, pos,                                               \
+        rwi->GetAltKey( ) == 1,                                 \
+        rwi->GetControlKey( ) == 1,                             \
+        rwi->GetShiftKey( ) == 1                                \
+        );                                                      \
+  }
 
-  // Invoke possible events
-  auto i = this->m_MouseDoubleClickCommands.begin( );
-  for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
-    i->first(
-      i->second,
-      Self::ButtonID_Right,
-      idx, pos,
-      rwi->GetAltKey( ) == 1,
-      rwi->GetControlKey( ) == 1,
-      rwi->GetShiftKey( ) == 1
-      );
-}
+cpExtensions_BaseInteractorStyle_Click( Left, Click );
+cpExtensions_BaseInteractorStyle_Click( Middle, Click );
+cpExtensions_BaseInteractorStyle_Click( Right, Click );
+cpExtensions_BaseInteractorStyle_Click( Left, DoubleClick );
+cpExtensions_BaseInteractorStyle_Click( Middle, DoubleClick );
+cpExtensions_BaseInteractorStyle_Click( Right, DoubleClick );
 
 // -------------------------------------------------------------------------
 void cpExtensions::Interaction::BaseInteractorStyle::
@@ -633,84 +271,22 @@ OnChar( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnKeyDown( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnKeyUp( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnKeyPress( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnKeyRelease( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnExpose( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Invoke possible events
-  auto i = this->m_ExposeCommands.begin( );
-  for( ; i != this->m_ExposeCommands.end( ); ++i )
-    i->first( i->second );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnConfigure( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Invoke possible events
-  auto i = this->m_ConfigureCommands.begin( );
-  for( ; i != this->m_ConfigureCommands.end( ); ++i )
-    i->first( i->second );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnEnter( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-
-  // Invoke possible events
-  auto i = this->m_EnterCommands.begin( );
-  for( ; i != this->m_EnterCommands.end( ); ++i )
-    i->first( i->second );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnLeave( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
+#define cpExtensions_BaseInteractorStyle_Global( N )            \
+  void cpExtensions::Interaction::BaseInteractorStyle::         \
+  On##N( )                                                      \
+  {                                                             \
+    vtkRenderWindowInteractor* rwi = this->GetInteractor( );    \
+    if( rwi == NULL )                                           \
+      return;                                                   \
+    auto i = this->m_##N##Commands.begin( );                    \
+    for( ; i != this->m_##N##Commands.end( ); ++i )             \
+      i->first( i->second );                                    \
+  }
 
-  // Invoke possible events
-  auto i = this->m_LeaveCommands.begin( );
-  for( ; i != this->m_LeaveCommands.end( ); ++i )
-    i->first( i->second );
-}
+cpExtensions_BaseInteractorStyle_Global( Expose );
+cpExtensions_BaseInteractorStyle_Global( Configure );
+cpExtensions_BaseInteractorStyle_Global( Enter );
+cpExtensions_BaseInteractorStyle_Global( Leave );
 
 // -------------------------------------------------------------------------
 void cpExtensions::Interaction::BaseInteractorStyle::
index 1501f00297b4b48c06b78236d448d556def73cd9..119668b5dd4a17d4e221435c38c04ecd77d915d5 100644 (file)
  * =========================================================================
  */
 
+// -------------------------------------------------------------------------
+#define cpExtensions_BaseInteractorStyle_Commands( C )                  \
+  protected:                                                            \
+  std::map< T##C##Command, void* > m_##C##Commands;                     \
+public:                                                                 \
+  inline void Add##C##Command( T##C##Command c, void* d )               \
+  {                                                                     \
+    if( c != NULL )                                                     \
+    {                                                                   \
+      this->m_##C##Commands[ c ] = d;                                   \
+      this->Modified( );                                                \
+    }                                                                   \
+  }                                                                     \
+  inline void Remove##C##Command( T##C##Command c )                     \
+  {                                                                     \
+    std::map< T##C##Command, void* >::iterator i =                      \
+      this->m_##C##Commands.find( c );                                  \
+    if( i != this->m_##C##Commands.end( ) )                             \
+    {                                                                   \
+      this->m_##C##Commands.erase( i );                                 \
+      this->Modified( );                                                \
+    }                                                                   \
+  }
+
 // -------------------------------------------------------------------------
 #define BaseInteractorStyle_DIFF_TIME                           \
   std::chrono::duration_cast< std::chrono::milliseconds >(      \
@@ -49,31 +73,27 @@ namespace cpExtensions
       typedef void ( *TMouseWheelCommand )( void*, const int&, bool, bool, bool );
       typedef void ( *TKeyCommand )( void*, const char& );
       typedef void ( *TVoidCommand )( void* );
-
-    public:
-      static void SetSetDoubleClickDelay( long delay );
+      typedef TMouseCommand TMouseMoveCommand;
+      typedef TMouseCommand TMouseClickCommand;
+      typedef TMouseCommand TMouseDoubleClickCommand;
+      typedef TVoidCommand  TExposeCommand;
+      typedef TVoidCommand  TConfigureCommand;
+      typedef TVoidCommand  TEnterCommand;
+      typedef TVoidCommand  TLeaveCommand;
 
       // Associate callbacks for each event
-      void AddMouseMoveCommand( TMouseCommand command, void* data );
-      void AddMouseClickCommand( TMouseCommand command, void* data );
-      void AddMouseDoubleClickCommand( TMouseCommand command, void* data );
-      void AddMouseWheelCommand( TMouseWheelCommand command, void* data );
-      void AddKeyCommand( TKeyCommand command, void* data );
-      void AddExposeCommand( TVoidCommand command, void* data );
-      void AddConfigureCommand( TVoidCommand command, void* data );
-      void AddEnterCommand( TVoidCommand command, void* data );
-      void AddLeaveCommand( TVoidCommand command, void* data );
-
-      void RemoveMouseMoveCommand( TMouseCommand command );
-      void RemoveMouseClickCommand( TMouseCommand command );
-      void RemoveMouseDoubleClickCommand( TMouseCommand command );
-      void RemoveMouseWheelCommand( TMouseWheelCommand command );
-      void RemoveKeyCommand( TKeyCommand command );
-      void RemoveExposeCommand( TVoidCommand command );
-      void RemoveConfigureCommand( TVoidCommand command );
-      void RemoveEnterCommand( TVoidCommand command );
-      void RemoveLeaveCommand( TVoidCommand command );
+      cpExtensions_BaseInteractorStyle_Commands( MouseMove );
+      cpExtensions_BaseInteractorStyle_Commands( MouseClick );
+      cpExtensions_BaseInteractorStyle_Commands( MouseDoubleClick );
+      cpExtensions_BaseInteractorStyle_Commands( MouseWheel );
+      cpExtensions_BaseInteractorStyle_Commands( Key );
+      cpExtensions_BaseInteractorStyle_Commands( Expose );
+      cpExtensions_BaseInteractorStyle_Commands( Configure );
+      cpExtensions_BaseInteractorStyle_Commands( Enter );
+      cpExtensions_BaseInteractorStyle_Commands( Leave );
 
+    public:
+      static void SetSetDoubleClickDelay( long delay );
       void DelegateTDxEvent( unsigned long event, void* calldata );
 
       // Possible mouse motion events
@@ -103,10 +123,10 @@ namespace cpExtensions
 
       // Keyboard-related events
       virtual void OnChar( );
-      virtual void OnKeyDown( );
-      virtual void OnKeyUp( );
-      virtual void OnKeyPress( );
-      virtual void OnKeyRelease( );
+      virtual void OnKeyDown( )    { }
+      virtual void OnKeyUp( )      { }
+      virtual void OnKeyPress( )   { }
+      virtual void OnKeyRelease( ) { }
 
       // Other events
       virtual void OnExpose( );
@@ -142,17 +162,6 @@ namespace cpExtensions
     protected:
       double m_MotionFactor;
 
-      // Callbacks
-      std::map< TMouseCommand, void* >      m_MouseMoveCommands;
-      std::map< TMouseCommand, void* >      m_MouseClickCommands;
-      std::map< TMouseCommand, void* >      m_MouseDoubleClickCommands;
-      std::map< TMouseWheelCommand, void* > m_MouseWheelCommands;
-      std::map< TKeyCommand, void* >        m_KeyCommands;
-      std::map< TVoidCommand, void* >       m_ExposeCommands;
-      std::map< TVoidCommand, void* >       m_ConfigureCommands;
-      std::map< TVoidCommand, void* >       m_EnterCommands;
-      std::map< TVoidCommand, void* >       m_LeaveCommands;
-
       /**
        * Button events
        */
index 78bf7da38a9952962cc891e0dd8c75d3b91444b7..7664c137ff1b943d36e6659830276d7b1a66fd2f 100644 (file)
@@ -24,6 +24,19 @@ namespace cpExtensions
       typedef ImageInteractorStyle Self;
       vtkTypeMacro( ImageInteractorStyle, BaseInteractorStyle );
 
+      // Callbacks types
+      typedef Superclass::TMouseCommand            TMouseCommand;
+      typedef Superclass::TMouseWheelCommand       TMouseWheelCommand;
+      typedef Superclass::TKeyCommand              TKeyCommand;
+      typedef Superclass::TVoidCommand             TVoidCommand;
+      typedef Superclass::TMouseMoveCommand        TMouseMoveCommand;
+      typedef Superclass::TMouseClickCommand       TMouseClickCommand;
+      typedef Superclass::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+      typedef Superclass::TExposeCommand           TExposeCommand;
+      typedef Superclass::TConfigureCommand        TConfigureCommand;
+      typedef Superclass::TEnterCommand            TEnterCommand;
+      typedef Superclass::TLeaveCommand            TLeaveCommand;
+
     public:
       static Self* New( );
 
diff --git a/lib/cpExtensions/QT/QuadSplitter.cxx b/lib/cpExtensions/QT/QuadSplitter.cxx
deleted file mode 100644 (file)
index 6713180..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <cpExtensions/QT/QuadSplitter.h>
-
-#include <cpExtensions/Config.h>
-
-#ifdef cpExtensions_Interface_QT4
-
-/**
- * Inspired by:
- * https://forum.qt.io/topic/7144/quad-splitter-windows-an-implementation/2
- */
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::QuadSplitter::
-QuadSplitter( QWidget* parent )
-  : QSplitter( parent )
-{
-  this->setOrientation( Qt::Vertical );
-  this->addWidget( &this->m_Upper );
-  this->addWidget( &this->m_Bottom );
-
-  QObject::connect(
-    &( this->m_Upper ), SIGNAL( splitterMoved( int, int ) ),
-    this, SLOT( _SyncBottom( int, int ) )
-    );
-  QObject::connect(
-    &( this->m_Bottom ), SIGNAL( splitterMoved( int, int ) ),
-    this, SLOT( _SyncUpper( int, int ) )
-    );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::QuadSplitter::
-~QuadSplitter( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::QuadSplitter::
-addWidgets( QWidget* a, QWidget* b, QWidget* c, QWidget* d )
-{
-  this->m_Upper.addWidget( a );
-  this->m_Upper.addWidget( b );
-  this->m_Bottom.addWidget( c );
-  this->m_Bottom.addWidget( d );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::QuadSplitter::
-_SyncBottom( int a, int b )
-{
-  this->m_Bottom.setSizes( this->m_Upper.sizes( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::QuadSplitter::
-_SyncUpper( int a, int b )
-{
-  this->m_Upper.setSizes( this->m_Bottom.sizes( ) );
-}
-
-#endif // cpExtensions_Interface_QT4
-
-// eof - $RCSfile$
diff --git a/lib/cpExtensions/QT/QuadSplitter.h b/lib/cpExtensions/QT/QuadSplitter.h
deleted file mode 100644 (file)
index 7c27509..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef __CPEXTENSIONS__QT__QUADSPLITTER__H__
-#define __CPEXTENSIONS__QT__QUADSPLITTER__H__
-
-#include <cpExtensions/cpExtensions_Export.h>
-#include <cpExtensions/Config.h>
-
-#ifdef cpExtensions_Interface_QT4
-
-/**
- * Inspired by:
- * https://forum.qt.io/topic/7144/quad-splitter-windows-an-implementation/2
- */
-
-#include <QSplitter>
-
-namespace cpExtensions
-{
-  namespace QT
-  {
-    /**
-     */
-    class cpExtensions_EXPORT QuadSplitter
-      : public QSplitter
-    {
-      Q_OBJECT;
-
-    public:
-      QuadSplitter( QWidget* parent = 0 );
-      virtual ~QuadSplitter( );
-
-      void addWidgets( QWidget* a, QWidget* b, QWidget* c, QWidget* d );
-
-    private slots:
-      void _SyncBottom( int a, int b );
-      void _SyncUpper( int a, int b );
-
-    protected:
-      QSplitter m_Bottom;
-      QSplitter m_Upper;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // cpExtensions_Interface_QT4
-
-#endif // __CPEXTENSIONS__QT__QUADSPLITTER__H__
-
-// eof - $RCSfile$
index 104812144453fcefac9f8eb6705d95df1fb00826..e3a2ff0a5e06c6989ca2a869837ff6419cf54142 100644 (file)
@@ -27,81 +27,6 @@ New( )
   return( new Self( ) );
 }
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddSlicesCommand( TSlicesCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_SlicesCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddWindowLevelCommand( TWindowLevelCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_WindowLevelCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddRenderCommand( TVoidCommand command, void* data )
-{
-  if( command != NULL )
-  {
-    this->m_RenderCommands[ command ] = data;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-RemoveSlicesCommand( TSlicesCommand command )
-{
-  auto i = this->m_SlicesCommands.find( command );
-  if( i != this->m_SlicesCommands.end( ) )
-  {
-    this->m_SlicesCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-RemoveWindowLevelCommand( TWindowLevelCommand command )
-{
-  auto i = this->m_WindowLevelCommands.find( command );
-  if( i != this->m_WindowLevelCommands.end( ) )
-  {
-    this->m_WindowLevelCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-RemoveRenderCommand( TVoidCommand command )
-{
-  auto i = this->m_RenderCommands.find( command );
-  if( i != this->m_RenderCommands.end( ) )
-  {
-    this->m_RenderCommands.erase( i );
-    this->Modified( );
-
-  } // fi
-}
-
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 AddInputConnection( vtkAlgorithmOutput* aout, int axis )
@@ -1103,10 +1028,17 @@ UpdateText( const double& w, const double& l )
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-Render( )
+Render( const double& t )
 {
   if( this->m_Window != NULL )
+  {
+    vtkRenderer* renderer =
+      this->m_Window->GetRenderers( )->GetFirstRenderer( );
+    if( renderer != NULL )
+      renderer->SetAllocatedRenderTime( t );
     this->m_Window->Render( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
@@ -1236,7 +1168,7 @@ _MouseMoveCommand(
     // Just show the pixel information
     actors->SetCursor( pos );
     actors->UpdateText( pos );
-    actors->Render( );
+    actors->Render( 1e-3 );
   }
   else if( btn == TStyle::ButtonID_Left )
   {
@@ -1246,7 +1178,7 @@ _MouseMoveCommand(
       auto i = actors->m_SlicesCommands.begin( );
       for( ; i != actors->m_SlicesCommands.end( ); ++i )
         i->first( pos, actors->GetAxis( ), i->second );
-      actors->Render( );
+      actors->Render( 1e-3 );
 
     } // fi
   }
@@ -1271,7 +1203,7 @@ _MouseMoveCommand(
       dx += actors->m_StartWindowLevel[ 0 ];
       dy += actors->m_StartWindowLevel[ 1 ];
       actors->SetWindowLevel( dx, dy );
-      actors->Render( );
+      actors->Render( 1e-3 );
 
       // Associate objects
       auto i = actors->m_WindowLevelCommands.begin( );
@@ -1325,10 +1257,10 @@ _MouseWheelCommand(
     for( ; a != actors->m_AssociatedSlices.end( ); ++a )
     {
       ( *a )->SetSliceNumber( slice );
-      ( *a )->Render( );
+      ( *a )->Render( 1e-3 );
 
     } // rof
-    actors->Render( );
+    actors->Render( 1e-3 );
     
     // Associate objects
     auto i = actors->m_RenderCommands.begin( );
@@ -1351,7 +1283,7 @@ _KeyCommand( void* data, const char& key )
   case 'r': case 'R':
   {
     actors->ResetCamera( );
-    actors->Render( );
+    actors->Render( 1e-3 );
 
     // Associate objects
     auto i = actors->m_RenderCommands.begin( );
@@ -1362,7 +1294,7 @@ _KeyCommand( void* data, const char& key )
   case 'w': case 'W':
   {
     actors->ResetWindowLevel( );
-    actors->Render( );
+    actors->Render( 1e-3 );
 
     // Associate objects
     auto i = actors->m_RenderCommands.begin( );
@@ -1385,7 +1317,7 @@ _EnterCommand( void* data )
 
   actors->ResetCursor( );
   actors->m_CursorActor->VisibilityOn( );
-  actors->Render( );
+  actors->Render( 1e-3 );
 }
 
 // -------------------------------------------------------------------------
@@ -1398,7 +1330,7 @@ _LeaveCommand( void* data )
 
   actors->ResetCursor( );
   actors->m_CursorActor->VisibilityOff( );
-  actors->Render( );
+  actors->Render( 1e-3 );
 }
 
 // eof - $RCSfile$
index c5165c5665d5b7a2ab3f58b6240dd7fc53ea2c61..c5113ad725145ad6757d5e542ad78fc55d512334 100644 (file)
@@ -38,30 +38,33 @@ namespace cpExtensions
     public:
       typedef ImageSliceActors Self;
 
-      typedef cpExtensions::Interaction::BaseInteractorStyle  TBaseStyle;
       typedef cpExtensions::Interaction::ImageInteractorStyle TStyle;
+      typedef TStyle::TMouseCommand            TMouseCommand;
+      typedef TStyle::TMouseWheelCommand       TMouseWheelCommand;
+      typedef TStyle::TKeyCommand              TKeyCommand;
+      typedef TStyle::TVoidCommand             TVoidCommand;
+      typedef TStyle::TMouseMoveCommand        TMouseMoveCommand;
+      typedef TStyle::TMouseClickCommand       TMouseClickCommand;
+      typedef TStyle::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+      typedef TStyle::TExposeCommand           TExposeCommand;
+      typedef TStyle::TConfigureCommand        TConfigureCommand;
+      typedef TStyle::TEnterCommand            TEnterCommand;
+      typedef TStyle::TLeaveCommand            TLeaveCommand;
       typedef void ( *TSlicesCommand )( double*, int, void* );
       typedef void ( *TWindowLevelCommand )( double, double, void* );
-      typedef TBaseStyle::TMouseCommand      TMouseCommand;
-      typedef TBaseStyle::TMouseWheelCommand TMouseWheelCommand;
-      typedef TBaseStyle::TKeyCommand        TKeyCommand;
-      typedef TBaseStyle::TVoidCommand       TVoidCommand;
+      typedef TVoidCommand TRenderCommand;
 
     public:
       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
 
+      cpExtensions_BaseInteractorStyle_Commands( Slices );
+      cpExtensions_BaseInteractorStyle_Commands( WindowLevel );
+      cpExtensions_BaseInteractorStyle_Commands( Render );
+
     public:
       // Creation
       static ImageSliceActors* New( );
 
-      void AddSlicesCommand( TSlicesCommand command, void* data );
-      void AddWindowLevelCommand( TWindowLevelCommand command, void* data );
-      void AddRenderCommand( TVoidCommand command, void* data );
-
-      void RemoveSlicesCommand( TSlicesCommand command );
-      void RemoveWindowLevelCommand( TWindowLevelCommand command );
-      void RemoveRenderCommand( TVoidCommand command );
-
       void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
       void AddInputData( vtkImageData* data, int axis = 2 );
       void Clear( );
@@ -125,7 +128,7 @@ namespace cpExtensions
       void UpdateText( double pos[ 3 ] );
       void UpdateText( const double& w, const double& l );
 
-      void Render( );
+      void Render( const double& t );
       void ResetCamera( );
 
     protected:
@@ -139,13 +142,13 @@ namespace cpExtensions
       // Events
       static void _MouseMoveCommand(
         void* data,
-        const TBaseStyle::ButtonID& btn,
+        const TStyle::ButtonID& btn,
         int* idx, double* pos,
         bool alt, bool ctr, bool sft
         );
       static void _MouseClickCommand(
         void* data,
-        const TBaseStyle::ButtonID& btn,
+        const TStyle::ButtonID& btn,
         int* idx, double* pos,
         bool alt, bool ctr, bool sft
         );
@@ -182,11 +185,6 @@ namespace cpExtensions
       double m_MinWindow, m_MaxWindow;
       double m_MinLevel, m_MaxLevel;
 
-      // Associated commands
-      std::map< TSlicesCommand, void* >      m_SlicesCommands;
-      std::map< TWindowLevelCommand, void* > m_WindowLevelCommands;
-      std::map< TVoidCommand, void* >        m_RenderCommands;
-
       // Unique objects
       vtkSmartPointer< vtkPolyData >       m_Cursor;
       vtkSmartPointer< vtkPolyDataMapper > m_CursorMapper;
index 150651e860bb9ddc61bd9e3016d4091135467c8a..00d27dc6e8411c62388b6f29a4487f2719cc1a5d 100644 (file)
@@ -420,8 +420,8 @@ _SlicesCommand( double* pos, int axis, void* data )
     {
       actors->Slices[ 0 ][ j ]->SetSlice( pos );
       actors->Slices[ 1 ][ j ]->SetSlice( pos );
-      actors->Slices[ 0 ][ j ]->Render( );
-      actors->Slices[ 1 ][ j ]->Render( );
+      actors->Slices[ 0 ][ j ]->Render( 1e-3 );
+      actors->Slices[ 1 ][ j ]->Render( 1e-3 );
 
     } // fi
 
@@ -435,12 +435,12 @@ _WindowLevelCommand( double window, double level, void* data )
   MPRActors* actors = reinterpret_cast< MPRActors* >( data );
   if( actors == NULL )
     return;
-  actors->Slices[ 0 ][ 0 ]->Render( );
-  actors->Slices[ 0 ][ 1 ]->Render( );
-  actors->Slices[ 0 ][ 2 ]->Render( );
-  actors->Slices[ 1 ][ 0 ]->Render( );
-  actors->Slices[ 1 ][ 1 ]->Render( );
-  actors->Slices[ 1 ][ 2 ]->Render( );
+  actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
+  actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
+  actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 0 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 1 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 2 ]->Render( 1e-3 );
 }
 
 // -------------------------------------------------------------------------
@@ -450,12 +450,12 @@ _RenderCommand( void* data )
   MPRActors* actors = reinterpret_cast< MPRActors* >( data );
   if( actors == NULL )
     return;
-  actors->Slices[ 0 ][ 0 ]->Render( );
-  actors->Slices[ 0 ][ 1 ]->Render( );
-  actors->Slices[ 0 ][ 2 ]->Render( );
-  actors->Slices[ 1 ][ 0 ]->Render( );
-  actors->Slices[ 1 ][ 1 ]->Render( );
-  actors->Slices[ 1 ][ 2 ]->Render( );
+  actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
+  actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
+  actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 0 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 1 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 2 ]->Render( 1e-3 );
 }
 
 // eof - $RCSfile$
index 01066b40d1fd03734199ee24e79c86b23dc70d47..fe8e43fd06d530cbeab6990a1d2dd12a59c44f7e 100644 (file)
@@ -16,14 +16,18 @@ namespace cpExtensions
     public:
       typedef MPRActors Self;
 
-      typedef ImageSliceActors::TBaseStyle          TBaseStyle;
-      typedef ImageSliceActors::TStyle              TStyle;
-      typedef ImageSliceActors::TSlicesCommand      TSlicesCommand;
-      typedef ImageSliceActors::TWindowLevelCommand TWindowLevelCommand;
-      typedef ImageSliceActors::TMouseCommand       TMouseCommand;
-      typedef ImageSliceActors::TMouseWheelCommand  TMouseWheelCommand;
-      typedef ImageSliceActors::TKeyCommand         TKeyCommand;
-      typedef ImageSliceActors::TVoidCommand        TVoidCommand;
+      typedef ImageSliceActors::TStyle                   TStyle;
+      typedef ImageSliceActors::TMouseCommand            TMouseCommand;
+      typedef ImageSliceActors::TMouseWheelCommand       TMouseWheelCommand;
+      typedef ImageSliceActors::TKeyCommand              TKeyCommand;
+      typedef ImageSliceActors::TVoidCommand             TVoidCommand;
+      typedef ImageSliceActors::TMouseMoveCommand        TMouseMoveCommand;
+      typedef ImageSliceActors::TMouseClickCommand       TMouseClickCommand;
+      typedef ImageSliceActors::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+      typedef ImageSliceActors::TExposeCommand           TExposeCommand;
+      typedef ImageSliceActors::TConfigureCommand        TConfigureCommand;
+      typedef ImageSliceActors::TEnterCommand            TEnterCommand;
+      typedef ImageSliceActors::TLeaveCommand            TLeaveCommand;
 
     public:
       vtkTypeMacro( MPRActors, vtkPropCollection );
index 2a50c62a9fb1f68307b9d9f106620422761c1bec..af0ad4192751367156338fb6ca57d38abfa2d039 100644 (file)
@@ -65,7 +65,7 @@ AddImage( vtkImageData* image )
     this->ResetCameras( );
 
   } // fi
-  this->RenderAll( );
+  this->RenderAll( 1e-3 );
 }
 
 // -------------------------------------------------------------------------
@@ -79,7 +79,7 @@ ClearAll( )
     this->m_Windows[ 3 ]
     );
   this->ResetCameras( );
-  this->RenderAll( );
+  this->RenderAll( 1e-3 );
 }
 
 // -------------------------------------------------------------------------
@@ -102,20 +102,36 @@ ResetCameras( )
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRObjects::
-Render( const int& id )
+Render( const int& id, const double& t )
 {
   if( id < 4 )
+  {
     if( this->m_Windows[ id ] != NULL )
+    {
+      if( this->m_Renderers[ id ] != NULL )
+        this->m_Renderers[ id ]->SetAllocatedRenderTime( t );
       this->m_Windows[ id ]->Render( );
+      
+    } // fi
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRObjects::
-RenderAll( )
+RenderAll( const double& t )
 {
   for( int i = 0; i < 4; ++i )
+  {
     if( this->m_Windows[ i ] != NULL )
+    {
+      if( this->m_Renderers[ i ] != NULL )
+        this->m_Renderers[ i ]->SetAllocatedRenderTime( t );
       this->m_Windows[ i ]->Render( );
+
+    } // fi
+
+  } // rof
 }
 
 // -------------------------------------------------------------------------
index 71741ef17a9b3f7f38dfa7fee3fe4a509212cbd9..8ac1cd2540aae98d1d3b7d2bb97228fbb3f58585 100644 (file)
@@ -20,14 +20,18 @@ namespace cpExtensions
     public:
       typedef MPRObjects Self;
 
-      typedef MPRActors::TBaseStyle          TBaseStyle;
-      typedef MPRActors::TStyle              TStyle;
-      typedef MPRActors::TSlicesCommand      TSlicesCommand;
-      typedef MPRActors::TWindowLevelCommand TWindowLevelCommand;
-      typedef MPRActors::TMouseCommand       TMouseCommand;
-      typedef MPRActors::TMouseWheelCommand  TMouseWheelCommand;
-      typedef MPRActors::TKeyCommand         TKeyCommand;
-      typedef MPRActors::TVoidCommand        TVoidCommand;
+      typedef MPRActors::TStyle                   TStyle;
+      typedef MPRActors::TMouseCommand            TMouseCommand;
+      typedef MPRActors::TMouseWheelCommand       TMouseWheelCommand;
+      typedef MPRActors::TKeyCommand              TKeyCommand;
+      typedef MPRActors::TVoidCommand             TVoidCommand;
+      typedef MPRActors::TMouseMoveCommand        TMouseMoveCommand;
+      typedef MPRActors::TMouseClickCommand       TMouseClickCommand;
+      typedef MPRActors::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+      typedef MPRActors::TExposeCommand           TExposeCommand;
+      typedef MPRActors::TConfigureCommand        TConfigureCommand;
+      typedef MPRActors::TEnterCommand            TEnterCommand;
+      typedef MPRActors::TLeaveCommand            TLeaveCommand;
 
     public:
       vtkTypeMacro( MPRObjects, vtkObject );
@@ -45,8 +49,8 @@ namespace cpExtensions
 
       void ResetCamera( const int& id );
       void ResetCameras( );
-      void Render( const int& id );
-      void RenderAll( );
+      void Render( const int& id, const double& t );
+      void RenderAll( const double& t );
       vtkRenderer* GetXRenderer( );
       vtkRenderer* GetYRenderer( );
       vtkRenderer* GetZRenderer( );
diff --git a/lib/cpPlugins/Interface/BaseMPRWidget.cxx b/lib/cpPlugins/Interface/BaseMPRWidget.cxx
new file mode 100644 (file)
index 0000000..fece6b8
--- /dev/null
@@ -0,0 +1,245 @@
+#include <cpPlugins/Interface/BaseMPRWidget.h>
+
+#ifdef cpPlugins_Interface_QT4
+
+#include <cpPlugins/Interface/ui_BaseMPRWidget.h>
+#include <QTreeWidgetItem>
+#include <vtkRendererCollection.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::BaseMPRWidget::
+BaseMPRWidget( QWidget* parent )
+  : QWidget( parent ),
+    m_UI( new Ui::BaseMPRWidget )
+{
+  this->m_UI->setupUi( this );
+
+  // Configure VTK widgets
+  this->m_VTK[ 0 ] = this->m_UI->VTK01;
+  this->m_VTK[ 1 ] = this->m_UI->VTK00;
+  this->m_VTK[ 2 ] = this->m_UI->VTK10;
+  this->m_VTK[ 3 ] = this->m_UI->VTK11;
+
+  this->m_MPRObjects = vtkSmartPointer< TMPRObjects >::New( );
+  this->m_MPRObjects->SetRenderWindows(
+    this->m_VTK[ 0 ]->GetRenderWindow( ),
+    this->m_VTK[ 1 ]->GetRenderWindow( ),
+    this->m_VTK[ 2 ]->GetRenderWindow( ),
+    this->m_VTK[ 3 ]->GetRenderWindow( )
+    );
+
+  // Connect slots
+  QObject::connect(
+    this->m_UI->TopSplitter, SIGNAL( splitterMoved( int, int ) ),
+    this, SLOT( _SyncBottom( int, int ) )
+    );
+  QObject::connect(
+    this->m_UI->BottomSplitter, SIGNAL( splitterMoved( int, int ) ),
+    this, SLOT( _SyncTop( int, int ) )
+    );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::BaseMPRWidget::
+~BaseMPRWidget( )
+{
+  delete this->m_UI;
+
+  // Delete polydata actors
+  std::map< std::string, PolyDataActor* >::iterator mIt =
+    this->m_Meshes.begin( );
+  for( ; mIt != this->m_Meshes.end( ); ++mIt )
+    delete mIt->second;
+  this->m_Meshes.clear( );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWidget::
+ShowImage(
+  vtkImageData* image,
+  const std::string& name,
+  const std::string& parent
+  )
+{
+  // Update tree view
+  QTreeWidgetItem* new_item = this->_UpdateItem( name, parent );
+  if( new_item == NULL )
+    return( false );
+
+  // Associate new data
+  this->m_Images[ name ] = image;
+  this->m_Tree[ name ] = parent;
+
+  // Show image and return
+  this->m_MPRObjects->AddImage( image );
+  return( true );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWidget::
+ShowImage(
+  vtkImageData* image,
+  const std::string& name,
+  const std::string& parent,
+  const double& r, const double& g, const double& b
+  )
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWidget::
+ShowMesh(
+  vtkPolyData* mesh,
+  const std::string& name,
+  const std::string& parent
+  )
+{
+  // Update tree view
+  QTreeWidgetItem* new_item = this->_UpdateItem( name, parent );
+  if( new_item == NULL )
+    return( false );
+
+  // Associate new data
+  PolyDataActor* actor = new PolyDataActor( mesh );
+  this->m_Meshes[ name ] = actor;
+  this->m_Tree[ name ] = parent;
+
+  // Show mesh
+  this->_Add3DActor( actor->Actor );
+  return( true );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWidget::
+ShowMesh(
+  vtkPolyData* mesh,
+  const std::string& name,
+  const std::string& parent,
+  const double& r, const double& g, const double& b
+  )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWidget::
+ClearAll( )
+{
+  /*
+    this->m_MPRObjects->ClearAll( );
+    this->m_Images.clear( );
+    this->m_Meshes.clear( );
+  */
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::BaseMPRWidget::
+GetSelectedData( ) const
+{
+  QTreeWidgetItem* item = this->m_UI->LoadedData->currentItem( );
+  if( item != NULL )
+    return( item->text( 0 ).toStdString( ) );
+  else
+    return( "" );
+}
+
+// -------------------------------------------------------------------------
+QTreeWidgetItem* cpPlugins::Interface::BaseMPRWidget::
+_FindItem( const std::string& name ) const
+{
+  QList< QTreeWidgetItem* > items =
+    this->m_UI->LoadedData->findItems( name.c_str( ), Qt::MatchExactly );
+  if( items.size( ) > 0 )
+    return( items[ 0 ] );
+  else
+    return( NULL );
+}
+
+// -------------------------------------------------------------------------
+QTreeWidgetItem* cpPlugins::Interface::BaseMPRWidget::
+_UpdateItem( const std::string& name, const std::string& parent )
+{
+  // Update tree view
+  QTreeWidgetItem* new_item = NULL;
+  if( parent != "" )
+  {
+    QTreeWidgetItem* parent_item = this->_FindItem( parent );
+    if( parent_item != NULL )
+    {
+      QTreeWidgetItem* old_item = this->_FindItem( name );
+      if( old_item == NULL )
+      {
+        new_item =
+          new QTreeWidgetItem( parent_item, QStringList( name.c_str( ) ) );
+        parent_item->setExpanded( true );
+
+      } // fi
+
+    } // fi
+  }
+  else
+  {
+    new_item = new QTreeWidgetItem(
+      ( QTreeWidgetItem* )( NULL ), QStringList( name.c_str( ) )
+      );
+    this->m_UI->LoadedData->addTopLevelItem( new_item );
+
+  } // fi
+  return( new_item );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWidget::
+_Add3DActor( vtkProp3D* prop )
+{
+  vtkRenderer* ren =
+    this->m_VTK[ 3 ]->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
+  if( ren == NULL )
+    return;
+  ren->AddActor( prop );
+  this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWidget::
+_SyncBottom( int a, int b )
+{
+  this->m_UI->BottomSplitter->setSizes( this->m_UI->TopSplitter->sizes( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWidget::
+_SyncTop( int a, int b )
+{
+  this->m_UI->TopSplitter->setSizes( this->m_UI->BottomSplitter->sizes( ) );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::BaseMPRWidget::PolyDataActor::
+PolyDataActor( vtkPolyData* pd )
+{
+  if( pd ==  NULL )
+    return;
+
+  double range[ 2 ];
+  pd->GetScalarRange( range );
+
+  this->Normals = vtkSmartPointer< vtkPolyDataNormals >::New( );
+  this->Stripper = vtkSmartPointer< vtkStripper >::New( );
+  this->Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+  this->Actor = vtkSmartPointer< vtkQuadricLODActor >::New( );
+
+  this->Normals->SetInputData( pd );
+  this->Normals->SetFeatureAngle( 60.0 );
+  this->Stripper->SetInputConnection( this->Normals->GetOutputPort( ) );
+  this->Mapper->SetInputConnection( this->Stripper->GetOutputPort( ) );
+  this->Mapper->UseLookupTableScalarRangeOff( );
+  this->Mapper->SetScalarRange(
+    range[ 0 ], ( ( range[ 1 ] - range[ 0 ] ) * 0.75 ) + range[ 0 ]
+    );
+  this->Actor->SetMapper( this->Mapper );
+  this->Actor->DeferLODConstructionOff( );
+}
+
+#endif // cpPlugins_Interface_QT4
+
+// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/BaseMPRWidget.h b/lib/cpPlugins/Interface/BaseMPRWidget.h
new file mode 100644 (file)
index 0000000..9ed62ce
--- /dev/null
@@ -0,0 +1,133 @@
+#ifndef __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__
+#define __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/Config.h>
+
+#ifdef cpPlugins_Interface_QT4
+
+#include <map>
+#include <string>
+
+#include <QWidget>
+
+#include <vtkSmartPointer.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyDataNormals.h>
+#include <vtkQuadricLODActor.h>
+#include <vtkStripper.h>
+
+#include <cpExtensions/Visualization/MPRObjects.h>
+
+// -------------------------------------------------------------------------
+class QTreeWidgetItem;
+class QVTKWidget;
+
+namespace Ui
+{
+  class BaseMPRWidget;
+}
+
+// -------------------------------------------------------------------------
+namespace cpPlugins
+{
+  namespace Interface
+  {
+    /**
+     */
+    class cpPlugins_Interface_EXPORT BaseMPRWidget
+      : public QWidget
+    {
+      Q_OBJECT;
+
+    public:
+      typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
+
+      typedef TMPRObjects::TStyle                   TStyle;
+      typedef TMPRObjects::TMouseCommand            TMouseCommand;
+      typedef TMPRObjects::TMouseWheelCommand       TMouseWheelCommand;
+      typedef TMPRObjects::TKeyCommand              TKeyCommand;
+      typedef TMPRObjects::TVoidCommand             TVoidCommand;
+      typedef TMPRObjects::TMouseMoveCommand        TMouseMoveCommand;
+      typedef TMPRObjects::TMouseClickCommand       TMouseClickCommand;
+      typedef TMPRObjects::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+      typedef TMPRObjects::TExposeCommand           TExposeCommand;
+      typedef TMPRObjects::TConfigureCommand        TConfigureCommand;
+      typedef TMPRObjects::TEnterCommand            TEnterCommand;
+      typedef TMPRObjects::TLeaveCommand            TLeaveCommand;
+
+    public:
+      explicit BaseMPRWidget( QWidget* parent = 0 );
+      virtual ~BaseMPRWidget( );
+
+      // Some visualization accessors
+      bool ShowImage(
+        vtkImageData* image,
+        const std::string& name,
+        const std::string& parent = ""
+        );
+      bool ShowImage(
+        vtkImageData* image,
+        const std::string& name,
+        const std::string& parent,
+        const double& r, const double& g, const double& b
+        );
+      bool ShowMesh(
+        vtkPolyData* mesh,
+        const std::string& name,
+        const std::string& parent
+        );
+      bool ShowMesh(
+        vtkPolyData* mesh,
+        const std::string& name,
+        const std::string& parent,
+        const double& r, const double& g, const double& b
+        );
+      void ClearAll( );
+
+      // Visual objects accessors
+      std::string GetSelectedData( ) const;
+
+    protected:
+      QTreeWidgetItem* _FindItem( const std::string& name ) const;
+      QTreeWidgetItem* _UpdateItem(
+        const std::string& name,
+        const std::string& parent
+        );
+      
+      void _Add3DActor( vtkProp3D* prop );
+
+    private slots:
+      void _SyncBottom( int a, int b );
+      void _SyncTop( int a, int b );
+
+    protected:
+      Ui::BaseMPRWidget*             m_UI;
+      vtkSmartPointer< TMPRObjects > m_MPRObjects;
+
+      struct PolyDataActor
+      {
+        vtkSmartPointer< vtkPolyDataNormals > Normals;
+        vtkSmartPointer< vtkStripper >        Stripper;
+        vtkSmartPointer< vtkPolyDataMapper >  Mapper;
+        vtkSmartPointer< vtkQuadricLODActor > Actor;
+
+        PolyDataActor( vtkPolyData* pd );
+      };
+
+      std::map< std::string, vtkImageData* >  m_Images;
+      std::map< std::string, PolyDataActor* > m_Meshes;
+      std::map< std::string, std::string >    m_Tree;
+
+      QVTKWidget* m_VTK[ 4 ];
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // cpPlugins_Interface_QT4
+
+#endif // __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__
+
+// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/BaseMPRWidget.ui b/lib/cpPlugins/Interface/BaseMPRWidget.ui
new file mode 100644 (file)
index 0000000..8eafb59
--- /dev/null
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BaseMPRWidget</class>
+ <widget class="QWidget" name="BaseMPRWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>580</width>
+    <height>424</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
+    <widget class="QSplitter" name="MainSplitter">
+     <property name="minimumSize">
+      <size>
+       <width>562</width>
+       <height>406</height>
+      </size>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <widget class="QTreeWidget" name="LoadedData">
+      <property name="minimumSize">
+       <size>
+        <width>150</width>
+        <height>406</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>500</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <column>
+       <property name="text">
+        <string>Data</string>
+       </property>
+      </column>
+     </widget>
+     <widget class="QSplitter" name="QuadSplitter">
+      <property name="minimumSize">
+       <size>
+        <width>406</width>
+        <height>406</height>
+       </size>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <widget class="QSplitter" name="TopSplitter">
+       <property name="minimumSize">
+        <size>
+         <width>406</width>
+         <height>200</height>
+        </size>
+       </property>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <widget class="QVTKWidget" name="VTK00" native="true">
+        <property name="minimumSize">
+         <size>
+          <width>200</width>
+          <height>200</height>
+         </size>
+        </property>
+       </widget>
+       <widget class="QVTKWidget" name="VTK01" native="true">
+        <property name="minimumSize">
+         <size>
+          <width>200</width>
+          <height>200</height>
+         </size>
+        </property>
+       </widget>
+      </widget>
+      <widget class="QSplitter" name="BottomSplitter">
+       <property name="minimumSize">
+        <size>
+         <width>406</width>
+         <height>200</height>
+        </size>
+       </property>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <widget class="QVTKWidget" name="VTK10" native="true">
+        <property name="minimumSize">
+         <size>
+          <width>200</width>
+          <height>200</height>
+         </size>
+        </property>
+       </widget>
+       <widget class="QVTKWidget" name="VTK11" native="true">
+        <property name="minimumSize">
+         <size>
+          <width>200</width>
+          <height>200</height>
+         </size>
+        </property>
+       </widget>
+      </widget>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QVTKWidget</class>
+   <extends>QWidget</extends>
+   <header location="global">QVTKWidget.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/lib/cpPlugins/Interface/BaseMPRWindow.cxx b/lib/cpPlugins/Interface/BaseMPRWindow.cxx
deleted file mode 100644 (file)
index 230c961..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <cpPlugins/Interface/BaseMPRWindow.h>
-
-#ifdef cpPlugins_Interface_QT4
-
-#include <vtkRendererCollection.h>
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::BaseMPRWindow::
-BaseMPRWindow( QWidget* parent )
-  : cpExtensions::QT::QuadSplitter( parent )
-{
-  // Configure splitter
-  this->m_XVTK = new QVTKWidget( this );
-  this->m_YVTK = new QVTKWidget( this );
-  this->m_ZVTK = new QVTKWidget( this );
-  this->m_WVTK = new QVTKWidget( this );
-  this->addWidgets( this->m_YVTK, this->m_XVTK, this->m_ZVTK, this->m_WVTK );
-
-  // Create and associate vtk renderers
-  this->m_MPRObjects = vtkSmartPointer< TMPRObjects >::New( );
-  this->m_MPRObjects->SetRenderWindows(
-    this->m_XVTK->GetRenderWindow( ),
-    this->m_YVTK->GetRenderWindow( ),
-    this->m_ZVTK->GetRenderWindow( ),
-    this->m_WVTK->GetRenderWindow( )
-    );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::BaseMPRWindow::
-~BaseMPRWindow( )
-{
-  if( this->m_WVTK != NULL ) delete this->m_WVTK;
-  if( this->m_ZVTK != NULL ) delete this->m_ZVTK;
-  if( this->m_YVTK != NULL ) delete this->m_YVTK;
-  if( this->m_XVTK != NULL ) delete this->m_XVTK;
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
-ShowImage( vtkImageData* image )
-{
-  bool r = ( image != NULL );
-  if( r )
-    this->m_MPRObjects->AddImage( image );
-  return( r );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
-ShowImage( vtkImageData* image, double r, double g, double b )
-{
-  return( false );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
-ShowMesh( vtkPolyData* mesh )
-{
-  return( false );
-}
-
-// -------------------------------------------------------------------------
-/*
-  void cpPlugins::Interface::BaseMPRWindow::
-  AddImage( const std::string& name, TImage* image )
-  {
-  this->m_Images[ name ] = image;
-  vtkImageData* vtk_id =
-  this->m_Images[ name ]->GetVTK< vtkImageData >( );
-  if( vtk_id != NULL )
-  this->m_MPRObjects->AddImage( vtk_id );
-  }
-*/
-
-// -------------------------------------------------------------------------
-double cpPlugins::Interface::BaseMPRWindow::
-GetWindow( ) const
-{
-  return( this->m_MPRObjects->GetWindow( ) );
-}
-
-// -------------------------------------------------------------------------
-double cpPlugins::Interface::BaseMPRWindow::
-GetLevel( ) const
-{
-  return( this->m_MPRObjects->GetLevel( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::BaseMPRWindow::
-ClearAll( )
-{
-  /*
-    this->m_MPRObjects->ClearAll( );
-    this->m_Images.clear( );
-    this->m_Meshes.clear( );
-  */
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::BaseMPRWindow::
-Add3DActor( vtkProp3D* prop )
-{
-  vtkRenderer* ren =
-    this->m_WVTK->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
-  if( ren == NULL )
-    return;
-  ren->AddActor( prop );
-  this->m_WVTK->GetRenderWindow( )->Render( );
-}
-
-#endif // cpPlugins_Interface_QT4
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Interface/BaseMPRWindow.h b/lib/cpPlugins/Interface/BaseMPRWindow.h
deleted file mode 100644 (file)
index 078e028..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
-#define __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/Config.h>
-
-#ifdef cpPlugins_Interface_QT4
-
-#include <QApplication>
-#include <QMenu>
-#include <QVTKWidget.h>
-
-#include <vtkSmartPointer.h>
-#include <cpExtensions/QT/QuadSplitter.h>
-#include <cpExtensions/Visualization/MPRObjects.h>
-
-namespace cpPlugins
-{
-  namespace Interface
-  {
-    /**
-     */
-    class cpPlugins_Interface_EXPORT BaseMPRWindow
-      : public cpExtensions::QT::QuadSplitter
-    {
-      Q_OBJECT;
-
-    public:
-      typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
-
-      typedef TMPRObjects::TBaseStyle          TBaseStyle;
-      typedef TMPRObjects::TStyle              TStyle;
-      typedef TMPRObjects::TSlicesCommand      TSlicesCommand;
-      typedef TMPRObjects::TWindowLevelCommand TWindowLevelCommand;
-      typedef TMPRObjects::TMouseCommand       TMouseCommand;
-      typedef TMPRObjects::TMouseWheelCommand  TMouseWheelCommand;
-      typedef TMPRObjects::TKeyCommand         TKeyCommand;
-      typedef TMPRObjects::TVoidCommand        TVoidCommand;
-
-    public:
-      explicit BaseMPRWindow( QWidget* parent = 0 );
-      virtual ~BaseMPRWindow( );
-
-      // Some visualization accessors
-      bool ShowImage( vtkImageData* image );
-      bool ShowImage( vtkImageData* image, double r, double g, double b );
-      bool ShowMesh( vtkPolyData* mesh );
-      double GetWindow( ) const;
-      double GetLevel( ) const;
-      void ClearAll( );
-
-      // Some more visualization (3D)
-      void Add3DActor( vtkProp3D* prop );
-
-    protected:
-      vtkSmartPointer< TMPRObjects > m_MPRObjects;
-
-      QVTKWidget* m_XVTK;
-      QVTKWidget* m_YVTK;
-      QVTKWidget* m_ZVTK;
-      QVTKWidget* m_WVTK;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // cpPlugins_Interface_QT4
-
-#endif // __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
-
-// eof - $RCSfile$
index 115cb44816fcb42fde659f5f884097de539c4229..406f86fc6994824e6b980d463955562d93ef4bb4 100644 (file)
@@ -20,19 +20,20 @@ FILE(GLOB LIB_SOURCES_CXX "*.cxx")
 IF(USE_QT4)
   SET(
     LIB_QT_UI
+    BaseMPRWidget.ui
     ParametersListWidget.ui
     )
   SET(
     LIB_QT_Headers
     ParametersListWidget.h
     ParametersQtDialog.h
-    BaseMPRWindow.h
+    BaseMPRWidget.h
     )
   SET(
     LIB_QT_Sources
     ParametersListWidget.cxx
     ParametersQtDialog.cxx
-    BaseMPRWindow.cxx
+    BaseMPRWidget.cxx
     )
   SET(
     LIB_QT_Resources
index 829c1f53417839f1c41aa9ef3fea1bbdf3f4ab4f..94adb2bb163ae5f47da17ff9e62abb41d22d74c4 100644 (file)
@@ -10,71 +10,12 @@ SetVTK( vtkObject* mesh )
     this->m_VTKObject = mesh;
   else
     this->m_VTKObject = NULL;
-  this->m_Mapper = NULL;
-  this->m_Actor = NULL;
   this->Modified( );
 }
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Mesh::
-CreateVTKActor( )
-{
-  vtkPolyData* pd = this->GetVTK< vtkPolyData >( );
-  if(
-    pd != NULL &&
-    (
-      this->m_Mapper.GetPointer( ) == NULL ||
-      this->m_Actor.GetPointer( ) == NULL
-      )
-    )
-  {
-    double range[ 2 ];
-    pd->GetScalarRange( range );
-
-    this->m_Normals = vtkSmartPointer< vtkPolyDataNormals >::New( );
-    this->m_Stripper = vtkSmartPointer< vtkStripper >::New( );
-    this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
-    this->m_Actor = vtkSmartPointer< vtkQuadricLODActor >::New( );
-
-    this->m_Normals->SetInputData( pd );
-    this->m_Normals->SetFeatureAngle( 60.0 );
-    this->m_Stripper->SetInputConnection( this->m_Normals->GetOutputPort( ) );
-    this->m_Mapper->SetInputConnection( this->m_Stripper->GetOutputPort( ) );
-    this->m_Mapper->UseLookupTableScalarRangeOff( );
-    this->m_Mapper->SetScalarRange(
-      range[ 0 ], ( ( range[ 1 ] - range[ 0 ] ) * 0.75 ) + range[ 0 ]
-      );
-    this->m_Actor->SetMapper( this->m_Mapper );
-    this->m_Actor->DeferLODConstructionOff( );
-    this->Modified( );
-
-    /*
-      TODO: vtkQuadricLODActor : AllocatedRenderTime
-    */
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-vtkActor* cpPlugins::Interface::Mesh::
-GetVTKActor( )
-{
-  return( this->m_Actor );
-}
-
-// -------------------------------------------------------------------------
-const vtkActor* cpPlugins::Interface::Mesh::
-GetVTKActor( ) const
-{
-  return( this->m_Actor );
-}
-
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Mesh::
 Mesh( )
-  : Superclass( ),
-    m_Mapper( NULL ),
-    m_Actor( NULL )
+  : Superclass( )
 {
 }
 
index b2fe92302d84c810a20276a0e784320eb5f02f29..92c3c452e378fdd4598d0059855a0a616f4b6ba4 100644 (file)
@@ -4,12 +4,6 @@
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/DataObject.h>
 
-#include <vtkSmartPointer.h>
-#include <vtkQuadricLODActor.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkStripper.h>
-
 namespace cpPlugins
 {
   namespace Interface
@@ -38,10 +32,6 @@ namespace cpPlugins
 
       virtual void SetVTK( vtkObject* mesh );
 
-      virtual void CreateVTKActor( );
-      virtual vtkActor* GetVTKActor( );
-      virtual const vtkActor* GetVTKActor( ) const;
-
     protected:
       Mesh( );
       virtual ~Mesh( );
@@ -50,12 +40,6 @@ namespace cpPlugins
       // Purposely not implemented
       Mesh( const Self& );
       Self& operator=( const Self& );
-
-    protected:
-      vtkSmartPointer< vtkPolyDataNormals > m_Normals;
-      vtkSmartPointer< vtkStripper >        m_Stripper;
-      vtkSmartPointer< vtkPolyDataMapper >  m_Mapper;
-      vtkSmartPointer< vtkQuadricLODActor > m_Actor;
     };
 
   } // ecapseman
index 30378c21ae5f80363c2a90b24742646c231b6bae..b9dab29a1d1fafe68c5aba0195e37a1850bdd93d 100644 (file)
@@ -36,7 +36,7 @@ Plugins( QWidget* widget )
 cpPlugins::Interface::Plugins::
 ~Plugins( )
 {
-  this->m_Interface.UnloadAll( );
+  // TODO: this causes a segfault? this->m_Interface.UnloadAll( );
 }
 
 // -------------------------------------------------------------------------
index 9fb4ea71598e27f46131db062507b84d1709204a..f639d7f59e3ea2b5686950a48151e98b0d05ef73 100644 (file)
@@ -45,6 +45,28 @@ GetNumberOfOutputs( ) const
   return( this->m_Outputs.size( ) );
 }
 
+// -------------------------------------------------------------------------
+std::vector< std::string > cpPlugins::Interface::ProcessObject::
+GetInputsNames( ) const
+{
+  std::vector< std::string > r;
+  auto dIt = this->m_Inputs.begin( );
+  for( ; dIt != this->m_Inputs.end( ); ++dIt )
+    r.push_back( dIt->first );
+  return( r );
+}
+
+// -------------------------------------------------------------------------
+std::vector< std::string > cpPlugins::Interface::ProcessObject::
+GetOutputsNames( ) const
+{
+  std::vector< std::string > r;
+  auto dIt = this->m_Outputs.begin( );
+  for( ; dIt != this->m_Outputs.end( ); ++dIt )
+    r.push_back( dIt->first );
+  return( r );
+}
+
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::ProcessObject::
 SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
index 53b784fe2ac2ac775b5debe25f978086ccf5db46..5fc98f399f605b624bcdd1155e65b67f1be823e0 100644 (file)
@@ -4,6 +4,7 @@
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 
 #include <map>
+#include <vector>
 
 #include <cpPlugins/Interface/Config.h>
 #include <cpPlugins/Interface/Object.h>
@@ -60,6 +61,9 @@ namespace cpPlugins
       virtual unsigned int GetNumberOfInputs( ) const;
       virtual unsigned int GetNumberOfOutputs( ) const;
 
+      virtual std::vector< std::string > GetInputsNames( ) const;
+      virtual std::vector< std::string > GetOutputsNames( ) const;
+
       virtual void SetInput( const std::string& id, DataObject* dobj );
 
       virtual std::string Update( );