#include #ifdef cpExtensions_QT4 #include #include /* TODO #include #include double cpExtensions::QT::SimpleMPRWidget:: cm_Colors[ 8 ][ 3 ] = { { 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0 }, { 0.0, 1.0, 1.0 }, { 1.0, 0.0, 1.0 }, { 1.0, 1.0, 0.0 }, { 1.0, 0.5, 0.0 }, { 1.0, 0.0, 0.5 } }; */ // ------------------------------------------------------------------------- cpExtensions::QT::SimpleMPRWidget:: SimpleMPRWidget( QWidget* parent ) : QWidget( parent ), m_UI( new Ui::SimpleMPRWidget ) /* , m_MainImage( "" ) */ { this->m_UI->setupUi( this ); // Configure VTK widgets this->m_VTK[ 0 ] = this->m_UI->VTK01; this->m_VTK[ 1 ] = this->m_UI->VTK00; this->m_VTK[ 2 ] = this->m_UI->VTK10; this->m_VTK[ 3 ] = this->m_UI->VTK11; for( unsigned int i = 0; i < 4; ++i ) { this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( ); this->m_VTK[ i ]->GetRenderWindow( )->AddRenderer( this->m_Renderers[ i ] ); } // rof /* this->m_MPRObjects = vtkSmartPointer< TMPRObjects >::New( ); this->m_MPRObjects->SetRenderWindows( this->m_VTK[ 0 ]->GetRenderWindow( ), this->m_VTK[ 1 ]->GetRenderWindow( ), this->m_VTK[ 2 ]->GetRenderWindow( ), this->m_VTK[ 3 ]->GetRenderWindow( ) ); */ // Connect slots QObject::connect( this->m_UI->TopSplitter, SIGNAL( splitterMoved( int, int ) ), this, SLOT( _SyncBottom( int, int ) ) ); QObject::connect( this->m_UI->BottomSplitter, SIGNAL( splitterMoved( int, int ) ), this, SLOT( _SyncTop( int, int ) ) ); } // ------------------------------------------------------------------------- cpExtensions::QT::SimpleMPRWidget:: ~SimpleMPRWidget( ) { delete this->m_UI; } // ------------------------------------------------------------------------- void cpExtensions::QT::SimpleMPRWidget:: SetMainImage( vtkImageData* image ) { for( unsigned int i = 0; i < 3; ++i ) { this->m_2DSlices[ i ] = vtkSmartPointer< TActors >::New( ); this->m_2DSlices[ i ]->SetInputData( image, i ); this->m_2DSlices[ i ]->PushInto( this->m_Renderers[ i ] ); this->m_VTK[ i ]->GetRenderWindow( )->GetInteractor( )-> SetInteractorStyle( this->m_2DSlices[ i ]->GetStyle( ) ); this->m_3DSlices[ i ] = vtkSmartPointer< TActors >::New( ); this->m_3DSlices[ i ]->SetInputData( image, i ); this->m_3DSlices[ i ]->PushInto( this->m_Renderers[ 3 ] ); this->m_3DSlices[ i ]->SetStyle( dynamic_cast< vtkInteractorStyle* >( this->m_Renderers[ 3 ]->GetRenderWindow( )-> GetInteractor( )->GetInteractorStyle( ) ) ); } // rof for( unsigned int i = 0; i < 3; ++i ) { for( unsigned int j = 0; j < 3; ++j ) { if( i != j ) this->m_2DSlices[ i ]->AssociateSlice( this->m_2DSlices[ j ] ); this->m_2DSlices[ i ]->AssociateSlice( this->m_3DSlices[ j ] ); } // rof } // rof for( unsigned int i = 0; i < 3; ++i ) { this->m_2DSlices[ i ]->GetStyle( )-> SetCurrentRenderer( this->m_Renderers[ i ] ); this->m_Renderers[ i ]->ResetCamera( ); this->m_VTK[ i ]->GetRenderWindow( )->Render( ); } // rof this->m_Renderers[ 3 ]->ResetCamera( ); this->m_VTK[ 3 ]->GetRenderWindow( )->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::SimpleMPRWidget:: _SyncBottom( int a, int b ) { this->m_UI->BottomSplitter->setSizes( this->m_UI->TopSplitter->sizes( ) ); } // ------------------------------------------------------------------------- void cpExtensions::QT::SimpleMPRWidget:: _SyncTop( int a, int b ) { this->m_UI->TopSplitter->setSizes( this->m_UI->BottomSplitter->sizes( ) ); } #endif // cpExtensions_QT4 // eof - $RCSfile$