#include #ifdef cpExtensions_QT4 #include #include #include #include /* TODO #include #include #include #include */ // ------------------------------------------------------------------------- cpExtensions::QT::MPR3DWidget:: MPR3DWidget( QWidget* parent, Qt::WindowFlags f ) : Superclass( parent, f ), m_ImageName( "" ) { /* TODO this->m_Actors = vtkSmartPointer< cpExtensions::Visualization::MPR3DActors >::New( ); */ } // ------------------------------------------------------------------------- cpExtensions::QT::MPR3DWidget:: ~MPR3DWidget( ) { } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: Clear( ) { this->RemoveViewProps( ); this->m_ImageName = ""; } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetImage( vtkImageData* image, const std::string& name ) { if( name == "" ) return; if( this->m_ImageName != "" ) this->Clear( ); this->m_ImageName = name; for( unsigned int o = 0; o < 3; ++o ) { this->m_WLActors[ o ] = vtkSmartPointer< TWLActor >::New( ); this->m_WLActors[ o ]->SetImage( image ); this->m_WLActors[ o ]->SetOrientation( o ); this->m_OLActors[ o ] = vtkSmartPointer< TOLActor >::New( ); this->m_OLActors[ o ]->SetBounds( o, image->GetBounds( )[ o << 1 ], image->GetBounds( ) ); this->AddViewProp( this->m_WLActors[ o ], this->m_ImageName ); this->AddAuxViewProp( this->m_OLActors[ o ], this->m_ImageName ); this->ResetCamera( ); } // rof } // ------------------------------------------------------------------------- cpExtensions::QT::MPR3DWidget:: TWLActor* cpExtensions::QT::MPR3DWidget:: GetImageActor( int o ) { return( this->m_WLActors[ o % 3 ] ); } // ------------------------------------------------------------------------- const cpExtensions::QT::MPR3DWidget:: TWLActor* cpExtensions::QT::MPR3DWidget:: GetImageActor( int o ) const { return( this->m_WLActors[ o % 3 ] ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetSliceNumber( int orientation, int slice ) { int o = orientation % 3; this->m_WLActors[ o ]->SetSliceNumber( slice ); this->m_OLActors[ o ]->SetBounds( o, this->m_WLActors[ o ]->GetSlicePlane( )->GetOrigin( )[ o ], this->m_WLActors[ o ]->GetImage( )->GetBounds( ) ); this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetSlicesNumbers( int x, int y, int z ) { int s[] = { x, y, z }; for( int o = 0; o < 3; ++o ) { this->m_WLActors[ o ]->SetSliceNumber( s[ o ] ); this->m_OLActors[ o ]->SetBounds( o, this->m_WLActors[ o ]->GetSlicePlane( )->GetOrigin( )[ o ], this->m_WLActors[ o ]->GetImage( )->GetBounds( ) ); } // rof this->Render( ); } // ------------------------------------------------------------------------- /* void cpExtensions::QT::MPR3DWidget:: SetImage( vtkImageData* image, const std::string& name ) { if( this->m_ImageName != "" ) { // TODO: Clear visualization } // fi this->m_Actors->SetImage( image ); this->m_ImageName = name; vtkSmartPointer< vtkPropCollection > props = vtkSmartPointer< vtkPropCollection >::New( ); props->AddItem( this->m_Actors->GetWindowLevelImageActor( 0 ) ); props->AddItem( this->m_Actors->GetWindowLevelImageActor( 1 ) ); props->AddItem( this->m_Actors->GetWindowLevelImageActor( 2 ) ); this->AddViewProps( props, name ); this->AddAuxViewProp( this->m_Actors->GetImageOutlineActor( 0 ), name ); this->AddAuxViewProp( this->m_Actors->GetImageOutlineActor( 1 ), name ); this->AddAuxViewProp( this->m_Actors->GetImageOutlineActor( 2 ), name ); this->ResetCamera( ); this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: Add( vtkDataSet* data, const std::string& name ) { auto image = dynamic_cast< vtkImageData* >( data ); auto pdata = dynamic_cast< vtkPolyData* >( data ); if( image != NULL ) { if( this->m_ImageName != "" ) { } else this->SetImage( image, name ); } else if( pdata != NULL ) { this->AddViewProp( this->m_Actors->AddMesh( pdata ), name ); this->Render( ); if( this->m_ImageName == "" ) this->ResetCamera( ); } // fi return; auto image = dynamic_cast< vtkImageData* >( data ); auto pdata = dynamic_cast< vtkPolyData* >( data ); if( image != NULL ) { this->m_Actors->AddLUTImage( image ); vtkSmartPointer< vtkPropCollection > coll = vtkSmartPointer< vtkPropCollection >::New( ); coll->AddItem( this->m_Actors->GetLUTImageActor( 0 ) ); coll->AddItem( this->m_Actors->GetLUTImageActor( 1 ) ); coll->AddItem( this->m_Actors->GetLUTImageActor( 2 ) ); this->AddViewProps( coll, name ); this->Render( ); } else if( pdata != NULL ) { } // fi } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetSliceNumber( int orientation, int slice ) { this->m_Actors->SetSliceNumber( orientation, slice ); this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetSlicesNumbers( int x, int y, int z ) { this->m_Actors->SetSliceNumber( 0, x ); this->m_Actors->SetSliceNumber( 1, y ); this->m_Actors->SetSliceNumber( 2, z ); this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetScalarRange( double r[ 2 ] ) { this->m_Actors->SetScalarRange( r ); this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetWindowLevel( double wl[ 2 ] ) { this->m_Actors->SetWindowLevel( wl ); this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetImageOpacity( double o ) { this->m_Actors->SetImageOpacity( o ); this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetImageInterpolation( unsigned char i ) { this->m_Actors->SetImageInterpolation( i ); this->Render( ); } */ #endif // cpExtensions_QT4 // eof - $RCSfile$