#include #include #include #include // ------------------------------------------------------------------------- cpExtensions::Visualization::MPRObjects* cpExtensions::Visualization::MPRObjects:: New( ) { return( new Self( ) ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::MPRObjects:: SetRenderWindows( vtkRenderWindow* wx, vtkRenderWindow* wy, vtkRenderWindow* wz, vtkRenderWindow* w3D ) { this->m_Windows[ 0 ] = wx; this->m_Windows[ 1 ] = wy; this->m_Windows[ 2 ] = wz; this->m_Windows[ 3 ] = w3D; // Prepare 2D renderers for( int i = 0; i < 4; ++i ) { if( this->m_Windows[ i ] == NULL ) { this->m_Renderers[ i ] = NULL; continue; } // fi // Create renderer, if render window exists this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( ); this->m_Renderers[ i ]->SetBackground( 0.1, 0.3, 0.8 ); this->m_Windows[ i ]->AddRenderer( this->m_Renderers[ i ] ); } // rof // Create 3D renderer if( this->m_Windows[ 3 ] != NULL ) this->m_Renderers[ 3 ]->SetBackground( 0.2, 0.2, 0.2 ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::MPRObjects:: AddImage( vtkImageData* image ) { this->m_MPRActors->AddInputData( image ); this->m_MPRActors->PushActorsInto( this->m_Windows[ 0 ], this->m_Windows[ 1 ], this->m_Windows[ 2 ], this->m_Windows[ 3 ] ); // First rendering if( this->m_MPRActors->GetNumberOfImages( ) == 1 ) { this->m_MPRActors->ResetSlices( ); this->ResetCameras( ); } // fi this->RenderAll( 1e-3 ); } // ------------------------------------------------------------------------- unsigned int cpExtensions::Visualization::MPRObjects:: GetNumberOfImages( ) const { return( this->m_MPRActors->GetNumberOfImages( ) ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::MPRObjects:: ClearAll( ) { this->m_MPRActors->PopActorsFrom( this->m_Windows[ 0 ], this->m_Windows[ 1 ], this->m_Windows[ 2 ], this->m_Windows[ 3 ] ); this->ResetCameras( ); this->RenderAll( 1e-3 ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::MPRObjects:: ResetCamera( const int& id ) { if( id < 4 ) if( this->m_Windows[ id ] != NULL ) this->m_Renderers[ id ]->ResetCamera( ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::MPRObjects:: ResetCameras( ) { for( int i = 0; i < 4; ++i ) if( this->m_Windows[ i ] != NULL ) this->m_Renderers[ i ]->ResetCamera( ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::MPRObjects:: 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( 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 } // ------------------------------------------------------------------------- vtkRenderer* cpExtensions::Visualization::MPRObjects:: GetXRenderer( ) { return( this->m_Renderers[ 0 ] ); } // ------------------------------------------------------------------------- vtkRenderer* cpExtensions::Visualization::MPRObjects:: GetYRenderer( ) { return( this->m_Renderers[ 1 ] ); } // ------------------------------------------------------------------------- vtkRenderer* cpExtensions::Visualization::MPRObjects:: GetZRenderer( ) { return( this->m_Renderers[ 2 ] ); } // ------------------------------------------------------------------------- vtkRenderer* cpExtensions::Visualization::MPRObjects:: Get3DRenderer( ) { return( this->m_Renderers[ 3 ] ); } // ------------------------------------------------------------------------- const vtkRenderer* cpExtensions::Visualization::MPRObjects:: GetXRenderer( ) const { return( this->m_Renderers[ 0 ] ); } // ------------------------------------------------------------------------- const vtkRenderer* cpExtensions::Visualization::MPRObjects:: GetYRenderer( ) const { return( this->m_Renderers[ 1 ] ); } // ------------------------------------------------------------------------- const vtkRenderer* cpExtensions::Visualization::MPRObjects:: GetZRenderer( ) const { return( this->m_Renderers[ 2 ] ); } // ------------------------------------------------------------------------- const vtkRenderer* cpExtensions::Visualization::MPRObjects:: Get3DRenderer( ) const { return( this->m_Renderers[ 3 ] ); } // ------------------------------------------------------------------------- cpExtensions::Visualization:: MPRActors* cpExtensions::Visualization::MPRObjects:: GetMPRActors( ) { return( this->m_MPRActors ); } // ------------------------------------------------------------------------- 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< MPRActors >::New( ); } // ------------------------------------------------------------------------- cpExtensions::Visualization::MPRObjects:: ~MPRObjects( ) { } // eof - $RCSfile$