]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/QT/SimpleMPRWidget.cxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpExtensions / QT / SimpleMPRWidget.cxx
index 53fcb7f4abd5351ba4f941bbe273d173ff264db4..42dd1cd724d3658dd851b0a577f810365c53e08f 100644 (file)
@@ -17,6 +17,7 @@
 cpExtensions::QT::SimpleMPRWidget::
 SimpleMPRWidget( QWidget* parent, Qt::WindowFlags f )
   : Superclass( parent, f ),
+    Superclass2( ),
     m_UI( new Ui::SimpleMPRWidget ),
     m_MainImageName( "" )
 {
@@ -54,12 +55,12 @@ SimpleMPRWidget( QWidget* parent, Qt::WindowFlags f )
   cmd->AddWidget( this->m_YImage );
   cmd->AddWidget( this->m_ZImage );
   cmd->AddWidget( this->m_3DView );
-  this->m_XImage->GetInteractorStyle( )->AddObserver( ev1, cmd );
-  this->m_YImage->GetInteractorStyle( )->AddObserver( ev1, cmd );
-  this->m_ZImage->GetInteractorStyle( )->AddObserver( ev1, cmd );
-  this->m_XImage->GetInteractorStyle( )->AddObserver( ev2, cmd );
-  this->m_YImage->GetInteractorStyle( )->AddObserver( ev2, cmd );
-  this->m_ZImage->GetInteractorStyle( )->AddObserver( ev2, cmd );
+  this->m_XImage->GetStyle( )->AddObserver( ev1, cmd );
+  this->m_YImage->GetStyle( )->AddObserver( ev1, cmd );
+  this->m_ZImage->GetStyle( )->AddObserver( ev1, cmd );
+  this->m_XImage->GetStyle( )->AddObserver( ev2, cmd );
+  this->m_YImage->GetStyle( )->AddObserver( ev2, cmd );
+  this->m_ZImage->GetStyle( )->AddObserver( ev2, cmd );
 
   // Connect slots
   this->connect(
@@ -70,10 +71,6 @@ SimpleMPRWidget( QWidget* parent, Qt::WindowFlags f )
     this->m_UI->Bottom, SIGNAL( splitterMoved( int, int ) ),
     this, SLOT( _SyncTop( int, int ) )
     );
-  this->connect(
-    this->m_UI->ConfigurationButton, SIGNAL( clicked( ) ),
-    this, SLOT( _ConfigurationButton( ) )
-    );
 }
 
 // -------------------------------------------------------------------------
@@ -167,9 +164,9 @@ SetImage( vtkImageData* image, const std::string& name )
 
   if( this->m_MainImage != NULL && this->m_MainImageName != "" )
   {
-    this->m_XImage->SetImage( this->m_MainImage, 0, name );
-    this->m_YImage->SetImage( this->m_MainImage, 1, name );
-    this->m_ZImage->SetImage( this->m_MainImage, 2, name );
+    this->m_XImage->SetImage( this->m_MainImage, name, 0 );
+    this->m_YImage->SetImage( this->m_MainImage, name, 1 );
+    this->m_ZImage->SetImage( this->m_MainImage, name, 2 );
     this->m_3DView->SetImage( this->m_MainImage, name );
 
   } // fi
@@ -190,7 +187,7 @@ Add( vtkDataSet* data, const std::string& name )
       this->m_XImage->Add( image, name );
       this->m_YImage->Add( image, name );
       this->m_ZImage->Add( image, name );
-      this->m_3DView->Add( image, name );
+      // TODO: this->m_3DView->Add( image, name );
     }
     else
       this->SetImage( image, name );
@@ -207,6 +204,7 @@ cpExtensions::QT::SimpleMPRWidget::
 TProps cpExtensions::QT::SimpleMPRWidget::
 GetViewProps( const std::string& name ) const
 {
+/*
   auto x = this->m_XImage->GetViewProps( name );
   auto y = this->m_YImage->GetViewProps( name );
   auto z = this->m_ZImage->GetViewProps( name );
@@ -218,6 +216,9 @@ GetViewProps( const std::string& name ) const
   if( z != NULL ) props.insert( z );
   if( w != NULL ) props.insert( w );
   return( props );
+*/
+  TProps props;
+  return( props );
 }
 
 // -------------------------------------------------------------------------
@@ -343,101 +344,295 @@ GetWRenderWindow( ) const
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-GetScalarRange( double r[ 2 ] ) const
+ResetCameras( )
+{
+  this->m_XImage->ResetCamera( );
+  this->m_YImage->ResetCamera( );
+  this->m_ZImage->ResetCamera( );
+  this->m_3DView->ResetCamera( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+Render( )
+{
+  this->m_XImage->Render( );
+  this->m_YImage->Render( );
+  this->m_ZImage->Render( );
+  this->m_3DView->Render( );
+}
+
+// -------------------------------------------------------------------------
+std::set< vtkRenderWindowInteractor* > cpExtensions::QT::SimpleMPRWidget::
+GetInteractors( ) const
+{
+  std::set< vtkRenderWindowInteractor* > ret;
+  ret.insert( this->m_XImage->GetInteractor( ) );
+  ret.insert( this->m_YImage->GetInteractor( ) );
+  ret.insert( this->m_ZImage->GetInteractor( ) );
+  ret.insert( this->m_3DView->GetInteractor( ) );
+  return( ret );
+}
+
+// -------------------------------------------------------------------------
+std::set< std::string > cpExtensions::QT::SimpleMPRWidget::
+GetActorsNames( ) const
+{
+  std::set< std::string > names = this->m_XImage->GetActorsNames( );
+  std::set< std::string > y = this->m_YImage->GetActorsNames( );
+  std::set< std::string > z = this->m_ZImage->GetActorsNames( );
+  std::set< std::string > w = this->m_3DView->GetActorsNames( );
+  names.insert( y.begin( ), y.end( ) );
+  names.insert( z.begin( ), z.end( ) );
+  names.insert( w.begin( ), w.end( ) );
+  return( names );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::SimpleMPRWidget::
+IsWindowLevelImageActor( const std::string& name ) const
+{
+  return( this->m_XImage->IsWindowLevelImageActor( name ) );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::SimpleMPRWidget::
+IsLUTImageActor( const std::string& name ) const
+{
+  return( this->m_XImage->IsLUTImageActor( name ) );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::SimpleMPRWidget::
+Is3DActor( const std::string& name ) const
+{
+  return(
+    this->m_XImage->Is3DActor( name ) || this->m_3DView->Is3DActor( name )
+    );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+GetScalarRange( const std::string& name, double r[ 2 ] ) const
+{
+  this->m_XImage->GetScalarRange( name, r );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+GetWindowLevel( const std::string& name, double wl[ 2 ] ) const
+{
+  this->m_XImage->GetWindowLevel( name, wl );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::SimpleMPRWidget::
+GetWindow( const std::string& name ) const
+{
+  return( this->m_XImage->GetWindow( name ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::SimpleMPRWidget::
+GetLevel( const std::string& name ) const
+{
+  return( this->m_XImage->GetLevel( name ) );
+}
+
+// -------------------------------------------------------------------------
+char cpExtensions::QT::SimpleMPRWidget::
+GetImageInterpolation( const std::string& name ) const
 {
-  this->m_XImage->GetScalarRange( r );
+  return( this->m_XImage->GetImageInterpolation( name ) );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-GetWindowLevel( double wl[ 2 ] ) const
+GetColor( const std::string& name, double& r, double& g, double& b ) const
 {
-  this->m_XImage->GetWindowLevel( wl );
+  this->m_XImage->GetColor( name, r, g, b );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::QT::SimpleMPRWidget::
-GetImageOpacity( ) const
+GetOpacity( const std::string& name ) const
 {
-  return( this->m_XImage->GetImageOpacity( ) );
+  return( this->m_XImage->GetOpacity( name ) );
 }
 
 // -------------------------------------------------------------------------
-unsigned char cpExtensions::QT::SimpleMPRWidget::
-GetImageInterpolation( ) const
+double cpExtensions::QT::SimpleMPRWidget::
+GetPointSize( const std::string& name ) const
 {
-  return( this->m_XImage->GetImageInterpolation( ) );
+  return( this->m_XImage->GetPointSize( name ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::SimpleMPRWidget::
+GetLineWidth( const std::string& name ) const
+{
+  return( this->m_XImage->GetLineWidth( name ) );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::QT::SimpleMPRWidget::
+GetRepresentation( const std::string& name ) const
+{
+  return( this->m_XImage->GetRepresentation( name ) );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-SetScalarRange( double r[ 2 ] )
+SetScalarRange( const std::string& name, double r[ 2 ] )
 {
+  this->m_XImage->SetScalarRange( name, r );
+  this->m_YImage->SetScalarRange( name, r );
+  this->m_ZImage->SetScalarRange( name, r );
+  this->m_3DView->SetScalarRange( name, r );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-SetWindowLevel( double wl[ 2 ] )
+SetScalarRange( const std::string& name, double min, double max )
 {
+  this->m_XImage->SetScalarRange( name, min, max );
+  this->m_YImage->SetScalarRange( name, min, max );
+  this->m_ZImage->SetScalarRange( name, min, max );
+  this->m_3DView->SetScalarRange( name, min, max );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-SetImageOpacity( double o )
+SetWindowLevel( const std::string& name, double wl[ 2 ] )
 {
-  this->m_XImage->SetImageOpacity( o );
-  this->m_YImage->SetImageOpacity( o );
-  this->m_ZImage->SetImageOpacity( o );
-  this->m_3DView->SetImageOpacity( o );
+  this->m_XImage->SetWindowLevel( name, wl );
+  this->m_YImage->SetWindowLevel( name, wl );
+  this->m_ZImage->SetWindowLevel( name, wl );
+  this->m_3DView->SetWindowLevel( name, wl );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-SetImageInterpolation( unsigned char i )
+SetWindowLevel( const std::string& name, double w, double l )
 {
+  this->m_XImage->SetWindowLevel( name, w, l );
+  this->m_YImage->SetWindowLevel( name, w, l );
+  this->m_ZImage->SetWindowLevel( name, w, l );
+  this->m_3DView->SetWindowLevel( name, w, l );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-ResetCameras( )
+SetWindow( const std::string& name, double w )
 {
-  this->m_XImage->ResetCamera( );
-  this->m_YImage->ResetCamera( );
-  this->m_ZImage->ResetCamera( );
-  this->m_3DView->ResetCamera( );
+  this->m_XImage->SetWindow( name, w );
+  this->m_YImage->SetWindow( name, w );
+  this->m_ZImage->SetWindow( name, w );
+  this->m_3DView->SetWindow( name, w );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-Render( )
+SetLevel( const std::string& name, double l )
 {
-  this->m_XImage->Render( );
-  this->m_YImage->Render( );
-  this->m_ZImage->Render( );
-  this->m_3DView->Render( );
+  this->m_XImage->SetLevel( name, l );
+  this->m_YImage->SetLevel( name, l );
+  this->m_ZImage->SetLevel( name, l );
+  this->m_3DView->SetLevel( name, l );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-_SyncBottom( int a, int b )
+SetImageInterpolation( const std::string& name, char i )
 {
-  this->m_UI->Bottom->setSizes( this->m_UI->Top->sizes( ) );
+  this->m_XImage->SetImageInterpolation( name, i );
+  this->m_YImage->SetImageInterpolation( name, i );
+  this->m_ZImage->SetImageInterpolation( name, i );
+  this->m_3DView->SetImageInterpolation( name, i );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-_SyncTop( int a, int b )
+SetColor( const std::string& name, double r, double g, double b )
 {
-  this->m_UI->Top->setSizes( this->m_UI->Bottom->sizes( ) );
+  this->m_XImage->SetColor( name, r, g, b );
+  this->m_YImage->SetColor( name, r, g, b );
+  this->m_ZImage->SetColor( name, r, g, b );
+  this->m_3DView->SetColor( name, r, g, b );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetOpacity( const std::string& name, double o )
+{
+  this->m_XImage->SetOpacity( name, o );
+  this->m_YImage->SetOpacity( name, o );
+  this->m_ZImage->SetOpacity( name, o );
+  this->m_3DView->SetOpacity( name, o );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-_ConfigurationButton( )
+SetPointSize( const std::string& name, double s )
 {
-  auto dlg = new cpExtensions::QT::ConfigurationChooser( NULL );
-  dlg->setData( this );
-  dlg->exec( );
+  this->m_XImage->SetPointSize( name, s );
+  this->m_YImage->SetPointSize( name, s );
+  this->m_ZImage->SetPointSize( name, s );
+  this->m_3DView->SetPointSize( name, s );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetLineWidth( const std::string& name, double w )
+{
+  this->m_XImage->SetLineWidth( name, w );
+  this->m_YImage->SetLineWidth( name, w );
+  this->m_ZImage->SetLineWidth( name, w );
+  this->m_3DView->SetLineWidth( name, w );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetRepresentationToPoints( const std::string& name )
+{
+  this->m_XImage->SetRepresentationToPoints( name );
+  this->m_YImage->SetRepresentationToPoints( name );
+  this->m_ZImage->SetRepresentationToPoints( name );
+  this->m_3DView->SetRepresentationToPoints( name );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetRepresentationToSurface( const std::string& name )
+{
+  this->m_XImage->SetRepresentationToSurface( name );
+  this->m_YImage->SetRepresentationToSurface( name );
+  this->m_ZImage->SetRepresentationToSurface( name );
+  this->m_3DView->SetRepresentationToSurface( name );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetRepresentationToWireframe( const std::string& name )
+{
+  this->m_XImage->SetRepresentationToWireframe( name );
+  this->m_YImage->SetRepresentationToWireframe( name );
+  this->m_ZImage->SetRepresentationToWireframe( name );
+  this->m_3DView->SetRepresentationToWireframe( name );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+_SyncBottom( int a, int b )
+{
+  this->m_UI->Bottom->setSizes( this->m_UI->Top->sizes( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+_SyncTop( int a, int b )
+{
+  this->m_UI->Top->setSizes( this->m_UI->Bottom->sizes( ) );
 }
 
 #endif // cpExtensions_QT4