]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/QT/RendererWidget.cxx
...
[cpPlugins.git] / lib / cpExtensions / QT / RendererWidget.cxx
index 5d44fcdad65aac0ebb7e96da5ee9011641e723c5..0189ef6546e90e3550187ce9660197cfe503c1e1 100644 (file)
@@ -1,17 +1,20 @@
 #include <cpExtensions/QT/RendererWidget.h>
-
-#ifdef cpExtensions_QT4
-
 #include <vtkAxesActor.h>
+#include <vtkCamera.h>
+#include <vtkImageProperty.h>
 #include <vtkInteractorStyle.h>
 #include <vtkOrientationMarkerWidget.h>
+#include <vtkProperty.h>
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
+#include <cpExtensions/Visualization/LUTImageActor.h>
+#include <cpExtensions/Visualization/WindowLevelImageActor.h>
 
 // -------------------------------------------------------------------------
 cpExtensions::QT::RendererWidget::
 RendererWidget( QWidget* parent, Qt::WindowFlags f )
-  : Superclass( parent, f )
+  : Superclass( parent, f ),
+    Superclass2( )
 {
   this->m_Renderer = vtkSmartPointer< vtkRenderer >::New( );
   this->GetRenderWindow( )->AddRenderer( this->m_Renderer );
@@ -74,11 +77,13 @@ GetRenderer( ) const
 vtkInteractorStyle* cpExtensions::QT::RendererWidget::
 GetStyle( )
 {
-  return(
-    dynamic_cast< vtkInteractorStyle* >(
-      this->GetInteractor( )->GetInteractorStyle( )
-      )
-    );
+  auto iren = this->GetInteractor( );
+  if( iren != NULL )
+    return(
+      dynamic_cast< vtkInteractorStyle* >( iren->GetInteractorStyle( ) )
+      );
+  else
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
@@ -88,11 +93,17 @@ GetStyle( ) const
   // Ugly, but necessary :-(
   Self* self = const_cast< Self* >( this );
   if( self != NULL )
-    return(
-      dynamic_cast< const vtkInteractorStyle* >(
-        self->GetInteractor( )->GetInteractorStyle( )
-        )
-      );
+  {
+    auto iren = self->GetInteractor( );
+    if( iren != NULL )
+      return(
+        dynamic_cast< const vtkInteractorStyle* >(
+          iren->GetInteractorStyle( )
+          )
+        );
+    else
+      return( NULL );
+  }
   else
     return( NULL );
 }
@@ -124,15 +135,14 @@ AddViewProp( vtkProp* prop, const std::string& name )
 {
   if( prop != NULL )
   {
-    if( this->m_ViewProps.find( name ) == this->m_ViewProps.end( ) )
-    {
-      vtkSmartPointer< vtkPropCollection > coll =
-        vtkSmartPointer< vtkPropCollection >::New( );
-      coll->AddItem( prop );
-      this->m_ViewProps[ name ] = coll;
-      this->m_Renderer->AddViewProp( prop );
-
-    } // fi
+    auto i = this->m_ViewProps.find( name );
+    if( i == this->m_ViewProps.end( ) )
+      i =
+        this->m_ViewProps.insert(
+          TPropCollection::value_type( name, TProps( ) )
+          ).first;
+    i->second.insert( prop );
+    this->m_Renderer->AddViewProp( prop );
 
   } // fi
 }
@@ -143,14 +153,19 @@ AddViewProps( vtkPropCollection* props, const std::string& name )
 {
   if( props != NULL )
   {
-    if( this->m_ViewProps.find( name ) == this->m_ViewProps.end( ) )
+    auto i = this->m_ViewProps.find( name );
+    if( i == this->m_ViewProps.end( ) )
+      i =
+        this->m_ViewProps.insert(
+          TPropCollection::value_type( name, TProps( ) )
+          ).first;
+    props->InitTraversal( );
+    while( vtkProp* prop = props->GetNextProp( ) )
     {
-      this->m_ViewProps[ name ] = props;
-      props->InitTraversal( );
-      while( vtkProp* p = props->GetNextProp( ) )
-        this->m_Renderer->AddViewProp( p );
+      i->second.insert( prop );
+      this->m_Renderer->AddViewProp( prop );
 
-    } // fi
+    } // elihw
 
   } // fi
 }
@@ -161,21 +176,14 @@ AddAuxViewProp( vtkProp* prop, const std::string& name )
 {
   if( prop != NULL )
   {
-    if( this->m_ViewProps.find( name ) != this->m_ViewProps.end( ) )
-    {
-      auto a = this->m_AuxViewProps.find( name );
-      vtkSmartPointer< vtkPropCollection > coll;
-      if( a == this->m_AuxViewProps.end( ) )
-      {
-        coll = vtkSmartPointer< vtkPropCollection >::New( );
-        this->m_AuxViewProps[ name ] = coll;
-      }
-      else
-        coll = a->second;
-      coll->AddItem( prop );
-      this->m_Renderer->AddViewProp( prop );
-
-    } // fi
+    auto i = this->m_AuxViewProps.find( name );
+    if( i == this->m_AuxViewProps.end( ) )
+      i =
+        this->m_AuxViewProps.insert(
+          TPropCollection::value_type( name, TProps( ) )
+          ).first;
+    i->second.insert( prop );
+    this->m_Renderer->AddViewProp( prop );
 
   } // fi
 }
@@ -184,53 +192,81 @@ AddAuxViewProp( vtkProp* prop, const std::string& name )
 void cpExtensions::QT::RendererWidget::
 AddAuxViewProps( vtkPropCollection* props, const std::string& name )
 {
-  props->InitTraversal( );
-  while( auto p = props->GetNextProp( ) )
-    this->AddAuxViewProp( p, name );
+  if( props != NULL )
+  {
+    auto i = this->m_AuxViewProps.find( name );
+    if( i == this->m_AuxViewProps.end( ) )
+      i =
+        this->m_AuxViewProps.insert(
+          TPropCollection::value_type( name, TProps( ) )
+          ).first;
+    props->InitTraversal( );
+    while( vtkProp* prop = props->GetNextProp( ) )
+    {
+      i->second.insert( prop );
+      this->m_Renderer->AddViewProp( prop );
+
+    } // elhiw
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-vtkPropCollection* cpExtensions::QT::RendererWidget::
+cpExtensions::QT::RendererWidget::
+TProps& cpExtensions::QT::RendererWidget::
 GetViewProps( const std::string& name )
 {
+  static TProps zero;
   auto i = this->m_ViewProps.find( name );
-  if( i != this->m_ViewProps.end( ) )
-    return( i->second );
+  if( i == this->m_ViewProps.end( ) )
+  {
+    zero.clear( );
+    return( zero );
+  }
   else
-    return( NULL );
+    return( i->second );
 }
 
 // -------------------------------------------------------------------------
-const vtkPropCollection* cpExtensions::QT::RendererWidget::
+const cpExtensions::QT::RendererWidget::
+TProps& cpExtensions::QT::RendererWidget::
 GetViewProps( const std::string& name ) const
 {
+  static const TProps zero;
   auto i = this->m_ViewProps.find( name );
-  if( i != this->m_ViewProps.end( ) )
-    return( i->second );
+  if( i == this->m_ViewProps.end( ) )
+    return( zero );
   else
-    return( NULL );
+    return( i->second );
 }
 
 // -------------------------------------------------------------------------
-vtkPropCollection* cpExtensions::QT::RendererWidget::
+cpExtensions::QT::RendererWidget::
+TProps& cpExtensions::QT::RendererWidget::
 GetAuxViewProps( const std::string& name )
 {
+  static TProps zero;
   auto i = this->m_AuxViewProps.find( name );
-  if( i != this->m_AuxViewProps.end( ) )
-    return( i->second );
+  if( i == this->m_AuxViewProps.end( ) )
+  {
+    zero.clear( );
+    return( zero );
+  }
   else
-    return( NULL );
+    return( i->second );
 }
 
 // -------------------------------------------------------------------------
-const vtkPropCollection* cpExtensions::QT::RendererWidget::
+const cpExtensions::QT::RendererWidget::
+TProps& cpExtensions::QT::RendererWidget::
 GetAuxViewProps( const std::string& name ) const
 {
+  static const TProps zero;
   auto i = this->m_AuxViewProps.find( name );
-  if( i != this->m_AuxViewProps.end( ) )
-    return( i->second );
+  if( i == this->m_AuxViewProps.end( ) )
+    return( zero );
   else
-    return( NULL );
+    return( i->second );
 }
 
 // -------------------------------------------------------------------------
@@ -240,20 +276,18 @@ RemoveViewProps( const std::string& name )
   auto i = this->m_ViewProps.find( name );
   if( i != this->m_ViewProps.end( ) )
   {
-    i->second->InitTraversal( );
-    while( auto p = i->second->GetNextProp( ) )
-      this->m_Renderer->RemoveViewProp( p );
+    for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
+      this->m_Renderer->RemoveViewProp( *p );
     this->m_ViewProps.erase( i );
 
-    i = this->m_AuxViewProps.find( name );
-    if( i != this->m_AuxViewProps.end( ) )
-    {
-      i->second->InitTraversal( );
-      while( auto p = i->second->GetNextProp( ) )
-        this->m_Renderer->RemoveViewProp( p );
-      this->m_AuxViewProps.erase( i );
+  } // fi
 
-    } // fi
+  i = this->m_AuxViewProps.find( name );
+  if( i != this->m_AuxViewProps.end( ) )
+  {
+    for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
+      this->m_Renderer->RemoveViewProp( *p );
+    this->m_AuxViewProps.erase( i );
 
   } // fi
 }
@@ -273,211 +307,684 @@ HideViewProps( const std::string& name )
 {
   auto i = this->m_ViewProps.find( name );
   if( i != this->m_ViewProps.end( ) )
+    for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
+      ( *p )->VisibilityOff( );
+  i = this->m_AuxViewProps.find( name );
+  if( i != this->m_AuxViewProps.end( ) )
+    for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
+      ( *p )->VisibilityOff( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+ShowViewProps( const std::string& name )
+{
+  auto i = this->m_ViewProps.find( name );
+  if( i != this->m_ViewProps.end( ) )
+    for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
+      ( *p )->VisibilityOn( );
+  i = this->m_AuxViewProps.find( name );
+  if( i != this->m_AuxViewProps.end( ) )
+    for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
+      ( *p )->VisibilityOn( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+ResetCamera( )
+{
+  this->m_Renderer->ResetCamera( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+Render( )
+{
+  this->GetRenderWindow( )->Render( );
+}
+
+// -------------------------------------------------------------------------
+std::set< vtkRenderWindowInteractor* > cpExtensions::QT::RendererWidget::
+GetInteractors( ) const
+{
+  Self* self = const_cast< Self* >( this );
+  std::set< vtkRenderWindowInteractor* > ret;
+  ret.insert( self->GetRenderWindow( )->GetInteractor( ) );
+  return( ret );
+}
+
+// -------------------------------------------------------------------------
+std::set< std::string > cpExtensions::QT::RendererWidget::
+GetActorsNames( ) const
+{
+  std::set< std::string > names;
+  for(
+    auto p = this->m_ViewProps.begin( );
+    p != this->m_ViewProps.end( );
+    ++p
+    )
+    names.insert( p->first );
+  return( names );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::RendererWidget::
+IsWindowLevelImageActor( const std::string& name ) const
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto a = it->second.begin( );
+    if( a != it->second.end( ) )
+      return( dynamic_cast< TWLActor* >( a->GetPointer( ) ) != NULL );
+    else
+      return( false );
+  }
+  else
+    return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::RendererWidget::
+IsLUTImageActor( const std::string& name ) const
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
   {
-    i->second->InitTraversal( );
-    while( auto p = i->second->GetNextProp( ) )
-      p->VisibilityOff( );
+    auto a = it->second.begin( );
+    if( a != it->second.end( ) )
+      return( dynamic_cast< TLUTActor* >( a->GetPointer( ) ) != NULL );
+    else
+      return( false );
+  }
+  else
+    return( false );
+}
 
-    i = this->m_AuxViewProps.find( name );
-    if( i != this->m_AuxViewProps.end( ) )
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::RendererWidget::
+Is3DActor( const std::string& name ) const
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto a = it->second.begin( );
+    if( a != it->second.end( ) )
+      return( dynamic_cast< vtkActor* >( a->GetPointer( ) ) != NULL );
+    else
+      return( false );
+  }
+  else
+    return( false );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+GetScalarRange( const std::string& name, double r[ 2 ] ) const
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto p = it->second.begin( );
+    TWLActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
     {
-      i->second->InitTraversal( );
-      while( auto p = i->second->GetNextProp( ) )
-        p->VisibilityOff( );
+      a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      p++;
 
-    } // fi
+    } // elihw
+    if( a != NULL )
+      a->GetRange( r );
 
   } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-ShowViewProps( const std::string& name )
+GetWindowLevel( const std::string& name, double wl[ 2 ] ) const
 {
-  auto i = this->m_ViewProps.find( name );
-  if( i != this->m_ViewProps.end( ) )
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
   {
-    i->second->InitTraversal( );
-    while( auto p = i->second->GetNextProp( ) )
-      p->VisibilityOn( );
-
-    i = this->m_AuxViewProps.find( name );
-    if( i != this->m_AuxViewProps.end( ) )
+    auto p = it->second.begin( );
+    TWLActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
     {
-      i->second->InitTraversal( );
-      while( auto p = i->second->GetNextProp( ) )
-        p->VisibilityOn( );
+      a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      p++;
 
-    } // fi
+    } // elihw
+    if( a != NULL )
+      a->GetWindowLevel( wl );
 
   } // fi
 }
 
-
-/*
 // -------------------------------------------------------------------------
-const cpExtensions::QT::RendererWidget::
-TNamedActors& cpExtensions::QT::RendererWidget::
-GetNamedActors( ) const
+double cpExtensions::QT::RendererWidget::
+GetWindow( const std::string& name ) const
 {
-  return( this->m_NamedActors );
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto p = it->second.begin( );
+    TWLActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
+    {
+      a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      p++;
+
+    } // elihw
+    if( a != NULL )
+      return( a->GetWindow( ) );
+    else
+      return( 0 );
+  }
+  else
+    return( 0 );
 }
 
 // -------------------------------------------------------------------------
-cpExtensions::QT::RendererWidget::
-TProps& cpExtensions::QT::RendererWidget::
-GetViewProps( const std::string& name )
+double cpExtensions::QT::RendererWidget::
+GetLevel( const std::string& name ) const
 {
-  static TProps empty;
-  auto i = this->m_NamedActors.find( name );
-  if( i == this->m_NamedActors.end( ) )
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
   {
-    empty = NULL;
-    return( empty );
+    auto p = it->second.begin( );
+    TWLActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
+    {
+      a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      p++;
+
+    } // elihw
+    if( a != NULL )
+      return( a->GetLevel( ) );
+    else
+      return( 0 );
   }
   else
-    return( i->second );
+    return( 0 );
 }
 
 // -------------------------------------------------------------------------
-const cpExtensions::QT::RendererWidget::
-TProps& cpExtensions::QT::RendererWidget::
-GetViewProps( const std::string& name ) const
+char cpExtensions::QT::RendererWidget::
+GetImageInterpolation( const std::string& name ) const
 {
-  static const TProps empty = NULL;
-  auto i = this->m_NamedActors.find( name );
-  if( i == this->m_NamedActors.end( ) )
-    return( empty );
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto p = it->second.begin( );
+    TWLActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
+    {
+      a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      p++;
+
+    } // elihw
+    if( a != NULL )
+    {
+      int int_type = a->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 );
+  }
   else
-    return( i->second );
+    return( 0 );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-AddViewProp( vtkProp* prop, const std::string& name )
+GetColor( const std::string& name, double& r, double& g, double& b ) const
 {
-  if( this->m_NamedActors.find( name ) == this->m_NamedActors.end( ) )
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
   {
-    TProps coll = TProps::New( );
-    coll->AddItem( prop );
-    this->m_NamedActors[ name ] = coll;
-    this->m_Renderer->AddViewProp( prop );
+    auto p = it->second.begin( );
+    vtkActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
+    {
+      a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      p++;
+
+    } // elihw
+    if( a != NULL )
+      return( a->GetProperty( )->GetColor( r, g, b ) );
 
   } // fi
 }
 
+// -------------------------------------------------------------------------
+double cpExtensions::QT::RendererWidget::
+GetOpacity( const std::string& name ) const
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto p = it->second.begin( );
+    vtkActor* a = NULL;
+    vtkImageSlice* s = NULL;
+    while( a == NULL && s == NULL && p != it->second.end( ) )
+    {
+      a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      s = dynamic_cast< vtkImageSlice* >( p->GetPointer( ) );
+      p++;
+
+    } // elihw
+    if( a != NULL )
+      return( a->GetProperty( )->GetOpacity( ) );
+    else if( s != NULL )
+      return( s->GetProperty( )->GetOpacity( ) );
+    else
+      return( 0 );
+  }
+  return( 0 );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::RendererWidget::
+GetPointSize( const std::string& name ) const
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto p = it->second.begin( );
+    vtkActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
+    {
+      a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      p++;
+
+    } // elihw
+    if( a != NULL )
+      return( a->GetProperty( )->GetPointSize( ) );
+    else
+      return( 0 );
+  }
+  return( 0 );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::RendererWidget::
+GetLineWidth( const std::string& name ) const
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto p = it->second.begin( );
+    vtkActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
+    {
+      a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      p++;
+
+    } // elihw
+    if( a != NULL )
+      return( a->GetProperty( )->GetLineWidth( ) );
+    else
+      return( 0 );
+  }
+  return( 0 );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::QT::RendererWidget::
+GetRepresentation( const std::string& name ) const
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    auto p = it->second.begin( );
+    vtkActor* a = NULL;
+    while( a == NULL && p != it->second.end( ) )
+    {
+      a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      p++;
+
+    } // elihw
+    if( a != NULL )
+      return( a->GetProperty( )->GetRepresentation( ) );
+    else
+      return( -1 );
+  }
+  return( -1 );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-AddViewProps( vtkPropCollection* coll, const std::string& name )
+SetScalarRange( const std::string& name, double r[ 2 ] )
 {
-  if( this->m_NamedActors.find( name ) == this->m_NamedActors.end( ) )
+  this->SetScalarRange( name, r[ 0 ], r[ 1 ] );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetScalarRange( const std::string& name, double min, double max )
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
   {
-    this->m_NamedActors[ name ] = coll;
-    coll->InitTraversal( );
-    while( vtkProp* prop = coll->GetNextProp( ) )
-      this->m_Renderer->AddViewProp( prop );
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->SetRange( min, max );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
 
   } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-RemoveViewProps( )
+SetWindowLevel( const std::string& name, double wl[ 2 ] )
 {
-  this->m_Renderer->RemoveAllViewProps( );
-  this->m_NamedActors.clear( );
+  this->SetWindowLevel( name, wl[ 0 ], wl[ 1 ] );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-RemoveViewProps( const std::string& name )
+SetWindowLevel( const std::string& name, double w, double l )
 {
-  auto a = this->m_NamedActors.find( name );
-  if( a != this->m_NamedActors.end( ) )
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
   {
-    a->second->InitTraversal( );
-    while( vtkProp* prop = a->second->GetNextProp( ) )
-      this->m_Renderer->RemoveViewProp( prop );
-    this->m_NamedActors.erase( a );
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->SetWindowLevel( w, l );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
 
   } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-HideViewProps( const std::string& name )
+SetWindow( const std::string& name, double w )
 {
-  auto a = this->m_NamedActors.find( name );
-  if( a != this->m_NamedActors.end( ) )
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
   {
-    a->second->InitTraversal( );
-    while( vtkProp* prop = a->second->GetNextProp( ) )
-      prop->VisibilityOff( );
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->SetWindow( w );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
 
   } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-ShowViewProps( const std::string& name )
+SetLevel( const std::string& name, double l )
 {
-  auto a = this->m_NamedActors.find( name );
-  if( a != this->m_NamedActors.end( ) )
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
   {
-    a->second->InitTraversal( );
-    while( vtkProp* prop = a->second->GetNextProp( ) )
-      prop->VisibilityOn( );
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->SetLevel( l );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
 
   } // fi
 }
-*/
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-ResetCamera( )
+SetImageInterpolation( const std::string& name, char i )
 {
-  /* TODO
-     double bounds[ 6 ] = { 0, 1, 0, 1, 0, 1 };
-     double b[ 6 ];
-     bool start = true;
-     for(
-     auto props = this->m_ViewProps.begin( );
-     props != this->m_ViewProps.end( );
-     ++props
-     )
-     {
-     props->second->InitTraversal( );
-     while(
-     auto prop = dynamic_cast< vtkProp3D* >( props->second->GetNextProp( ) )
-     )
-     {
-     if( !start )
-     {
-     prop->GetBounds( b );
-     bounds[ 0 ] = ( b[ 0 ] < bounds[ 0 ] )? b[ 0 ]: bounds[ 0 ];
-     bounds[ 1 ] = ( bounds[ 1 ] < b[ 1 ] )? b[ 1 ]: bounds[ 1 ];
-     bounds[ 2 ] = ( b[ 2 ] < bounds[ 2 ] )? b[ 2 ]: bounds[ 2 ];
-     bounds[ 3 ] = ( bounds[ 3 ] < b[ 3 ] )? b[ 3 ]: bounds[ 3 ];
-     bounds[ 4 ] = ( b[ 4 ] < bounds[ 4 ] )? b[ 4 ]: bounds[ 4 ];
-     bounds[ 5 ] = ( bounds[ 5 ] < b[ 5 ] )? b[ 5 ]: bounds[ 5 ];
-     }
-     else
-     prop->GetBounds( bounds );
-
-     } // elihw
-
-     } // rof
-  */
-  this->m_Renderer->ResetCamera( );
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        int int_type = VTK_NEAREST_INTERPOLATION;
+        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
+        a->GetProperty( )->SetInterpolationType( int_type );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::QT::RendererWidget::
-Render( )
+SetColor( const std::string& name, double r, double g, double b )
 {
-  this->GetRenderWindow( )->Render( );
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->GetProperty( )->SetColor( r, g, b );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
+
+  } // fi
 }
 
-#endif // cpExtensions_QT4
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetOpacity( const std::string& name, double o )
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      vtkImageSlice* s = dynamic_cast< vtkImageSlice* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->GetProperty( )->SetOpacity( o );
+      }
+      else if( s != NULL )
+      {
+        render = true;
+        s->GetProperty( )->SetOpacity( o );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetPointSize( const std::string& name, double s )
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->GetProperty( )->SetPointSize( s );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetLineWidth( const std::string& name, double w )
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->GetProperty( )->SetLineWidth( w );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetRepresentationToPoints( const std::string& name )
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->GetProperty( )->SetRepresentationToPoints( );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetRepresentationToSurface( const std::string& name )
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->GetProperty( )->SetRepresentationToSurface( );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetRepresentationToWireframe( const std::string& name )
+{
+  auto it = this->m_ViewProps.find( name );
+  if( it != this->m_ViewProps.end( ) )
+  {
+    bool render = false;
+    for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+    {
+      vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+      if( a != NULL )
+      {
+        render = true;
+        a->GetProperty( )->SetRepresentationToWireframe( );
+
+      } // fi
+
+    } // rof
+    if( render )
+      this->Render( );
+
+  } // fi
+}
 
 // eof - $RCSfile$