]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/MPRActors.cxx
Double click widget integrated with segmentation and deformation filters.
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRActors.cxx
index 43600a36652f70118740881889814558f19e27ae..a7803b2ad77864d2ed9ce81bd316a6d827ff1e10 100644 (file)
@@ -1,12 +1,12 @@
 #include <cpExtensions/Visualization/MPRActors.h>
 
+#include <vtkAlgorithmOutput.h>
 #include <vtkImageData.h>
-#include <vtkInformation.h>
 #include <vtkOutlineSource.h>
-#include <vtkPolyDataMapper.h>
 #include <vtkProperty.h>
 #include <vtkRenderer.h>
-#include <vtkWindowLevelLookupTable.h>
+#include <vtkRendererCollection.h>
+#include <vtkRenderWindow.h>
 
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::MPRActors*
@@ -22,295 +22,192 @@ ImageSliceActors* cpExtensions::Visualization::MPRActors::
 GetSliceActors( const int& i ) const
 {
   if( i < 3 )
-    return( this->Slices[ i ] );
+    return( this->Slices[ 0 ][ i ] );
   else
     return( NULL );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-SetInputConnection( vtkAlgorithmOutput* aout )
-{
-  this->ImageMapToColors->SetInputConnection( aout );
-  this->SetLookupTableToWindowLevel( );
-  this->_UpdateSlices( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-SetInputData( vtkImageData* image )
-{
-  this->ImageMapToColors->SetInputData( image );
-  this->SetLookupTableToWindowLevel( );
-  this->_UpdateSlices( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-PushDataInto( vtkRenderer* x, vtkRenderer* y, vtkRenderer* z, vtkRenderer* w )
+int cpExtensions::Visualization::MPRActors::
+AddInputConnection( vtkAlgorithmOutput* aout )
 {
-  vtkRenderer* rends[] = { x, y, z };
-  for( int i = 0; i < 3; ++i )
+  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+  if( blender == NULL )
   {
-    if( rends[ i ] != NULL )
+    this->Slices[ 0 ][ 0 ]->AddInputConnection( aout );
+    blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+    for( unsigned int i = 0; i < 2; ++i )
     {
-      rends[ i ]->AddActor( this->Slices[ i ]->GetImageActor( ) );
-      rends[ i ]->AddActor( this->Slices[ i ]->GetTextActor( ) );
-      for( int j = 0; j < 3; ++j )
-        rends[ i ]->AddActor( this->Slices[ j ]->GetPlaneActor( ) );
-      if( w != NULL )
+      for( unsigned int j = 0; j < 3; ++j )
       {
-        w->AddActor( this->Slices[ i ]->GetImageActor( ) );
-        w->AddActor( this->Slices[ i ]->GetPlaneActor( ) );
+        if( i != 0 || j != 0 )
+          this->Slices[ i ][ j ]->SetBlender( blender );
+        this->Slices[ i ][ j ]->SetAxis( j );
 
-      } // fi
-
-    } // fi
+      } // rof
 
-  } // rof
-
-  if( w != NULL )
-    w->AddActor( this->ImageOutlineActor );
+    } // rof
+    this->_CreateBoundingBox( );
+  }
+  else
+    blender->AddInputConnection( aout );
+  return( blender->GetNumberOfImages( ) - 1 );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-PopDataFrom( vtkRenderer* x, vtkRenderer* y, vtkRenderer* z, vtkRenderer* w )
+int cpExtensions::Visualization::MPRActors::
+AddInputData( vtkImageData* new_image )
 {
-  vtkRenderer* rends[] = { x, y, z };
-  for( int i = 0; i < 3; ++i )
+  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+  if( blender == NULL )
   {
-    if( rends[ i ] != NULL )
+    this->Slices[ 0 ][ 0 ]->AddInputData( new_image );
+    blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+    for( unsigned int i = 0; i < 2; ++i )
     {
-      rends[ i ]->RemoveActor( this->Slices[ i ]->GetImageActor( ) );
-      rends[ i ]->RemoveActor( this->Slices[ i ]->GetTextActor( ) );
-      for( int j = 0; j < 3; ++j )
-        rends[ i ]->RemoveActor( this->Slices[ j ]->GetPlaneActor( ) );
-      if( w != NULL )
+      for( unsigned int j = 0; j < 3; ++j )
       {
-        w->RemoveActor( this->Slices[ i ]->GetImageActor( ) );
-        w->RemoveActor( this->Slices[ i ]->GetPlaneActor( ) );
-
-      } // fi
-
-    } // fi
-
-  } // rof
-
-  if( w != NULL )
-  {
-    w->RemoveActor( this->ImageOutlineActor );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-vtkScalarsToColors* cpExtensions::Visualization::MPRActors::
-GetLookupTable( ) const
-{
-  return( this->ImageMapToColors->GetLookupTable( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-SetLookupTable( vtkScalarsToColors* lut )
-{
-  this->ImageMapToColors->SetLookupTable( lut );
-  this->ImageMapToColors->Update( );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-vtkWindowLevelLookupTable* cpExtensions::Visualization::MPRActors::
-GetLookupTableAsWindowLevel( ) const
-{
-  return(
-    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( ) )
-    );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-SetLookupTableToWindowLevel( )
-{
-  // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
-  if( image == NULL )
-    return;
-
-  double r[ 2 ];
-  image->GetScalarRange( r );
-
-  vtkSmartPointer< vtkWindowLevelLookupTable > lut =
-    vtkSmartPointer< vtkWindowLevelLookupTable >::New( );
-  lut->SetScaleToLinear( );
-  lut->SetTableRange( r );
-  lut->Build( );
-
-  this->SetLookupTable( lut );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::MPRActors::
-GetMinWindow( ) const
-{
-  return( double( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::MPRActors::
-GetMaxWindow( ) const
-{
-  // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
-  if( image == NULL )
-    return( double( 0 ) );
-
-  double r[ 2 ];
-  image->GetScalarRange( r );
-  return( r[ 1 ] - r[ 0 ] );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::MPRActors::
-GetMinLevel( ) const
-{
-  // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
-  if( image == NULL )
-    return( double( 0 ) );
+        if( i != 0 || j != 0 )
+          this->Slices[ i ][ j ]->SetBlender( blender );
+        this->Slices[ i ][ j ]->SetAxis( j );
 
-  double r[ 2 ];
-  image->GetScalarRange( r );
-  return( r[ 0 ] );
-}
+      } // rof
 
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::MPRActors::
-GetMaxLevel( ) const
-{
-  // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
-  if( image == NULL )
-    return( double( 0 ) );
-
-  double r[ 2 ];
-  image->GetScalarRange( r );
-  return( r[ 1 ] );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::MPRActors::
-GetWindow( ) const
-{
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
-  if( lut != NULL )
-    return( lut->GetWindow( ) );
+    } // rof
+    this->_CreateBoundingBox( );
+  }
   else
-    return( double( 0 ) );
+    blender->AddInputData( new_image );
+  return( blender->GetNumberOfImages( ) - 1 );
 }
 
 // -------------------------------------------------------------------------
-double cpExtensions::Visualization::MPRActors::
-GetLevel( ) const
+unsigned int cpExtensions::Visualization::MPRActors::
+GetNumberOfImages( ) const
 {
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
-  if( lut != NULL )
-    return( lut->GetLevel( ) );
+  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+  if( blender != NULL )
+    return( blender->GetNumberOfImages( ) );
   else
-    return( double( 0 ) );
+    return( 0 );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-SetWindow( const double& w )
+PushActorsInto(
+  vtkRenderWindow* x, vtkRenderWindow* y, vtkRenderWindow* z,
+  vtkRenderWindow* w
+  )
 {
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
-  if( lut != NULL )
+  this->Slices[ 0 ][ 0 ]->PushActorsInto( x, true );
+  this->Slices[ 0 ][ 1 ]->PushActorsInto( y, true );
+  this->Slices[ 0 ][ 2 ]->PushActorsInto( z, true );
+  this->Slices[ 1 ][ 0 ]->PushActorsInto( w, false );
+  this->Slices[ 1 ][ 1 ]->PushActorsInto( w, false );
+  this->Slices[ 1 ][ 2 ]->PushActorsInto( w, false );
+
+  vtkRenderer* xren =
+    ( x != NULL )? x->GetRenderers( )->GetFirstRenderer( ): NULL;
+  vtkRenderer* yren =
+    ( y != NULL )? y->GetRenderers( )->GetFirstRenderer( ): NULL;
+  vtkRenderer* zren =
+    ( z != NULL )? z->GetRenderers( )->GetFirstRenderer( ): NULL;
+  vtkRenderer* wren =
+    ( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
+
+  if( xren != NULL )
   {
-    lut->SetWindow( w );
-    lut->Build( );
-    this->ImageMapToColors->Modified( );
-    this->Modified( );
+    xren->AddActor( this->Slices[ 0 ][ 1 ]->GetPlaneActor( ) );
+    xren->AddActor( this->Slices[ 0 ][ 2 ]->GetPlaneActor( ) );
 
   } // fi
-}
+  if( yren != NULL )
+  {
+    yren->AddActor( this->Slices[ 0 ][ 0 ]->GetPlaneActor( ) );
+    yren->AddActor( this->Slices[ 0 ][ 2 ]->GetPlaneActor( ) );
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-SetLevel( const double& l )
-{
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
-  if( lut != NULL )
+  } // fi
+  if( zren != NULL )
   {
-    lut->SetLevel( l );
-    lut->Build( );
-    this->ImageMapToColors->Modified( );
-    this->Modified( );
+    zren->AddActor( this->Slices[ 0 ][ 0 ]->GetPlaneActor( ) );
+    zren->AddActor( this->Slices[ 0 ][ 1 ]->GetPlaneActor( ) );
 
   } // fi
+  if( wren != NULL )
+    wren->AddActor( this->ImageOutlineActor );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-SetWindowLevel( const double& w, const double& l )
+PopActorsFrom(
+  vtkRenderWindow* x, vtkRenderWindow* y, vtkRenderWindow* z,
+  vtkRenderWindow* w
+  )
 {
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
-  if( lut != NULL )
-  {
-    lut->SetWindow( l );
-    lut->SetLevel( l );
-    lut->Build( );
-    this->ImageMapToColors->Modified( );
-    this->Modified( );
-
-  } // fi
+  this->Slices[ 0 ][ 0 ]->PopActorsFrom( x );
+  this->Slices[ 0 ][ 1 ]->PopActorsFrom( y );
+  this->Slices[ 0 ][ 2 ]->PopActorsFrom( z );
+  this->Slices[ 1 ][ 0 ]->PopActorsFrom( w );
+  this->Slices[ 1 ][ 1 ]->PopActorsFrom( w );
+  this->Slices[ 1 ][ 2 ]->PopActorsFrom( w );
+
+  vtkRenderer* wren =
+    ( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
+  if( wren != NULL )
+    wren->RemoveActor( this->ImageOutlineActor );
+
+  this->Slices[ 0 ][ 0 ]->Clear( );
+  this->Slices[ 0 ][ 1 ]->Clear( );
+  this->Slices[ 0 ][ 2 ]->Clear( );
+  this->Slices[ 1 ][ 0 ]->Clear( );
+  this->Slices[ 1 ][ 1 ]->Clear( );
+  this->Slices[ 1 ][ 2 ]->Clear( );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-ResetWindowLevel( )
+double cpExtensions::Visualization::MPRActors::
+GetWindow( )
 {
-  vtkImageData* image = this->_InputImage( );
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
-  if( image != NULL && lut != NULL )
-  {
-    double r[ 2 ];
-    image->GetScalarRange( r );
-    lut->SetTableRange( r );
-    lut->Build( );
-    this->ImageMapToColors->Modified( );
-    this->Modified( );
+  return( this->Slices[ 0 ][ 0 ]->GetWindow( ) );
+}
 
-  } // fi
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRActors::
+GetLevel( )
+{
+  return( this->Slices[ 0 ][ 0 ]->GetLevel( ) );
 }
 
 // -------------------------------------------------------------------------
 int cpExtensions::Visualization::MPRActors::
 GetSliceNumberMinValue( const int& axis ) const
 {
-  return( this->Slices[ axis ]->GetSliceNumberMinValue( ) );
+  return( this->Slices[ 0 ][ axis ]->GetSliceNumberMinValue( ) );
 }
 
 // -------------------------------------------------------------------------
 int cpExtensions::Visualization::MPRActors::
 GetSliceNumberMaxValue( const int& axis ) const
 {
-  return( this->Slices[ axis ]->GetSliceNumberMaxValue( ) );
+  return( this->Slices[ 0 ][ axis ]->GetSliceNumberMaxValue( ) );
 }
 
 // -------------------------------------------------------------------------
 int cpExtensions::Visualization::MPRActors::
 GetSlice( const int& axis ) const
 {
-  return( this->Slices[ axis ]->GetSliceNumber( ) );
+  return( this->Slices[ 0 ][ axis ]->GetSliceNumber( ) );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
 SetSlice( const int& axis, const int& slice )
 {
-  vtkImageData* image = this->_InputImage( );
+  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+  if( blender == NULL )
+    return;
+  vtkImageData* image =
+    dynamic_cast< vtkImageData* >( blender->GetInput( ) );
   if( image == NULL )
     return;
 
@@ -326,7 +223,8 @@ SetSlice( const int& axis, const int& slice )
     real = ext[ ( axis << 1 ) + 1 ];
 
   // Change slice
-  this->Slices[ axis ]->SetSliceNumber( real );
+  this->Slices[ 0 ][ axis ]->SetSliceNumber( real );
+  this->Slices[ 1 ][ axis ]->SetSliceNumber( real );
   this->Modified( );
 }
 
@@ -334,7 +232,11 @@ SetSlice( const int& axis, const int& slice )
 void cpExtensions::Visualization::MPRActors::
 SetSlice( const int& axis, const double& slice )
 {
-  vtkImageData* image = this->_InputImage( );
+  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+  if( blender == NULL )
+    return;
+  vtkImageData* image =
+    dynamic_cast< vtkImageData* >( blender->GetInput( ) );
   if( image == NULL )
     return;
 
@@ -351,16 +253,11 @@ SetSlice( const int& axis, const double& slice )
 void cpExtensions::Visualization::MPRActors::
 ResetSlices( )
 {
-  // TODO
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-GetImageBounds( double bounds[ 6 ] ) const
-{
-  vtkImageData* image = this->_InputImage( );
-  if( image != NULL )
-    image->GetBounds( bounds );
+  for( unsigned int i = 0; i < 2; ++i )
+    for( unsigned int j = 0; j < 3; ++j )
+      this->Slices[ i ][ j ]->SetSliceNumber(
+        this->Slices[ i ][ j ]->GetSliceNumberMinValue( )
+        );
 }
 
 // -------------------------------------------------------------------------
@@ -368,11 +265,26 @@ cpExtensions::Visualization::MPRActors::
 MPRActors( )
   : Superclass( )
 {
-  this->ImageMapToColors = vtkSmartPointer< vtkImageMapToColors >::New( );
   this->ImageOutlineActor = vtkSmartPointer< vtkActor >::New( );
-  this->Slices[ 0 ] = vtkSmartPointer< _TSlice >::New( );
-  this->Slices[ 1 ] = vtkSmartPointer< _TSlice >::New( );
-  this->Slices[ 2 ] = vtkSmartPointer< _TSlice >::New( );
+  for( unsigned int i = 0; i < 2; ++i )
+    for( unsigned int j = 0; j < 3; ++j )
+      this->Slices[ i ][ j ] = vtkSmartPointer< ImageSliceActors >::New( );
+
+  this->Slices[ 0 ][ 0 ]->AssociateSlice( this->Slices[ 1 ][ 0 ] );
+  this->Slices[ 0 ][ 1 ]->AssociateSlice( this->Slices[ 1 ][ 1 ] );
+  this->Slices[ 0 ][ 2 ]->AssociateSlice( this->Slices[ 1 ][ 2 ] );
+
+  for( unsigned int i = 0; i < 3; ++ i )
+  {
+    this->Slices[ 0 ][ i ]->AddRenderCommand(
+      Self::_RenderCommand, this
+      );
+    this->Slices[ 0 ][ i ]->AddWindowLevelCommand(
+      Self::_WindowLevelCommand, this
+      );
+    this->Slices[ 0 ][ i ]->AddSlicesCommand( Self::_SlicesCommand, this );
+
+  } // rof
 }
 
 // -------------------------------------------------------------------------
@@ -382,124 +294,86 @@ cpExtensions::Visualization::MPRActors::
 }
 
 // -------------------------------------------------------------------------
-vtkImageData* cpExtensions::Visualization::MPRActors::
-_InputImage( ) const
+void cpExtensions::Visualization::MPRActors::
+_CreateBoundingBox( )
 {
-  vtkAlgorithm* algo = this->ImageMapToColors->GetInputAlgorithm( );
-  vtkInformation* info = algo->GetOutputInformation( 0 );
-  return(
-    vtkImageData::SafeDownCast( info->Get( vtkDataObject::DATA_OBJECT( ) ) )
-    );
+  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+  if( blender == NULL )
+    return;
+  if( blender->GetNumberOfImages( ) == 1 )
+  {
+    vtkImageData* image =
+      dynamic_cast< vtkImageData* >( blender->GetInput( ) );
+
+    // Create 3D outline
+    double bb[ 6 ];
+    image->GetBounds( bb );
+
+    vtkSmartPointer< vtkOutlineSource > img_ol =
+      vtkSmartPointer< vtkOutlineSource >::New( );
+    img_ol->SetBounds( bb );
+
+    vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
+      vtkSmartPointer< vtkPolyDataMapper >::New( );
+    img_ol_mapper->SetInputConnection( img_ol->GetOutputPort( ) );
+    this->ImageOutlineActor->SetMapper( img_ol_mapper );
+    this->ImageOutlineActor->GetProperty( )->SetColor( 1, 1, 1 );
+    this->ImageOutlineActor->GetProperty( )->SetLineWidth( 1 );
+
+    this->AddItem( this->ImageOutlineActor );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-_UpdateSlices( )
+_SlicesCommand( double* pos, int axis, void* data )
 {
-  // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
-  if( image == NULL )
+  MPRActors* actors = reinterpret_cast< MPRActors* >( data );
+  if( actors == NULL )
     return;
-  this->ImageMapToColors->Update( );
-
-  for( int i = 0; i < 3; ++i )
+  for( unsigned int j = 0; j < 3; ++j )
   {
-    this->Slices[ i ]->SetInputConnection(
-      this->ImageMapToColors->GetOutputPort( ), i
-      );
-    this->Slices[ i ]->UpdateText( );
+    if( actors->Slices[ 0 ][ j ]->GetAxis( ) != axis )
+    {
+      actors->Slices[ 0 ][ j ]->SetSlice( pos );
+      actors->Slices[ 1 ][ j ]->SetSlice( pos );
+      actors->Slices[ 0 ][ j ]->Render( 1e-3 );
+      actors->Slices[ 1 ][ j ]->Render( 1e-3 );
+
+    } // fi
 
   } // rof
+}
 
-  // Create 3D outline
-  double bb[ 6 ];
-  image->GetBounds( bb );
-
-  vtkSmartPointer< vtkOutlineSource > img_ol =
-    vtkSmartPointer< vtkOutlineSource >::New( );
-  img_ol->SetBounds( bb );
-
-  vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
-    vtkSmartPointer< vtkPolyDataMapper >::New( );
-  img_ol_mapper->SetInputConnection( img_ol->GetOutputPort( ) );
-  this->ImageOutlineActor->SetMapper( img_ol_mapper );
-  this->ImageOutlineActor->GetProperty( )->SetColor( 1, 1, 1 );
-  this->ImageOutlineActor->GetProperty( )->SetLineWidth( 1 );
-
-  this->ImageOutlineActorIndex = this->GetNumberOfItems( );
-  this->AddItem( this->ImageOutlineActor );
-
-  // Cursor radius
-  /*
-    double spac[ 3 ];
-    image->GetSpacing( spac );
-    double radius = spac[ 0 ];
-    radius = ( spac[ 1 ] < radius )? spac[ 1 ]: radius;
-    radius = ( spac[ 2 ] < radius )? spac[ 2 ]: radius;
-    radius *= double( 6 );
-    this->Cursor->SetRadius( radius );
-    this->CursorMapper->Modified( );
-    this->CursorActor->Modified( );
-
-    // Plane actors
-    for( int a = 0; a < 3; ++a )
-    {
-    // Configure actors
-    this->Planes[ a ].Configure( this->ImageToWindowLevel->GetOutputPort( ), a );
-    this->Planes[ a ].ConfigureRegion( this->Region->GetOutputPort( ) );
-    this->Planes[ a ].UpdateText( this->GetWindow( ), this->GetLevel( ) );
-
-    // Add them to renderer
-    vtkRenderer* ren = this->Interactors[ a ]->GetRenderWindow( )->
-    GetRenderers( )->GetFirstRenderer( );
-    if( ren == NULL )
-    vtkErrorMacro( "At least one interactor doesn't have a valid renderer" );
-    ren->AddActor( this->Planes[ a ].ImageActor );
-    ren->AddActor( this->Planes[ a ].TextActor );
-
-    for( int i = 0; i < 3; ++i )
-    this->Interactors[ a ]->GetRenderWindow( )->
-    GetRenderers( )->GetFirstRenderer( )->
-    AddActor( this->Planes[ i ].PlaneActor );
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+_WindowLevelCommand( double window, double level, void* data )
+{
+  MPRActors* actors = reinterpret_cast< MPRActors* >( data );
+  if( actors == NULL )
+    return;
+  actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
+  actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
+  actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 0 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 1 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 2 ]->Render( 1e-3 );
+}
 
-    } // rof
-  */
-  // Keep track into collection
-  /*
-    this->XPlaneIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 0 ].ImageActor.GetPointer( ) );
-    this->XTextIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 0 ].TextActor.GetPointer( ) );
-    this->XBoundsIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 0 ].PlaneActor.GetPointer( ) );
-
-    this->YPlaneIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 1 ].ImageActor.GetPointer( ) );
-    this->YTextIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 1 ].TextActor.GetPointer( ) );
-    this->YBoundsIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 1 ].PlaneActor.GetPointer( ) );
-
-    this->ZPlaneIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 2 ].ImageActor.GetPointer( ) );
-    this->ZTextIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 2 ].TextActor.GetPointer( ) );
-    this->ZBoundsIndex = this->GetNumberOfItems( );
-    this->AddItem( this->Planes[ 2 ].PlaneActor.GetPointer( ) );
-  */
-  // Initialize slice visualization
-  // this->ResetSlices( );
-
-  /*
-    #error CONTOUR_WIDGET <- ACA VOY
-    static vtkSmartPointer<vtkOrientedGlyphContourRepresentation> contourRep =
-    vtkSmartPointer<vtkOrientedGlyphContourRepresentation>::New();
-    static vtkSmartPointer<vtkContourWidget> contourWidget =
-    vtkSmartPointer<vtkContourWidget>::New();
-    contourWidget->SetInteractor( zi );
-    contourWidget->SetRepresentation( contourRep );
-    contourWidget->On( );
-  */
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+_RenderCommand( void* data )
+{
+  MPRActors* actors = reinterpret_cast< MPRActors* >( data );
+  if( actors == NULL )
+    return;
+  actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
+  actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
+  actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 0 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 1 ]->Render( 1e-3 );
+  actors->Slices[ 1 ][ 2 ]->Render( 1e-3 );
 }
 
 // eof - $RCSfile$