]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/QT/ImageWidget.cxx
...
[cpPlugins.git] / lib / cpExtensions / QT / ImageWidget.cxx
index 35557f5a9ee99330d34ffacfddfa260167d92c4f..bac5f17ffbde3a14fcddd08095cc4ff544f70448 100644 (file)
@@ -1,7 +1,4 @@
 #include <cpExtensions/QT/ImageWidget.h>
-
-#ifdef cpExtensions_QT4
-
 #include <cpExtensions/Interaction/ImageSliceStyle.h>
 #include <cpExtensions/Visualization/LUTImageActor.h>
 #include <cpExtensions/Visualization/MeshActor.h>
 #include <vtkProperty.h>
 #include <vtkRenderer.h>
 
-/* TODO
-   #include <cpExtensions/Visualization/ImageViewerActors.h>
-   #include <cpExtensions/Visualization/LUTImageActor.h>
-   #include <vtkImageData.h>
-   #include <vtkImageProperty.h>
-*/
-
 // -------------------------------------------------------------------------
 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$