]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/QT/SimpleMPRWidget.cxx
...
[cpPlugins.git] / lib / cpExtensions / QT / SimpleMPRWidget.cxx
index 95af5ab535561df63f344f260f3bb4e2dec80da6..4ccd631f7d31ec4b704392312c600fca77fea032 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( "" )
 {
@@ -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( ) )
-    );
 }
 
 // -------------------------------------------------------------------------
@@ -180,7 +177,6 @@ bool cpExtensions::QT::SimpleMPRWidget::
 Add( vtkDataSet* data, const std::string& name )
 {
   bool success = true;
-/*
   auto image = dynamic_cast< vtkImageData* >( data );
   auto pdata = dynamic_cast< vtkPolyData* >( data );
 
@@ -191,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 );
@@ -200,7 +196,6 @@ Add( vtkDataSet* data, const std::string& name )
     this->m_3DView->Add( pdata, name );
   else
     success = false;
-*/
   return( success );
 }
 
@@ -222,6 +217,8 @@ GetViewProps( const std::string& name ) const
   if( w != NULL ) props.insert( w );
   return( props );
 */
+  TProps props;
+  return( props );
 }
 
 // -------------------------------------------------------------------------
@@ -347,125 +344,283 @@ 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< 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( r );
+  this->m_XImage->GetScalarRange( name, r );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-GetWindowLevel( double wl[ 2 ] ) const
+GetWindowLevel( const std::string& name, double wl[ 2 ] ) const
 {
-//  this->m_XImage->GetWindowLevel( wl );
+  this->m_XImage->GetWindowLevel( name, wl );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::QT::SimpleMPRWidget::
-GetImageOpacity( ) const
+GetWindow( const std::string& name ) const
 {
-//  return( this->m_XImage->GetImageOpacity( ) );
+  return( this->m_XImage->GetWindow( name ) );
 }
 
 // -------------------------------------------------------------------------
-unsigned char cpExtensions::QT::SimpleMPRWidget::
-GetImageInterpolation( ) const
+double cpExtensions::QT::SimpleMPRWidget::
+GetLevel( const std::string& name ) const
 {
-//  return( this->m_XImage->GetImageInterpolation( ) );
+  return( this->m_XImage->GetLevel( name ) );
+}
+
+// -------------------------------------------------------------------------
+char cpExtensions::QT::SimpleMPRWidget::
+GetImageInterpolation( const std::string& name ) const
+{
+  return( this->m_XImage->GetImageInterpolation( name ) );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
-SetScalarRange( double r[ 2 ] )
+GetColor( const std::string& name, double& r, double& g, double& b ) const
 {
-/*
-  this->m_XImage->SetScalarRange( r );
-  this->m_YImage->SetScalarRange( r );
-  this->m_ZImage->SetScalarRange( r );
-  this->m_3DView->SetScalarRange( r );
-*/
+  this->m_XImage->GetColor( name, r, g, b );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::SimpleMPRWidget::
+GetOpacity( const std::string& name ) const
+{
+  return( this->m_XImage->GetOpacity( name ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::SimpleMPRWidget::
+GetPointSize( const std::string& name ) const
+{
+  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::
-SetWindowLevel( double wl[ 2 ] )
+SetScalarRange( const std::string& name, double r[ 2 ] )
 {
-/*
-  this->m_XImage->SetWindowLevel( wl );
-  this->m_YImage->SetWindowLevel( wl );
-  this->m_ZImage->SetWindowLevel( wl );
-  this->m_3DView->SetWindowLevel( wl );
-*/
+  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::
-SetImageOpacity( double o )
+SetScalarRange( const std::string& name, double min, double max )
 {
-/*
-  this->m_XImage->SetImageOpacity( o );
-  this->m_YImage->SetImageOpacity( o );
-  this->m_ZImage->SetImageOpacity( o );
-  this->m_3DView->SetImageOpacity( o );
-*/
+  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::
-SetImageInterpolation( unsigned char i )
+SetWindowLevel( const std::string& name, double wl[ 2 ] )
 {
-  /*
-  this->m_XImage->SetImageInterpolation( i );
-  this->m_YImage->SetImageInterpolation( i );
-  this->m_ZImage->SetImageInterpolation( i );
-  this->m_3DView->SetImageInterpolation( i );
-*/
+  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::
-ResetCameras( )
+SetWindowLevel( const std::string& name, double w, double l )
 {
-/*
-  this->m_XImage->ResetCamera( );
-  this->m_YImage->ResetCamera( );
-  this->m_ZImage->ResetCamera( );
-  this->m_3DView->ResetCamera( );
-*/
+  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::
-Render( )
+SetWindow( const std::string& name, double w )
 {
-/*
-  this->m_XImage->Render( );
-  this->m_YImage->Render( );
-  this->m_ZImage->Render( );
-  this->m_3DView->Render( );
-*/
+  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::
-_SyncBottom( int a, int b )
+SetLevel( const std::string& name, double l )
 {
-  this->m_UI->Bottom->setSizes( this->m_UI->Top->sizes( ) );
+  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::
-_SyncTop( int a, int b )
+SetImageInterpolation( const std::string& name, char i )
 {
-  this->m_UI->Top->setSizes( this->m_UI->Bottom->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::
+SetColor( const std::string& name, double r, double g, double b )
+{
+  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