X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FQT%2FImageWidget.cxx;h=bac5f17ffbde3a14fcddd08095cc4ff544f70448;hb=5cbe75ae1fb27d18932b6278f97c4a865cddd592;hp=35557f5a9ee99330d34ffacfddfa260167d92c4f;hpb=f6e163be0bf2ffeb19239bb31c1df936017cdc8e;p=cpPlugins.git diff --git a/lib/cpExtensions/QT/ImageWidget.cxx b/lib/cpExtensions/QT/ImageWidget.cxx index 35557f5..bac5f17 100644 --- a/lib/cpExtensions/QT/ImageWidget.cxx +++ b/lib/cpExtensions/QT/ImageWidget.cxx @@ -1,7 +1,4 @@ #include - -#ifdef cpExtensions_QT4 - #include #include #include @@ -15,13 +12,6 @@ #include #include -/* TODO - #include - #include - #include - #include -*/ - // ------------------------------------------------------------------------- cpExtensions::QT::ImageWidget:: ImageWidget( QWidget* parent, Qt::WindowFlags f ) @@ -56,7 +46,7 @@ Clear( ) // ------------------------------------------------------------------------- void cpExtensions::QT::ImageWidget:: -SetImage( vtkImageData* image, int orientation, const std::string& name ) +SetImage( vtkImageData* image, const std::string& name, int orientation ) { if( name == "" ) return; @@ -232,230 +222,4 @@ SetLineWidth( const std::string& name, double w ) this->Render( ); } - -/* TODO -// ------------------------------------------------------------------------- -vtkInteractorStyle* cpExtensions::QT::ImageWidget:: -GetInteractorStyle( ) -{ - return( this->m_ImageSliceStyle ); -} - -// ------------------------------------------------------------------------- -const vtkInteractorStyle* cpExtensions::QT::ImageWidget:: -GetInteractorStyle( ) const -{ - return( this->m_ImageSliceStyle ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -SetImage( vtkImageData* image, int orientation, const std::string& name ) -{ - if( this->m_ImageName != "" ) - { - // TODO: Clear visualization - - } // fi - this->m_ImageName = name; - - this->GetActiveCamera( )->ParallelProjectionOn( ); - - this->m_ImageViewerActors = - vtkSmartPointer< cpExtensions::Visualization::ImageViewerActors >::New( ); - this->m_ImageViewerActors->SetImage( image, orientation ); - - this->m_ImageSliceStyle->SetActors( this->m_ImageViewerActors ); - - this->AddViewProp( - this->m_ImageViewerActors->GetWindowLevelImageActor( ), - this->m_ImageName - ); - this->AddAuxViewProps( this->m_ImageViewerActors, this->m_ImageName ); - this->ResetCamera( ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -Add( vtkDataSet* data, const std::string& name ) -{ - auto image = dynamic_cast< vtkImageData* >( data ); - - if( image == NULL ) - { - if( this->m_ImageName == "" ) - this->SetImage( data, name ); - { - } // fi - return; - - } // fi - - if( this->m_ImageName == "" ) - return; - - if( this->m_ImageViewerActors.GetPointer( ) != NULL ) - { - if( this->m_ImageViewerActors->AddLUTImage( image ) > 0 ) - { - this->AddViewProp( - this->m_ImageViewerActors->GetLUTImageActor( ), - name - ); - this->Render( ); - - } // fi - - } // fi -} - -// ------------------------------------------------------------------------- -int cpExtensions::QT::ImageWidget:: -GetOrientation( ) const -{ - return( this->m_ImageViewerActors->GetOrientation( ) ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -SetSliceNumber( int slice ) -{ - this->m_ImageViewerActors->SetSliceNumber( slice ); - this->Render( ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -GetScalarRange( double r[ 2 ] ) const -{ - auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( ); - if( actor != NULL ) - actor->GetRange( r ); - else - r[ 0 ] = r[ 1 ] = double( 0 ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -GetWindowLevel( double wl[ 2 ] ) const -{ - auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( ); - if( actor != NULL ) - { - wl[ 0 ] = actor->GetWindow( ); - wl[ 1 ] = actor->GetLevel( ); - } - else - wl[ 0 ] = wl[ 1 ] = double( 0 ); -} - -// ------------------------------------------------------------------------- -double cpExtensions::QT::ImageWidget:: -GetImageOpacity( ) const -{ - auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( ); - if( actor != NULL ) - return( actor->GetProperty( )->GetOpacity( ) ); - else - return( double( 0 ) ); -} - -// ------------------------------------------------------------------------- -unsigned char cpExtensions::QT::ImageWidget:: -GetImageInterpolation( ) const -{ - auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( ); - if( actor != NULL ) - { - int int_type = actor->GetProperty( )->GetInterpolationType( ); - char ret = 0; - switch( int_type ) - { - case VTK_NEAREST_INTERPOLATION: ret = 'N'; break; - case VTK_LINEAR_INTERPOLATION: ret = 'L'; break; - case VTK_CUBIC_INTERPOLATION: ret = 'C'; break; - default: ret = 0; break; - } // hctiws - return( ret ); - } - else - return( 0 ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -SetScalarRange( double r[ 2 ] ) -{ - auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( ); - if( actor != NULL ) - { - actor->ConfigureWindowLevel( r[ 0 ], r[ 1 ] ); - this->Render( ); - - } // fi -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -SetWindowLevel( double wl[ 2 ] ) -{ - auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( ); - if( actor != NULL ) - { - actor->SetWindowLevel( wl[ 0 ], wl[ 1 ] ); - this->Render( ); - - } // fi -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -SetImageOpacity( double o ) -{ - auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( ); - if( actor != NULL ) - { - actor->GetProperty( )->SetOpacity( o ); - this->Render( ); - - } // fi -} - -// ------------------------------------------------------------------------- -void cpExtensions::QT::ImageWidget:: -SetImageInterpolation( unsigned char i ) -{ - auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( ); - if( actor != NULL ) - { - int int_type = 0; - switch( i ) - { - case 'L': int_type = VTK_LINEAR_INTERPOLATION; break; - case 'C': int_type = VTK_CUBIC_INTERPOLATION; break; - default : int_type = VTK_NEAREST_INTERPOLATION; break; - } // hctiws - actor->GetProperty( )->SetInterpolationType( int_type ); - this->Render( ); - - } // fi -} - -// ------------------------------------------------------------------------- -vtkProp* cpExtensions::QT::ImageWidget:: -GetImageActor( ) -{ - return( this->m_ImageViewerActors->GetWindowLevelImageActor( ) ); -} - -// ------------------------------------------------------------------------- -const vtkProp* cpExtensions::QT::ImageWidget:: -GetImageActor( ) const -{ - return( this->m_ImageViewerActors->GetWindowLevelImageActor( ) ); -} -*/ - -#endif // cpExtensions_QT4 - // eof - $RCSfile$