X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FQT%2FMPR3DWidget.cxx;fp=lib%2FcpExtensions%2FQT%2FMPR3DWidget.cxx;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=f86992dfc21fd27ed61137544afc99b17c7ab510;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/cpExtensions/QT/MPR3DWidget.cxx b/lib/cpExtensions/QT/MPR3DWidget.cxx deleted file mode 100644 index f86992d..0000000 --- a/lib/cpExtensions/QT/MPR3DWidget.cxx +++ /dev/null @@ -1,140 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -// ------------------------------------------------------------------------- -cpExtensions::QT::MPR3DWidget:: -MPR3DWidget( QWidget* parent, Qt::WindowFlags f ) - : Superclass( parent, f ), - m_ImageName( "" ) -{ -} - -// ------------------------------------------------------------------------- -cpExtensions::QT::MPR3DWidget:: -~MPR3DWidget( ) -{ - for( auto a = this->m_Actors.begin( ); a != this->m_Actors.end( ); ++a ) - delete *a; - this->m_Actors.clear( ); -} - -// ------------------------------------------------------------------------- -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 -} - -// ------------------------------------------------------------------------- -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 ) - { - /* TODO - if( this->m_ImageName != "" ) - { - } - else - this->SetImage( image, name ); - */ - } - else if( pdata != NULL ) - { - TActor* actor = new TActor( ); - actor->SetMesh( pdata ); - this->m_Actors.push_back( actor ); - this->AddViewProp( actor->GetActor( ), name ); - this->Render( ); - if( this->m_ImageName == "" ) - this->ResetCamera( ); - - } // fi -} - -// ------------------------------------------------------------------------- -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( ); -} - -// eof - $RCSfile$