X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FMPRObjects.cxx;h=2a50c62a9fb1f68307b9d9f106620422761c1bec;hb=fdd4f2cec18107de380ebd350cb1019eed7c294c;hp=0076ad5334b6b4cfb1d071a0e4e79e19bace8f72;hpb=dba64a6906e88d6023b2e6c9632da9fd41bfeb53;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/MPRObjects.cxx b/lib/cpExtensions/Visualization/MPRObjects.cxx index 0076ad5..2a50c62 100644 --- a/lib/cpExtensions/Visualization/MPRObjects.cxx +++ b/lib/cpExtensions/Visualization/MPRObjects.cxx @@ -48,104 +48,36 @@ SetRenderWindows( // ------------------------------------------------------------------------- void cpExtensions::Visualization::MPRObjects:: -SetImage( vtkImageData* image ) +AddImage( vtkImageData* image ) { this->m_MPRActors->AddInputData( image ); - this->m_MPRActors->PushDataInto( - this->m_Renderers[ 0 ], - this->m_Renderers[ 1 ], - this->m_Renderers[ 2 ], - this->m_Renderers[ 3 ] + this->m_MPRActors->PushActorsInto( + this->m_Windows[ 0 ], + this->m_Windows[ 1 ], + this->m_Windows[ 2 ], + this->m_Windows[ 3 ] ); // First rendering - this->m_MPRActors->ResetSlices( ); - this->ResetCameras( ); - this->RenderAll( ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::MPRObjects:: -AddAuxiliaryImage( vtkImageData* image ) -{ - // Try to add new image - int id = this->m_MPRActors->AddInputData( image ); - if( id < 0 ) - return; - - // Push everything on renderers - this->m_MPRActors->PushDataInto( - this->m_Renderers[ 0 ], - this->m_Renderers[ 1 ], - this->m_Renderers[ 2 ], - this->m_Renderers[ 3 ] - ); + if( this->m_MPRActors->GetNumberOfImages( ) == 1 ) + { + this->m_MPRActors->ResetSlices( ); + this->ResetCameras( ); - // Rendering + } // fi this->RenderAll( ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::MPRObjects:: -ActivateInteractors( ) +ClearAll( ) { - // Prepare renderers - for( int i = 0; i < 3; ++i ) - { - // Check prerrequisites - if( this->m_Windows[ i ] == NULL || this->m_Renderers[ i ] == NULL ) - { - // TODO: this->m_Styles[ i ] = NULL; - continue; - - } // fi - - ImageSliceActors* actors = this->m_MPRActors->GetSliceActors( i ); - if( actors == NULL ) - { - // TODO: this->m_Styles[ i ] = NULL; - continue; - - } // fi - - /* TODO - this->m_Styles[ i ] = vtkSmartPointer< TStyle >::New( ); - this->m_Styles[ i ]->Configure( actors, this->m_MPRActors ); - this->m_Styles[ i ]-> - SetInteractor( this->m_Windows[ i ]->GetInteractor( ), i ); - this->m_Styles[ i ]->SetModeToNavigation( ); - */ - - } // rof - - // Synch 2D and 3D renderers - for( int i = 0; i < 3; ++i ) - { - for( int j = 0; j < 3; ++j ) - { - /* TODO - if( - this->m_Windows[ i ] != NULL && - this->m_Windows[ j ] != NULL && - i != j - ) - this->m_Styles[ i ]-> - AssociateInteractor( this->m_Windows[ j ]->GetInteractor( ) ); - */ - - } // rof - /* TODO - if( this->m_Windows[ 3 ] != NULL ) - this->m_Styles[ i ]-> - AssociateInteractor( this->m_Windows[ 3 ]->GetInteractor( ) ); - */ - - } // rof - - // Finish interactor linking - this->m_MPRActors->LinkInteractors( ); - - // Restart rendering + this->m_MPRActors->PopActorsFrom( + this->m_Windows[ 0 ], + this->m_Windows[ 1 ], + this->m_Windows[ 2 ], + this->m_Windows[ 3 ] + ); this->ResetCameras( ); this->RenderAll( ); } @@ -243,28 +175,42 @@ Get3DRenderer( ) const } // ------------------------------------------------------------------------- -cpExtensions::Visualization::MPRObjects:: -TMPRActors* cpExtensions::Visualization::MPRObjects:: +cpExtensions::Visualization:: +MPRActors* cpExtensions::Visualization::MPRObjects:: GetMPRActors( ) { return( this->m_MPRActors ); } // ------------------------------------------------------------------------- -const cpExtensions::Visualization::MPRObjects:: -TMPRActors* cpExtensions::Visualization::MPRObjects:: +const cpExtensions::Visualization:: +MPRActors* cpExtensions::Visualization::MPRObjects:: GetMPRActors( ) const { return( this->m_MPRActors ); } +// ------------------------------------------------------------------------- +double cpExtensions::Visualization::MPRObjects:: +GetWindow( ) const +{ + return( this->m_MPRActors->GetWindow( ) ); +} + +// ------------------------------------------------------------------------- +double cpExtensions::Visualization::MPRObjects:: +GetLevel( ) const +{ + return( this->m_MPRActors->GetLevel( ) ); +} + // ------------------------------------------------------------------------- cpExtensions::Visualization::MPRObjects:: MPRObjects( ) : vtkObject( ) { // Prepare actors - this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( ); + this->m_MPRActors = vtkSmartPointer< MPRActors >::New( ); } // -------------------------------------------------------------------------