X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FQT%2FSimpleMPRWidget.cxx;h=42dd1cd724d3658dd851b0a577f810365c53e08f;hb=510ac31d52c1ac725baf278243c958e6c564b5b3;hp=c2382eda40c08f1c0905e4dd1772218e242fe5cb;hpb=a422d88602e9b49085ccfab0ef0f9f2d93fb6a1e;p=cpPlugins.git diff --git a/lib/cpExtensions/QT/SimpleMPRWidget.cxx b/lib/cpExtensions/QT/SimpleMPRWidget.cxx index c2382ed..42dd1cd 100644 --- a/lib/cpExtensions/QT/SimpleMPRWidget.cxx +++ b/lib/cpExtensions/QT/SimpleMPRWidget.cxx @@ -17,10 +17,10 @@ cpExtensions::QT::SimpleMPRWidget:: SimpleMPRWidget( QWidget* parent, Qt::WindowFlags f ) : Superclass( parent, f ), + Superclass2( ), m_UI( new Ui::SimpleMPRWidget ), m_MainImageName( "" ) { -/* this->m_UI->setupUi( this ); // Prepare default configuration @@ -55,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( @@ -71,11 +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( ) ) - ); -*/ } // ------------------------------------------------------------------------- @@ -169,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 @@ -182,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 ); @@ -193,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 ); @@ -202,7 +196,6 @@ Add( vtkDataSet* data, const std::string& name ) this->m_3DView->Add( pdata, name ); else success = false; -*/ return( success ); } @@ -224,6 +217,8 @@ GetViewProps( const std::string& name ) const if( w != NULL ) props.insert( w ); return( props ); */ + TProps props; + return( props ); } // ------------------------------------------------------------------------- @@ -349,125 +344,295 @@ GetWRenderWindow( ) const // ------------------------------------------------------------------------- void cpExtensions::QT::SimpleMPRWidget:: -GetScalarRange( double r[ 2 ] ) const +ResetCameras( ) { -// this->m_XImage->GetScalarRange( r ); + this->m_XImage->ResetCamera( ); + this->m_YImage->ResetCamera( ); + this->m_ZImage->ResetCamera( ); + this->m_3DView->ResetCamera( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::SimpleMPRWidget:: -GetWindowLevel( double wl[ 2 ] ) const +Render( ) { -// this->m_XImage->GetWindowLevel( wl ); + 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:: -GetImageOpacity( ) const +GetLevel( const std::string& name ) const { -// return( this->m_XImage->GetImageOpacity( ) ); + return( this->m_XImage->GetLevel( name ) ); } // ------------------------------------------------------------------------- -unsigned char cpExtensions::QT::SimpleMPRWidget:: -GetImageInterpolation( ) const +char cpExtensions::QT::SimpleMPRWidget:: +GetImageInterpolation( const std::string& name ) const { -// return( this->m_XImage->GetImageInterpolation( ) ); + 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:: +SetPointSize( const std::string& name, double s ) +{ + 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:: -_ConfigurationButton( ) +_SyncBottom( int a, int b ) { - auto dlg = new cpExtensions::QT::ConfigurationChooser( NULL ); - dlg->setData( this ); - dlg->exec( ); + 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