]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/ImageSliceActors.cxx
Some bugs...
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageSliceActors.cxx
index 4d20994be61a7ebb29874cd23229feded8513193..88a0a4bc7d8a3c6cb47c0bd31239bec3781ced68 100644 (file)
@@ -1,23 +1,29 @@
 #include <cpExtensions/Visualization/ImageSliceActors.h>
 
-#include <cmath>
+#include <cstring>
 #include <sstream>
 
 #include <vtkAlgorithmOutput.h>
 #include <vtkCamera.h>
 #include <vtkCellArray.h>
 #include <vtkImageData.h>
-#include <vtkInformation.h>
-#include <vtkPlane.h>
+#include <vtkImageProperty.h>
 #include <vtkPoints.h>
 #include <vtkProperty.h>
 #include <vtkRenderer.h>
 #include <vtkRendererCollection.h>
 #include <vtkRenderWindow.h>
 #include <vtkRenderWindowInteractor.h>
-#include <vtkStreamingDemandDrivenPipeline.h>
 #include <vtkTextProperty.h>
-#include <vtkWindowLevelLookupTable.h>
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::ImageSliceActors::
+m_PlaneColors[ 3 ][ 3 ] =
+{
+  { 1, 0, 0 },
+  { 0, 1, 0 },
+  { 0, 0, 1 }
+};
 
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::ImageSliceActors*
@@ -29,144 +35,101 @@ New( )
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-AddInputConnection( vtkAlgorithmOutput* aout, int axis )
+SetAxis( int axis )
+{
+  this->m_ImageMapper->SetOrientation( axis );
+  this->m_BlenderMapper->SetOrientation( axis );
+  this->m_ImageMapper->Update( );
+  this->m_BlenderMapper->Update( );
+  this->SetSliceNumber( this->GetSliceNumberMinValue( ) );
+  this->m_ImageActor->Modified( );
+  this->m_BlenderActor->Modified( );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+SetInputConnection( vtkAlgorithmOutput* aout )
 {
   // Get input vtkImageData
   if( aout == NULL )
     return;
-  vtkAlgorithm* producer = aout->GetProducer( );
-  vtkImageData* data = dynamic_cast< vtkImageData* >(
-    producer->GetOutputDataObject( aout->GetIndex( ) )
-    );
-  if( data == NULL )
-    return;
-
-  // Try to infere if input comes from a color mapping filter
-  vtkImageMapToColors* new_map =
-    dynamic_cast< vtkImageMapToColors* >( producer );
-  if( new_map == NULL )
-  {
-    // Configure LUT, if possible (NULL is returned if not)
-    this->_ConfigureNewLUT( data );
-    new_map = *( this->m_ImageMaps.rbegin( ) );
-    if( new_map != NULL )
-    {
-      new_map->SetInputConnection( aout );
-      new_map->Update( );
-
-    } // fi
-  }
-  else
-    this->m_ImageMaps.push_back( new_map );
-
-  // Update window level values
-  if( new_map != NULL )
-  {
-    double range[ 2 ];
-    dynamic_cast< vtkImageData* >( new_map->GetInput( ) )->
-      GetScalarRange( range );
-    this->m_MinWindow = double( 0 );
-    this->m_MaxWindow = range[ 1 ] - range[ 0 ];
-    this->m_MinLevel = range[ 0 ];
-    this->m_MaxLevel = range[ 1 ];
-
-  } // fi
 
   // Create mapper and actors
-  vtkSmartPointer< vtkImageSliceMapper > mapper =
-    vtkSmartPointer< vtkImageSliceMapper >::New( );
-  if( new_map != NULL )
-    mapper->SetInputConnection( new_map->GetOutputPort( ) );
-  else
-    mapper->SetInputConnection( aout );
-  this->m_SliceMappers.push_back( mapper );
-  this->_ConfigureNewInput( axis );
+  this->m_ImageMapper->SetInputConnection( aout );
+  this->_ConfigureInputImage( );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-AddInputData( vtkImageData* data, int axis )
+SetInputImage( vtkImageData* data )
 {
-  // Update window level values
-  if( this->m_ImageMaps.size( ) == 0 )
-  {
-    double range[ 2 ];
-    data->GetScalarRange( range );
-    this->m_MinWindow = double( 0 );
-    this->m_MaxWindow = range[ 1 ] - range[ 0 ];
-    this->m_MinLevel = range[ 0 ];
-    this->m_MaxLevel = range[ 1 ];
-
-  } // fi
+  // Get input vtkImageData
+  if( data == NULL )
+    return;
 
-  // Configure LUT, if possible (NULL is returned if not)
-  this->_ConfigureNewLUT( data );
-  vtkImageMapToColors* new_map = *( this->m_ImageMaps.rbegin( ) );
-  if( new_map != NULL )
-  {
-    new_map->SetInputData( data );
-    new_map->Update( );
+  // Create mapper and actors
+  this->m_ImageMapper->SetInputData( data );
+  this->_ConfigureInputImage( );
+}
 
-  } // fi
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::ImageSliceActors::
+AddBinaryConnection(
+  vtkAlgorithmOutput* aout,
+  const double& r, const double& g, const double& b
+  )
+{
+  if( aout == NULL )
+    return( -1 );
+  this->m_Blender->AddInputConnection( aout );
+  this->_ConfigureBinaryImage( r, g, b );
+  return( this->m_Blender->GetNumberOfInputs( ) - 1 );
+}
 
-  // Create mapper and actors
-  vtkSmartPointer< vtkImageSliceMapper > mapper =
-    vtkSmartPointer< vtkImageSliceMapper >::New( );
-  if( new_map != NULL )
-    mapper->SetInputConnection( new_map->GetOutputPort( ) );
-  else
-    mapper->SetInputData( data );
-  this->m_SliceMappers.push_back( mapper );
-  this->_ConfigureNewInput( axis );
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::ImageSliceActors::
+AddBinaryImage(
+  vtkImageData* data,
+  const double& r, const double& g, const double& b
+  )
+{
+  if( data == NULL )
+    return( -1 );
+  this->m_Blender->AddInputData( data );
+  this->_ConfigureBinaryImage( r, g, b );
+  return( this->m_Blender->GetNumberOfInputs( ) - 1 );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 Clear( )
 {
-  // Reset values
-  this->m_MinWindow = double( 0 );
-  this->m_MaxWindow = double( 0 );
-  this->m_MinLevel = double( 0 );
-  this->m_MaxLevel = double( 0 );
-  this->m_VisibleExtent[ 0 ] =
-    this->m_VisibleExtent[ 2 ] =
-    this->m_VisibleExtent[ 4 ] = -1;
-  this->m_VisibleExtent[ 1 ] =
-    this->m_VisibleExtent[ 3 ] =
-    this->m_VisibleExtent[ 5 ] = 0;
-  this->m_VisibleBounds[ 0 ] =
-    this->m_VisibleBounds[ 2 ] =
-    this->m_VisibleBounds[ 4 ] = double( 0 );
-  this->m_VisibleBounds[ 1 ] =
-    this->m_VisibleBounds[ 3 ] =
-    this->m_VisibleBounds[ 5 ] = double( 0 );
-
   // Unbind from container
   this->RemoveAllItems( );
 
-  // Delete all images
-  this->m_ImageMaps.clear( );
-  this->m_SliceMappers.clear( );
-  this->m_ImageActors.clear( );
-
-  // Reconfigure unique objects
-  this->m_Cursor               = vtkSmartPointer< vtkPolyData >::New( );
-  this->m_CursorMapper         = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->m_CursorActor          = vtkSmartPointer< vtkActor >::New( );
-  this->m_HorizontalLine       = vtkSmartPointer< vtkPolyData >::New( );
-  this->m_HorizontalLineMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->m_HorizontalLineActor  = vtkSmartPointer< vtkActor >::New( );
-  this->m_VerticalLine         = vtkSmartPointer< vtkPolyData >::New( );
-  this->m_VerticalLineMapper   = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->m_VerticalLineActor    = vtkSmartPointer< vtkActor >::New( );
-  this->m_Plane                = vtkSmartPointer< vtkPolyData >::New( );
-  this->m_PlaneMapper          = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->m_TextActor            = vtkSmartPointer< vtkTextActor >::New( );
-  this->m_PlaneActor           = vtkSmartPointer< vtkActor >::New( );
-  this->m_TextBuffer[ 0 ] = '\0';
+  // Filters and mappers
+  this->m_ImageMapper   = vtkSmartPointer< vtkImageSliceMapper >::New( );
+  this->m_ImageActor    = vtkSmartPointer< vtkImageActor >::New( );
+  this->m_Blender       = vtkSmartPointer< TBlender >::New( );
+  this->m_BlenderMapper = vtkSmartPointer< vtkImageSliceMapper >::New( );
+  this->m_BlenderLUT    = vtkSmartPointer< vtkLookupTable >::New( );
+  this->m_BlenderActor  = vtkSmartPointer< vtkImageActor >::New( );
+
+  this->m_ImageActor->SetMapper( this->m_ImageMapper );
+  this->m_BlenderMapper->
+    SetInputConnection( this->m_Blender->GetOutputPort( ) );
+
+  this->m_BlenderLUT->SetNumberOfTableValues( 1 );
+  this->m_BlenderLUT->SetTableRange( 0, 1 );
+  this->m_BlenderLUT->SetTableValue( 0, 0, 0, 0, 0 );
+  this->m_BlenderLUT->Build( );
 
-  // Unique objects configuration
+  this->m_BlenderActor->SetMapper( this->m_BlenderMapper );
+  this->m_BlenderActor->GetProperty( )->SetLookupTable( this->m_BlenderLUT );
+  this->m_BlenderActor->GetProperty( )->UseLookupTableScalarRangeOn( );
+
+  // White cursor
   vtkSmartPointer< vtkPoints > cursor_points =
     vtkSmartPointer< vtkPoints >::New( );
   vtkSmartPointer< vtkCellArray > cursor_lines =
@@ -175,26 +138,28 @@ Clear( )
   cursor_points->InsertNextPoint( 0, 0, 0 );
   cursor_points->InsertNextPoint( 0, 0, 0 );
   cursor_points->InsertNextPoint( 0, 0, 0 );
-  cursor_points->InsertNextPoint( 0, 0, 0 );
-  cursor_points->InsertNextPoint( 0, 0, 0 );
-  cursor_points->InsertNextPoint( 0, 0, 0 );
-  cursor_points->InsertNextPoint( 0, 0, 0 );
   cursor_lines->InsertNextCell( 2 );
   cursor_lines->InsertCellPoint( 0 );
   cursor_lines->InsertCellPoint( 1 );
   cursor_lines->InsertNextCell( 2 );
   cursor_lines->InsertCellPoint( 2 );
   cursor_lines->InsertCellPoint( 3 );
-  cursor_lines->InsertNextCell( 2 );
-  cursor_lines->InsertCellPoint( 4 );
-  cursor_lines->InsertCellPoint( 5 );
-  cursor_lines->InsertNextCell( 2 );
-  cursor_lines->InsertCellPoint( 6 );
-  cursor_lines->InsertCellPoint( 7 );
+
+  this->m_Cursor = vtkSmartPointer< vtkPolyData >::New( );
+  this->m_CursorMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+  this->m_CursorActor = vtkSmartPointer< vtkActor >::New( );
+
   this->m_Cursor->SetPoints( cursor_points );
   this->m_Cursor->SetLines( cursor_lines );
   this->m_CursorMapper->SetInputData( this->m_Cursor );
   this->m_CursorActor->SetMapper( this->m_CursorMapper );
+  this->m_CursorActor->GetProperty( )->SetColor( 1, 1, 0 );
+  this->m_CursorActor->GetProperty( )->SetLineWidth( 2 );
+
+  // Plane intersections
+  this->m_Axis1       = vtkSmartPointer< vtkPolyData >::New( );
+  this->m_Axis1Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+  this->m_Axis1Actor  = vtkSmartPointer< vtkActor >::New( );
 
   vtkSmartPointer< vtkPoints > h_points =
     vtkSmartPointer< vtkPoints >::New( );
@@ -205,10 +170,14 @@ Clear( )
   h_lines->InsertNextCell( 2 );
   h_lines->InsertCellPoint( 0 );
   h_lines->InsertCellPoint( 1 );
-  this->m_HorizontalLine->SetPoints( h_points );
-  this->m_HorizontalLine->SetLines( h_lines );
-  this->m_HorizontalLineMapper->SetInputData( this->m_HorizontalLine );
-  this->m_HorizontalLineActor->SetMapper( this->m_HorizontalLineMapper );
+  this->m_Axis1->SetPoints( h_points );
+  this->m_Axis1->SetLines( h_lines );
+  this->m_Axis1Mapper->SetInputData( this->m_Axis1 );
+  this->m_Axis1Actor->SetMapper( this->m_Axis1Mapper );
+
+  this->m_Axis2       = vtkSmartPointer< vtkPolyData >::New( );
+  this->m_Axis2Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+  this->m_Axis2Actor  = vtkSmartPointer< vtkActor >::New( );
 
   vtkSmartPointer< vtkPoints > v_points =
     vtkSmartPointer< vtkPoints >::New( );
@@ -219,16 +188,20 @@ Clear( )
   v_lines->InsertNextCell( 2 );
   v_lines->InsertCellPoint( 0 );
   v_lines->InsertCellPoint( 1 );
-  this->m_VerticalLine->SetPoints( v_points );
-  this->m_VerticalLine->SetLines( v_lines );
-  this->m_VerticalLineMapper->SetInputData( this->m_VerticalLine );
-  this->m_VerticalLineActor->SetMapper( this->m_VerticalLineMapper );
+  this->m_Axis2->SetPoints( v_points );
+  this->m_Axis2->SetLines( v_lines );
+  this->m_Axis2Mapper->SetInputData( this->m_Axis2 );
+  this->m_Axis2Actor->SetMapper( this->m_Axis2Mapper );
+
+  // Plane
+  this->m_Plane       = vtkSmartPointer< vtkPolyData >::New( );
+  this->m_PlaneMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+  this->m_PlaneActor  = vtkSmartPointer< vtkActor >::New( );
 
   vtkSmartPointer< vtkPoints > plane_points =
     vtkSmartPointer< vtkPoints >::New( );
   vtkSmartPointer< vtkCellArray > plane_lines =
     vtkSmartPointer< vtkCellArray >::New( );
-
   plane_points->InsertNextPoint( 0, 0, 0 );
   plane_points->InsertNextPoint( 0, 1, 0 );
   plane_points->InsertNextPoint( 1, 1, 0 );
@@ -245,9 +218,12 @@ Clear( )
   this->m_PlaneMapper->SetInputData( this->m_Plane );
   this->m_PlaneActor->SetMapper( this->m_PlaneMapper );
 
+  // Text actor
+  this->m_TextActor = vtkSmartPointer< vtkTextActor >::New( );
+  this->m_TextBuffer[ 0 ] = '\0';
   this->m_TextActor->SetTextScaleModeToNone( );
   vtkTextProperty* textprop = this->m_TextActor->GetTextProperty( );
-  textprop->SetColor( 1, 1, 1 );
+  textprop->SetColor( 1, 1, 0 );
   textprop->SetFontFamilyToCourier( );
   textprop->SetFontSize( 18 );
   textprop->BoldOff( );
@@ -258,13 +234,6 @@ Clear( )
   vtkCoordinate* coord = this->m_TextActor->GetPositionCoordinate( );
   coord->SetCoordinateSystemToNormalizedViewport( );
   coord->SetValue( 0.01, 0.01 );
-
-  // Update actor collection
-  this->AddItem( this->m_CursorActor );
-  this->AddItem( this->m_HorizontalLineActor );
-  this->AddItem( this->m_VerticalLineActor );
-  this->AddItem( this->m_TextActor );
-  this->AddItem( this->m_PlaneActor );
 }
 
 // -------------------------------------------------------------------------
@@ -291,24 +260,22 @@ GetStyle( ) const
 
 // -------------------------------------------------------------------------
 vtkImageData* cpExtensions::Visualization::ImageSliceActors::
-GetInputImage( unsigned int id )
+GetInputImage( )
 {
-  vtkAlgorithmOutput* aout = this->m_ImageMaps[ id ]->GetOutputPort( );
-  vtkImageData* image = dynamic_cast< vtkImageData* >(
-    aout->GetProducer( )->GetOutputDataObject( aout->GetIndex( ) )
-    );
-  return( image );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+    return( this->m_ImageMapper->GetInput( ) );
+  else
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
 const vtkImageData* cpExtensions::Visualization::ImageSliceActors::
-GetInputImage( unsigned int id ) const
+GetInputImage( ) const
 {
-  vtkAlgorithmOutput* aout = this->m_ImageMaps[ id ]->GetOutputPort( );
-  const vtkImageData* image = dynamic_cast< const vtkImageData* >(
-    aout->GetProducer( )->GetOutputDataObject( aout->GetIndex( ) )
-    );
-  return( image );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+    return( this->m_ImageMapper->GetInput( ) );
+  else
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
@@ -328,15 +295,15 @@ PushActorsInto( vtkRenderWindow* window, bool force_style )
     rwi->SetInteractorStyle( this->m_Style );
 
   // Update actors
-  vtkProp* prop;
-  this->InitTraversal( );
-  while( prop = this->GetNextProp( ) )
-    renderer->AddViewProp( prop );
-  renderer->Modified( );
-  if( !force_style )
+  renderer->AddViewProp( this->m_ImageActor );
+  renderer->AddViewProp( this->m_BlenderActor );
+  if( force_style )
   {
-    renderer->RemoveViewProp( this->m_CursorActor );
-    renderer->RemoveViewProp( this->m_TextActor );
+    renderer->AddViewProp( this->m_CursorActor );
+    renderer->AddViewProp( this->m_PlaneActor );
+    renderer->AddViewProp( this->m_TextActor );
+    renderer->AddViewProp( this->m_Axis1Actor );
+    renderer->AddViewProp( this->m_Axis2Actor );
 
   } // fi
 
@@ -366,8 +333,7 @@ PushActorsInto( vtkRenderWindow* window, bool force_style )
     } // fi
 
   } // fi
-  this->ResetCamera( );
-  rwi->Render( );
+  renderer->ResetCamera( );
 }
 
 // -------------------------------------------------------------------------
@@ -376,46 +342,52 @@ PopActorsFrom( vtkRenderWindow* window )
 {
   vtkRenderWindowInteractor* rwi = window->GetInteractor( );
   vtkRenderer* renderer = window->GetRenderers( )->GetFirstRenderer( );
-
   if( renderer != NULL )
   {
-    // Update actors
-    vtkProp* prop;
-    this->InitTraversal( );
-    while( prop = this->GetNextProp( ) )
-      renderer->RemoveViewProp( prop );
-    renderer->Modified( );
+    renderer->RemoveViewProp( this->m_ImageActor );
+    renderer->RemoveViewProp( this->m_BlenderActor );
+    renderer->RemoveViewProp( this->m_CursorActor );
+    renderer->RemoveViewProp( this->m_PlaneActor );
+    renderer->RemoveViewProp( this->m_TextActor );
+    renderer->RemoveViewProp( this->m_Axis1Actor );
+    renderer->RemoveViewProp( this->m_Axis2Actor );
 
   } // fi
-  if( rwi != NULL )
-    rwi->Render( );
 }
 
 // -------------------------------------------------------------------------
 unsigned int cpExtensions::Visualization::ImageSliceActors::
-GetNumberOfImageActors( ) const
+GetNumberOfImages( ) const
 {
-  return( this->m_ImageActors.size( ) );
+  return( this->m_Blender->GetNumberOfInputs( ) );
 }
 
 // -------------------------------------------------------------------------
 vtkImageActor* cpExtensions::Visualization::ImageSliceActors::
-GetImageActor( unsigned int id )
+GetImageActor( )
 {
-  if( id < this->m_ImageActors.size( ) )
-    return( this->m_ImageActors[ id ] );
-  else
-    return( NULL );
+  return( this->m_ImageActor );
 }
 
 // -------------------------------------------------------------------------
 const vtkImageActor* cpExtensions::Visualization::ImageSliceActors::
-GetImageActor( unsigned int id ) const
+GetImageActor( ) const
 {
-  if( id < this->m_ImageActors.size( ) )
-    return( this->m_ImageActors[ id ] );
-  else
-    return( NULL );
+  return( this->m_ImageActor );
+}
+
+// -------------------------------------------------------------------------
+vtkImageActor* cpExtensions::Visualization::ImageSliceActors::
+GetBinaryActor( )
+{
+  return( this->m_BlenderActor );
+}
+
+// -------------------------------------------------------------------------
+const vtkImageActor* cpExtensions::Visualization::ImageSliceActors::
+GetBinaryActor( ) const
+{
+  return( this->m_BlenderActor );
 }
 
 // -------------------------------------------------------------------------
@@ -450,14 +422,20 @@ GetPlaneActor( ) const
 vtkPlane* cpExtensions::Visualization::ImageSliceActors::
 GetPlaneFunction( )
 {
-  return( this->m_SliceMappers[ 0 ]->GetSlicePlane( ) );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+    return( this->m_ImageMapper->GetSlicePlane( ) );
+  else
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
 const vtkPlane* cpExtensions::Visualization::ImageSliceActors::
 GetPlaneFunction( ) const
 {
-  return( this->m_SliceMappers[ 0 ]->GetSlicePlane( ) );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+    return( this->m_ImageMapper->GetSlicePlane( ) );
+  else
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
@@ -466,8 +444,8 @@ SetInterpolate( bool v )
 {
   if( this->m_Interpolate != v )
   {
-    for( unsigned int i = 0; i < this->m_ImageActors.size( ); ++i )
-      this->m_ImageActors[ i ]->SetInterpolate( v );
+    this->m_ImageActor->SetInterpolate( v );
+    this->m_BlenderActor->SetInterpolate( v );
     this->m_Interpolate = v;
     this->Modified( );
 
@@ -492,8 +470,8 @@ InterpolateOff( )
 double* cpExtensions::Visualization::ImageSliceActors::
 GetDisplayBounds( ) const
 {
-  if( this->m_ImageActors.size( ) > 0 )
-    return( this->m_ImageActors[ 0 ]->GetDisplayBounds( ) );
+  if( this->m_ImageActor.GetPointer( ) != NULL )
+    return( this->m_ImageActor->GetDisplayBounds( ) );
   else
     return( NULL );
 }
@@ -502,23 +480,21 @@ GetDisplayBounds( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 GetDisplayBounds( double bounds[ 6 ] ) const
 {
-  if( this->m_ImageActors.size( ) == 0 )
+  if( this->m_ImageActor.GetPointer( ) == NULL )
   {
-    bounds[ 0 ] = bounds[ 2 ] = bounds[ 4 ] = double( -1 );
+    bounds[ 0 ] = bounds[ 2 ] = bounds[ 4 ] = double(  0 );
     bounds[ 1 ] = bounds[ 3 ] = bounds[ 5 ] = double( -1 );
   }
   else
-    this->m_ImageActors[ 0 ]->GetDisplayBounds( bounds );
+    this->m_ImageActor->GetDisplayBounds( bounds );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 ResetCursor( )
 {
-  if( this->m_SliceMappers.size( ) > 0 )
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
   {
-    double bounds[ 6 ];
-    this->m_SliceMappers[ 0 ]->GetInput( )->GetBounds( bounds );
     double pos[] =
       {
         this->m_VisibleBounds[ 0 ],
@@ -534,10 +510,6 @@ ResetCursor( )
     points->SetPoint( 1, 0, 0, 0 );
     points->SetPoint( 2, 0, 0, 0 );
     points->SetPoint( 3, 0, 0, 0 );
-    points->SetPoint( 4, 0, 0, 0 );
-    points->SetPoint( 5, 0, 0, 0 );
-    points->SetPoint( 6, 0, 0, 0 );
-    points->SetPoint( 7, 0, 0, 0 );
     this->m_Cursor->Modified( );
     this->m_CursorMapper->Modified( );
     this->m_CursorActor->Modified( );
@@ -549,7 +521,7 @@ ResetCursor( )
 void cpExtensions::Visualization::ImageSliceActors::
 SetCursor( double pos[ 3 ] )
 {
-  if( this->m_SliceMappers.size( ) == 0 )
+  if( this->m_ImageMapper.GetPointer( ) == NULL )
     return;
 
   // Get ordered axes
@@ -562,96 +534,137 @@ SetCursor( double pos[ 3 ] )
 
   // Update cross
   double* bounds = this->m_VisibleBounds;
-  double
-    p0[ 3 ], p1[ 3 ], p2[ 3 ], p3[ 3 ],
-    p4[ 3 ], p5[ 3 ], p6[ 3 ], p7[ 3 ];
+  double p0[ 3 ], p1[ 3 ], p2[ 3 ], p3[ 3 ];
 
-  p0[ a2 ] = p1[ a2 ] = p4[ a2 ] = p5[ a2 ] = pos[ a2 ];
-  p2[ a1 ] = p3[ a1 ] = p6[ a1 ] = p7[ a1 ] = pos[ a1 ];
+  p0[ a2 ] = p1[ a2 ] = pos[ a2 ];
+  p2[ a1 ] = p3[ a1 ] = pos[ a1 ];
   p0[ a0 ] = p1[ a0 ] = p2[ a0 ] = p3[ a0 ] = bounds[ ma0 ];
-  p4[ a0 ] = p5[ a0 ] = p6[ a0 ] = p7[ a0 ] = bounds[ ma0 + 1 ];
-  p0[ a1 ] = p4[ a1 ] = bounds[ ma1 ];
-  p1[ a1 ] = p5[ a1 ] = bounds[ ma1 + 1 ];
-  p2[ a2 ] = p6[ a2 ] = bounds[ ma2 ];
-  p3[ a2 ] = p7[ a2 ] = bounds[ ma2 + 1 ];
+  p0[ a1 ] = bounds[ ma1 ];
+  p1[ a1 ] = bounds[ ma1 + 1 ];
+  p2[ a2 ] = bounds[ ma2 ];
+  p3[ a2 ] = bounds[ ma2 + 1 ];
 
   vtkPoints* points = this->m_Cursor->GetPoints( );
   points->SetPoint( 0, p0 );
   points->SetPoint( 1, p1 );
   points->SetPoint( 2, p2 );
   points->SetPoint( 3, p3 );
-  points->SetPoint( 4, p4 );
-  points->SetPoint( 5, p5 );
-  points->SetPoint( 6, p6 );
-  points->SetPoint( 7, p7 );
   this->m_Cursor->Modified( );
   this->m_CursorMapper->Modified( );
   this->m_CursorActor->Modified( );
 }
 
 // -------------------------------------------------------------------------
-vtkImageMapToColors* cpExtensions::Visualization::ImageSliceActors::
-GetImageMap( unsigned int id )
+void cpExtensions::Visualization::ImageSliceActors::
+ResetAxesCursor( )
 {
-  if( id < this->m_ImageMaps.size( ) )
-    return( this->m_ImageMaps[ id ].GetPointer( ) );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+  {
+    double pos[] =
+      {
+        this->m_VisibleBounds[ 0 ],
+        this->m_VisibleBounds[ 2 ],
+        this->m_VisibleBounds[ 4 ]
+      };
+    this->SetAxesCursor( pos );
+  }
   else
-    return( NULL );
+  {
+    vtkPoints* points = this->m_Axis1->GetPoints( );
+    points->SetPoint( 0, 0, 0, 0 );
+    points->SetPoint( 1, 0, 0, 0 );
+    this->m_Axis1->Modified( );
+    this->m_Axis1Mapper->Modified( );
+    this->m_Axis1Actor->Modified( );
+
+    points = this->m_Axis2->GetPoints( );
+    points->SetPoint( 0, 0, 0, 0 );
+    points->SetPoint( 1, 0, 0, 0 );
+    this->m_Axis2->Modified( );
+    this->m_Axis2Mapper->Modified( );
+    this->m_Axis2Actor->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-const vtkImageMapToColors* cpExtensions::Visualization::ImageSliceActors::
-GetImageMap( unsigned int id ) const
+void cpExtensions::Visualization::ImageSliceActors::
+SetAxesCursor( double pos[ 3 ] )
 {
-  if( id < this->m_ImageMaps.size( ) )
-    return( this->m_ImageMaps[ id ].GetPointer( ) );
-  else
-    return( NULL );
+  if( this->m_ImageMapper.GetPointer( ) == NULL )
+    return;
+
+  // Get ordered axes
+  int a0 = this->GetAxis( );
+  int a1 = ( a0 + 1 ) % 3;
+  int a2 = ( a0 + 2 ) % 3;
+  int ma0 = a0 << 1;
+  int ma1 = a1 << 1;
+  int ma2 = a2 << 1;
+
+  // Update cross
+  double* bounds = this->m_VisibleBounds;
+  double p0[ 3 ], p1[ 3 ], p2[ 3 ], p3[ 3 ];
+
+  p0[ a2 ] = p1[ a2 ] = pos[ a2 ];
+  p2[ a1 ] = p3[ a1 ] = pos[ a1 ];
+  p0[ a0 ] = p1[ a0 ] = p2[ a0 ] = p3[ a0 ] = bounds[ ma0 ];
+  p0[ a1 ] = bounds[ ma1 ];
+  p1[ a1 ] = bounds[ ma1 + 1 ];
+  p2[ a2 ] = bounds[ ma2 ];
+  p3[ a2 ] = bounds[ ma2 + 1 ];
+
+  vtkPoints* points1 = this->m_Axis1->GetPoints( );
+  points1->SetPoint( 0, p2 );
+  points1->SetPoint( 1, p3 );
+
+  vtkPoints* points2 = this->m_Axis2->GetPoints( );
+  points2->SetPoint( 0, p0 );
+  points2->SetPoint( 1, p1 );
+
+  this->m_Axis1->Modified( );
+  this->m_Axis1Mapper->Modified( );
+  this->m_Axis1Actor->Modified( );
+
+  this->m_Axis2->Modified( );
+  this->m_Axis2Mapper->Modified( );
+  this->m_Axis2Actor->Modified( );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetMinWindow( ) const
 {
-  return( this->m_MinWindow );
+  return( this->m_WLRange[ 0 ] );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetMaxWindow( ) const
 {
-  return( this->m_MaxWindow );
+  return( this->m_WLRange[ 1 ] );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetMinLevel( ) const
 {
-  return( this->m_MinLevel );
+  return( this->m_WLRange[ 2 ] );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetMaxLevel( ) const
 {
-  return( this->m_MaxLevel );
+  return( this->m_WLRange[ 3 ] );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetWindow( ) const
 {
-  if( this->m_ImageMaps.size( ) == 0 )
-    return( double( 0 ) );
-  if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL )
-    return( double( 0 ) );
-
-  vtkWindowLevelLookupTable* lut =
-    dynamic_cast< vtkWindowLevelLookupTable* >(
-      this->m_ImageMaps[ 0 ]->GetLookupTable( )
-      );
-  if( lut != NULL )
-    return( lut->GetWindow( ) );
+  if( this->m_ImageActor.GetPointer( ) != NULL )
+    return( this->m_ImageActor->GetProperty( )->GetColorWindow( ) );
   else
     return( double( 0 ) );
 }
@@ -660,17 +673,8 @@ GetWindow( ) const
 double cpExtensions::Visualization::ImageSliceActors::
 GetLevel( ) const
 {
-  if( this->m_ImageMaps.size( ) == 0 )
-    return( double( 0 ) );
-  if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL )
-    return( double( 0 ) );
-
-  vtkWindowLevelLookupTable* lut =
-    dynamic_cast< vtkWindowLevelLookupTable* >(
-      this->m_ImageMaps[ 0 ]->GetLookupTable( )
-      );
-  if( lut != NULL )
-    return( lut->GetLevel( ) );
+  if( this->m_ImageActor.GetPointer( ) != NULL )
+    return( this->m_ImageActor->GetProperty( )->GetColorLevel( ) );
   else
     return( double( 0 ) );
 }
@@ -679,175 +683,55 @@ GetLevel( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 SetWindow( double w )
 {
-  if( this->m_ImageMaps.size( ) == 0 )
-    return;
-  if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL )
+  if( this->m_ImageActor.GetPointer( ) == NULL )
     return;
-  vtkWindowLevelLookupTable* lut =
-    dynamic_cast< vtkWindowLevelLookupTable* >(
-      this->m_ImageMaps[ 0 ]->GetLookupTable( )
-      );
-  if( lut == NULL )
-    return;
-
-  if( w < this->m_MinWindow )
-    w = this->m_MinWindow;
-  if( w > this->m_MaxWindow )
-    w = this->m_MaxWindow;
-
-  lut->SetWindow( w );
-  lut->Build( );
-  this->m_ImageMaps[ 0 ]->Modified( );
-  this->Modified( );
+  double v = ( w < this->m_WLRange[ 0 ] )? this->m_WLRange[ 0 ]: w;
+  v        = ( v > this->m_WLRange[ 1 ] )? this->m_WLRange[ 1 ]: v;
+  this->m_ImageActor->GetProperty( )->SetColorWindow( v );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 SetLevel( double l )
 {
-  if( this->m_ImageMaps.size( ) == 0 )
-    return;
-  if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL )
-    return;
-  vtkWindowLevelLookupTable* lut =
-    dynamic_cast< vtkWindowLevelLookupTable* >(
-      this->m_ImageMaps[ 0 ]->GetLookupTable( )
-      );
-  if( lut == NULL )
+  if( this->m_ImageActor.GetPointer( ) == NULL )
     return;
-
-  if( l < this->m_MinLevel )
-    l = this->m_MinLevel;
-  if( l > this->m_MaxLevel )
-    l = this->m_MaxLevel;
-
-  lut->SetLevel( l );
-  lut->Build( );
-  this->m_ImageMaps[ 0 ]->Modified( );
-  this->Modified( );
+  double v = ( l < this->m_WLRange[ 2 ] )? this->m_WLRange[ 2 ]: l;
+  v        = ( v > this->m_WLRange[ 3 ] )? this->m_WLRange[ 3 ]: v;
+  this->m_ImageActor->GetProperty( )->SetColorLevel( v );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 SetWindowLevel( double w, double l )
 {
-  if( this->m_ImageMaps.size( ) == 0 )
+  if( this->m_ImageActor.GetPointer( ) == NULL )
     return;
-  if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL )
-    return;
-  vtkWindowLevelLookupTable* lut =
-    dynamic_cast< vtkWindowLevelLookupTable* >(
-      this->m_ImageMaps[ 0 ]->GetLookupTable( )
-      );
-  if( lut == NULL )
-    return;
-
-  if( w < this->m_MinWindow )
-    w = this->m_MinWindow;
-  if( w > this->m_MaxWindow )
-    w = this->m_MaxWindow;
-  if( l < this->m_MinLevel )
-    l = this->m_MinLevel;
-  if( l > this->m_MaxLevel )
-    l = this->m_MaxLevel;
-
-  lut->SetWindow( w );
-  lut->SetLevel( l );
-  lut->Build( );
-  this->m_ImageMaps[ 0 ]->Modified( );
-  this->UpdateText( w, l );
-  this->Modified( );
+  double a = ( w < this->m_WLRange[ 0 ] )? this->m_WLRange[ 0 ]: w;
+  a        = ( a > this->m_WLRange[ 1 ] )? this->m_WLRange[ 1 ]: a;
+  double b = ( l < this->m_WLRange[ 2 ] )? this->m_WLRange[ 2 ]: l;
+  b        = ( b > this->m_WLRange[ 3 ] )? this->m_WLRange[ 3 ]: b;
+  this->m_ImageActor->GetProperty( )->SetColorWindow( a );
+  this->m_ImageActor->GetProperty( )->SetColorLevel( b );
+  this->UpdateText( a, b );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 ResetWindowLevel( )
 {
-  static const double _2 = double( 2 );
   this->SetWindowLevel(
-    this->m_MaxWindow, ( this->m_MaxLevel + this->m_MinLevel ) / _2
-    );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-SetLookupTable( unsigned int id, vtkLookupTable* lut )
-{
-  if( id < this->m_ImageMaps.size( ) && id > 0 )
-  {
-    if( this->m_ImageMaps[ id ].GetPointer( ) != NULL )
-    {
-      this->m_ImageMaps[ id ]->SetLookupTable( lut );
-      this->m_ImageMaps[ id ]->Modified( );
-      this->Modified( );
-
-    } // fi
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-SetLookupTableAsColor( unsigned int id, double r, double g, double b )
-{
-  static const double _0 = double( 0 );
-  static const double _2 = double( 2 );
-  static const double _4 = double( 4 );
-  static const double _6 = double( 6 );
-  static const double _OPACITY = double( 0.6 );
-
-  // Check ID consistency
-  if( id == 0 || id >= this->m_ImageMaps.size( ) )
-    return;
-
-  // Get image scalar range
-  vtkAlgorithmOutput* aout = this->m_ImageMaps[ id ]->GetOutputPort( );
-  vtkImageData* image = dynamic_cast< vtkImageData* >(
-    aout->GetProducer( )->GetOutputDataObject( aout->GetIndex( ) )
+    this->m_WLRange[ 1 ] * double( 0.5 ),
+    ( this->m_WLRange[ 3 ] + this->m_WLRange[ 2 ] ) * double( 0.5 )
     );
-  double range[ 2 ];
-  image->GetScalarRange( range );
-
-  // Get HSV from display color
-  double cmax = ( r > g )? r: g; cmax = ( b > cmax )? b: cmax;
-  double cmin = ( r < g )? r: g; cmin = ( b < cmin )? b: cmin;
-  double d = cmax - cmin;
-
-  double saturation = ( std::fabs( cmax ) > _0 )? d / cmax: _0;
-  double value = cmax;
-  double hue = _0;
-  if( d > _0 )
-  {
-    if( r == cmax )
-      hue = std::fmod( ( g - b ) / d, _6 );
-    else if( g == cmax )
-      hue = ( ( b - r ) / d ) + _2;
-    else if( b == cmax )
-      hue = ( ( r - g ) / d ) + _4;
-    hue /= _6;
-
-  } // fi
-
-  // Define new lookup table
-  vtkSmartPointer< vtkLookupTable > lut =
-    vtkSmartPointer< vtkLookupTable >::New( );
-  lut->SetScaleToLinear( );
-  lut->SetNanColor( _0, _0, _0, _0 );
-  lut->SetTableRange( range[ 0 ], range[ 1 ] );
-  lut->SetAlphaRange( _0, _OPACITY );
-  lut->SetHueRange( _0, hue );
-  lut->SetSaturationRange( _0, saturation );
-  lut->SetValueRange( _0, value );
-  lut->Build( );
-  this->SetLookupTable( id, lut );
 }
 
 // -------------------------------------------------------------------------
 int cpExtensions::Visualization::ImageSliceActors::
 GetAxis( ) const
 {
-  if( this->m_SliceMappers.size( ) > 0 )
-    return( this->m_SliceMappers[ 0 ]->GetOrientation( ) );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+    return( this->m_ImageMapper->GetOrientation( ) );
   else
     return( -1 );
 }
@@ -856,8 +740,8 @@ GetAxis( ) const
 int cpExtensions::Visualization::ImageSliceActors::
 GetSliceNumber( ) const
 {
-  if( this->m_SliceMappers.size( ) > 0 )
-    return( this->m_SliceMappers[ 0 ]->GetSliceNumber( ) );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+    return( this->m_ImageMapper->GetSliceNumber( ) );
   else
     return( -1 );
 }
@@ -866,8 +750,8 @@ GetSliceNumber( ) const
 int cpExtensions::Visualization::ImageSliceActors::
 GetSliceNumberMinValue( ) const
 {
-  if( this->m_SliceMappers.size( ) > 0 )
-    return( this->m_SliceMappers[ 0 ]->GetSliceNumberMinValue( ) );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+    return( this->m_ImageMapper->GetSliceNumberMinValue( ) );
   else
     return( -1 );
 }
@@ -876,8 +760,8 @@ GetSliceNumberMinValue( ) const
 int cpExtensions::Visualization::ImageSliceActors::
 GetSliceNumberMaxValue( ) const
 {
-  if( this->m_SliceMappers.size( ) > 0 )
-    return( this->m_SliceMappers[ 0 ]->GetSliceNumberMaxValue( ) );
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
+    return( this->m_ImageMapper->GetSliceNumberMaxValue( ) );
   else
     return( -1 );
 }
@@ -886,52 +770,44 @@ GetSliceNumberMaxValue( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 SetSliceNumber( const int& slice )
 {
-  unsigned int nImages = this->m_SliceMappers.size( );
-  if( nImages == 0 )
+  if( this->m_ImageMapper.GetPointer( ) == NULL )
     return;
 
   int axis = this->GetAxis( );
   double prev_pos = this->m_VisibleBounds[ axis << 1 ];
 
-  // Change visualization extent
-  for( unsigned int i = 0; i < nImages; ++i )
-  {
-    // Update mappers and display bounds
-    this->m_SliceMappers[ i ]->SetSliceNumber( slice );
-    this->m_SliceMappers[ i ]->Modified( );
-    this->m_ImageActors[ i ]->Modified( );
-    this->m_SliceMappers[ i ]->Update( );
-
-    // Update display extent (this isn't done automatically)
-    if( i == 0 )
-    {
-      this->m_SliceMappers[ i ]->GetInput( )->
-        GetExtent( this->m_VisibleExtent );
-      this->m_VisibleExtent[ axis << 1 ] = slice;
-      this->m_VisibleExtent[ ( axis << 1 ) + 1 ] = slice;
-
-    } // fi
-    this->m_ImageActors[ i ]->SetDisplayExtent( this->m_VisibleExtent );
-
-  } // rof
-
-  this->m_SliceMappers[ 0 ]->GetBounds( this->m_VisibleBounds );
+  // Update mappers and display bounds
+  this->m_ImageMapper->SetSliceNumber( slice );
+  this->m_BlenderMapper->SetSliceNumber( slice );
+  this->m_ImageMapper->Modified( );
+  this->m_BlenderMapper->Modified( );
+  this->m_ImageActor->Modified( );
+  this->m_BlenderActor->Modified( );
+
+  // Update display extent (this isn't done automatically)
+  this->m_ImageMapper->GetInput( )->GetExtent( this->m_VisibleExtent );
+  this->m_VisibleExtent[ axis << 1 ] = slice;
+  this->m_VisibleExtent[ ( axis << 1 ) + 1 ] = slice;
+  this->m_ImageActor->SetDisplayExtent( this->m_VisibleExtent );
+
+  // Prepare plane data
+  this->m_ImageMapper->GetBounds( this->m_VisibleBounds );
   double x0[][ 3 ] =
-  {
     {
-      this->m_VisibleBounds[ 0 ],
-      this->m_VisibleBounds[ 2 ],
-      this->m_VisibleBounds[ 4 ]
-    },
-    {
-      this->m_VisibleBounds[ 1 ],
-      this->m_VisibleBounds[ 3 ],
-      this->m_VisibleBounds[ 5 ]
-    }
-  };
+      {
+        this->m_VisibleBounds[ 0 ],
+        this->m_VisibleBounds[ 2 ],
+        this->m_VisibleBounds[ 4 ]
+      },
+      {
+        this->m_VisibleBounds[ 1 ],
+        this->m_VisibleBounds[ 3 ],
+        this->m_VisibleBounds[ 5 ]
+      }
+    };
   double p0[ 2 ][ 3 ];
 
-  vtkPlane* plane = this->m_SliceMappers[ 0 ]->GetSlicePlane( );
+  vtkPlane* plane = this->m_ImageMapper->GetSlicePlane( );
   plane->GeneralizedProjectPoint( x0[ 0 ], p0[ 0 ] );
   plane->GeneralizedProjectPoint( x0[ 1 ], p0[ 1 ] );
 
@@ -953,43 +829,36 @@ SetSliceNumber( const int& slice )
   {
     plane_points->SetPoint( 1, bnds[ 1 ], bnds[ 2 ], bnds[ 5 ] );
     plane_points->SetPoint( 3, bnds[ 0 ], bnds[ 3 ], bnds[ 4 ] );
-    if( axis == 0 )
-      this->m_PlaneActor->GetProperty( )->SetColor( 1, 0, 0 );
-    else
-      this->m_PlaneActor->GetProperty( )->SetColor( 0, 0, 1 );
   }
   else if( axis == 1 ) // ZX, y-normal
   {
     plane_points->SetPoint( 1, bnds[ 0 ], bnds[ 2 ], bnds[ 5 ] );
     plane_points->SetPoint( 3, bnds[ 1 ], bnds[ 3 ], bnds[ 4 ] );
-    this->m_PlaneActor->GetProperty( )->SetColor( 0, 1, 0 );
 
   } // fi
+
+  // Set plane colors
+  this->m_PlaneActor->GetProperty( )->
+    SetColor( this->m_PlaneColors[ axis ] );
+  this->m_Axis1Actor->GetProperty( )->
+    SetColor( this->m_PlaneColors[ ( axis + 1 ) % 3 ] );
+  this->m_Axis2Actor->GetProperty( )->
+    SetColor( this->m_PlaneColors[ ( axis + 2 ) % 3 ] );
+
   this->m_Plane->Modified( );
   this->m_PlaneMapper->Modified( );
   this->m_PlaneActor->Modified( );
 
-  // Update text
-  this->UpdateText( );
-
-  // Update lines from associated slices
-  /* TODO
-     auto sIt = this->m_AssociatedSlices.begin( );
-     for( ; sIt != this->m_AssociatedSlices.end( ); ++sIt )
-     {
-     Self* slice = *sIt;
-     for( unsigned int id = 0; id < slice->m_AssociatedSlices.size( ); ++id )
-     {
-     std::cout << id << std::endl;
-     if( slice->m_AssociatedSlices[ id ] != this )
-     continue;
-
-     std::cout << "id : " << id << std::endl;
+  this->m_Axis1->Modified( );
+  this->m_Axis1Mapper->Modified( );
+  this->m_Axis1Actor->Modified( );
 
-     } // rof
+  this->m_Axis2->Modified( );
+  this->m_Axis2Mapper->Modified( );
+  this->m_Axis2Actor->Modified( );
 
-     } // rof
-  */
+  // Update text
+  this->UpdateText( );
 
   // Update camera position
   if( this->m_Window == NULL )
@@ -1011,12 +880,9 @@ SetSliceNumber( const int& slice )
 void cpExtensions::Visualization::ImageSliceActors::
 SetSlice( double* pos )
 {
-  vtkImageData* image;
-  if( this->m_ImageMaps[ 0 ] != NULL )
-    image =
-      dynamic_cast< vtkImageData* >( this->m_ImageMaps[ 0 ]->GetInput( ) );
-  else
-    image = this->m_SliceMappers[ 0 ]->GetInput( );
+  vtkImageData* image = this->GetInputImage( );
+  if( image == NULL )
+    return;
 
   int ijk[ 3 ];
   double pcoords[ 3 ];
@@ -1028,17 +894,17 @@ SetSlice( double* pos )
 void cpExtensions::Visualization::ImageSliceActors::
 UpdateText( )
 {
-  if( this->m_SliceMappers.size( ) > 0 )
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
   {
     char axis;
-    int axId = this->m_SliceMappers[ 0 ]->GetOrientation( );
+    int axId = this->m_ImageMapper->GetOrientation( );
     if     ( axId == 0 ) axis = 'X';
     else if( axId == 1 ) axis = 'Y';
     else if( axId == 2 ) axis = 'Z';
 
     std::sprintf(
       this->m_TextBuffer, "Axis: %c (%d)",
-      axis, this->m_SliceMappers[ 0 ]->GetSliceNumber( )
+      axis, this->m_ImageMapper->GetSliceNumber( )
       );
   }
   else
@@ -1052,22 +918,16 @@ UpdateText( )
 void cpExtensions::Visualization::ImageSliceActors::
 UpdateText( double pos[ 3 ] )
 {
-  if( this->m_SliceMappers.size( ) > 0 )
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
   {
     char axis;
-    int axId = this->m_SliceMappers[ 0 ]->GetOrientation( );
+    int axId = this->m_ImageMapper->GetOrientation( );
     if     ( axId == 0 ) axis = 'X';
     else if( axId == 1 ) axis = 'Y';
     else if( axId == 2 ) axis = 'Z';
     int slice = this->GetSliceNumber( );
 
-    vtkImageData* image;
-    if( this->m_ImageMaps[ 0 ] != NULL )
-      image =
-        dynamic_cast< vtkImageData* >( this->m_ImageMaps[ 0 ]->GetInput( ) );
-    else
-      image = this->m_SliceMappers[ 0 ]->GetInput( );
-
+    vtkImageData* image = this->GetInputImage( );
     int ijk[ 3 ];
     double pcoords[ 3 ];
     image->ComputeStructuredCoordinates( pos, ijk, pcoords );
@@ -1114,17 +974,17 @@ UpdateText( double pos[ 3 ] )
 void cpExtensions::Visualization::ImageSliceActors::
 UpdateText( const double& w, const double& l )
 {
-  if( this->m_SliceMappers.size( ) > 0 )
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
   {
     char axis;
-    int axId = this->m_SliceMappers[ 0 ]->GetOrientation( );
+    int axId = this->m_ImageMapper->GetOrientation( );
     if     ( axId == 0 ) axis = 'X';
     else if( axId == 1 ) axis = 'Y';
     else if( axId == 2 ) axis = 'Z';
 
     std::sprintf(
       this->m_TextBuffer, "Axis: %c (%d)\nW/L (%.2f/%.2f)",
-      axis, this->m_SliceMappers[ 0 ]->GetSliceNumber( ), w, l
+      axis, this->m_ImageMapper->GetSliceNumber( ), w, l
       );
   }
   else
@@ -1136,17 +996,16 @@ UpdateText( const double& w, const double& l )
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-Render( const double& t )
+Render( )
 {
-  if( this->m_Window != NULL )
-  {
-    vtkRenderer* renderer =
-      this->m_Window->GetRenderers( )->GetFirstRenderer( );
-    if( renderer != NULL )
-      renderer->SetAllocatedRenderTime( t );
-    this->m_Window->Render( );
-
-  } // fi
+  if( this->m_Window == NULL )
+    return;
+  vtkRenderer* renderer =
+    this->m_Window->GetRenderers( )->GetFirstRenderer( );
+  if( renderer == NULL )
+    return;
+  renderer->SetAllocatedRenderTime( 1e-3 );
+  this->m_Window->Render( );
 }
 
 // -------------------------------------------------------------------------
@@ -1157,8 +1016,9 @@ ResetCamera( )
     return;
   vtkRenderer* renderer =
     this->m_Window->GetRenderers( )->GetFirstRenderer( );
-  if( renderer != NULL )
-    renderer->ResetCamera( this->m_VisibleBounds );
+  if( renderer == NULL )
+    return;
+  renderer->ResetCamera( );
 }
 
 // -------------------------------------------------------------------------
@@ -1184,6 +1044,7 @@ _ConfigureStyle( )
 {
   // Connect this view with a controller
   this->m_Style = vtkSmartPointer< TStyle >::New( );
+  this->m_Style->SetAssociatedObject( this );
   this->m_Style->AddMouseMoveCommand( Self::_MouseMoveCommand, this );
   this->m_Style->AddMouseClickCommand( Self::_MouseClickCommand, this );
   this->m_Style->AddMouseWheelCommand( Self::_MouseWheelCommand, this );
@@ -1194,70 +1055,68 @@ _ConfigureStyle( )
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-_ConfigureNewLUT( vtkImageData* data )
+_ConfigureInputImage( )
 {
-  // Does the new LUT is a window-level one?
-  unsigned int nImgs = this->m_ImageMaps.size( );
-  unsigned int nCmps = data->GetNumberOfScalarComponents( );
+  this->m_ImageMapper->SetOrientation( 0 );
+  this->m_ImageMapper->Update( );
 
-  if( nCmps > 1 )
-  {
-    this->m_ImageMaps.push_back( NULL );
-    return;
+  // Create actor
+  this->m_ImageActor->SetInterpolate( this->m_Interpolate );
+  this->m_ImageActor->Modified( );
 
-  } // fi
+  if( this->m_Style.GetPointer( ) != NULL )
+    this->m_Style->AssociateImageActor( this->m_ImageActor );
+  this->AddItem( this->m_ImageActor );
+
+  this->SetSliceNumber( this->GetSliceNumberMinValue( ) );
+  this->ResetCursor( );
+  this->Modified( );
+
+  // Reset cursors
+  this->ResetCursor( );
+  this->ResetAxesCursor( );
 
-  // Create LUT filter
-  this->m_ImageMaps.push_back( vtkSmartPointer< vtkImageMapToColors >::New( ) );
-  if( nImgs == 0 )
+  // Update window/level ranges
+  vtkImageData* data = this->GetInputImage( );
+  if( data != NULL )
   {
-    double range[ 2 ];
-    data->GetScalarRange( range );
-    vtkSmartPointer< vtkWindowLevelLookupTable > lut =
-      vtkSmartPointer< vtkWindowLevelLookupTable >::New( );
-    lut->SetScaleToLinear( );
-    lut->SetTableRange( range );
-    lut->SetWindow( range[ 1 ] - range[ 0 ] );
-    lut->SetLevel( ( range[ 1 ] + range[ 0 ] ) / double( 2 ) );
-    lut->Build( );
-    this->m_ImageMaps[ 0 ]->SetLookupTable( lut );
-  }
-  else
-    this->SetLookupTableAsColor( nImgs, 1, 0, 0 );
+    double r[ 2 ];
+    data->GetScalarRange( r );
+    this->m_WLRange[ 0 ] = double( 0 );
+    this->m_WLRange[ 1 ] = r[ 1 ] - r[ 0 ];
+    this->m_WLRange[ 2 ] = r[ 0 ];
+    this->m_WLRange[ 3 ] = r[ 1 ];
+    this->ResetWindowLevel( );
+
+    // Configure blender
+    this->m_BlenderBase = vtkSmartPointer< vtkImageData >::New( );
+    this->m_BlenderBase->ShallowCopy( data );
+    this->m_BlenderBase->AllocateScalars( VTK_UNSIGNED_CHAR, 1 );
+    std::memset(
+      this->m_BlenderBase->GetScalarPointer( ), 0,
+      this->m_BlenderBase->GetActualMemorySize( )
+      );
+    this->m_Blender->AddInputData( this->m_BlenderBase );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-_ConfigureNewInput( int axis )
+_ConfigureBinaryImage( const double& r, const double& g, const double& b )
 {
-  unsigned int nImages = this->m_ImageActors.size( );
-
-  // Configure mapper
-  vtkImageSliceMapper* mapper = this->m_SliceMappers[ nImages ];
-  if( nImages == 0 )
-    mapper->SetOrientation( axis );
-  else
-    mapper->SetOrientation( this->m_SliceMappers[ 0 ]->GetOrientation( ) );
-  mapper->Update( );
-
-  // Create actor
-  vtkSmartPointer< vtkImageActor > actor =
-    vtkSmartPointer< vtkImageActor >::New( );
-  this->m_ImageActors.push_back( actor );
-  actor->SetMapper( mapper );
-  actor->SetInterpolate( this->m_Interpolate );
-  actor->Modified( );
-
-  if( nImages == 0 )
-    this->m_Style->AssociateImageActor( actor );
-  this->AddItem( actor );
-
-  if( nImages > 1 )
-    this->SetSliceNumber( this->GetSliceNumber( ) );
-  else
-    this->SetSliceNumber( this->GetSliceNumberMaxValue( ) );
-  this->ResetCursor( );
-  this->Modified( );
+  unsigned int nValues = this->m_BlenderLUT->GetNumberOfTableValues( );
+  this->m_BlenderLUT->SetNumberOfTableValues( nValues + 1 );
+  this->m_BlenderLUT->SetTableRange( 0, nValues );
+  this->m_BlenderLUT->SetTableValue( nValues, r, g, b, 0.5 );
+  this->m_BlenderLUT->Build( );
+
+  this->m_BlenderLUT->Modified( );
+  this->m_Blender->Modified( );
+  this->m_Blender->Update( );
+
+  this->m_BlenderMapper->Modified( );
+  this->m_BlenderActor->Modified( );
 }
 
 // -------------------------------------------------------------------------
@@ -1276,17 +1135,20 @@ _MouseMoveCommand(
     // Just show the pixel information
     actors->SetCursor( pos );
     actors->UpdateText( pos );
-    actors->Render( 1e-3 );
+    actors->Render( );
   }
   else if( btn == TStyle::ButtonID_Left )
   {
     if( !alt && ctr && !sft )
     {
+      // Show axes in current renderer
+      actors->SetAxesCursor( pos );
+      actors->Render( );
+
       // Interactively move slices
       auto i = actors->m_SlicesCommands.begin( );
       for( ; i != actors->m_SlicesCommands.end( ); ++i )
         i->first( pos, actors->GetAxis( ), i->second );
-      actors->Render( 1e-3 );
 
     } // fi
   }
@@ -1296,7 +1158,7 @@ _MouseMoveCommand(
     {
       // Change image window level
       double bounds[ 6 ];
-      actors->m_SliceMappers[ 0 ]->GetBounds( bounds );
+      actors->m_ImageMapper->GetBounds( bounds );
 
       int a0 = actors->GetAxis( );
       int a1 = ( a0 + 1 ) % 3;
@@ -1311,13 +1173,13 @@ _MouseMoveCommand(
       dx += actors->m_StartWindowLevel[ 0 ];
       dy += actors->m_StartWindowLevel[ 1 ];
       actors->SetWindowLevel( dx, dy );
-      actors->Render( 1e-3 );
+      actors->Render( );
 
       // Associate objects
       auto i = actors->m_WindowLevelCommands.begin( );
       for( ; i != actors->m_WindowLevelCommands.end( ); ++i )
         i->first( dx, dy, i->second );
-      
+
     } // fi
 
   } // fi
@@ -1360,16 +1222,12 @@ _MouseWheelCommand(
     if( slice > actors->GetSliceNumberMaxValue( ) )
       slice = actors->GetSliceNumberMaxValue( );
     actors->SetSliceNumber( slice );
+    actors->Render( );
 
     auto a = actors->m_AssociatedSlices.begin( );
     for( ; a != actors->m_AssociatedSlices.end( ); ++a )
-    {
       ( *a )->SetSliceNumber( slice );
-      ( *a )->Render( 1e-3 );
 
-    } // rof
-    actors->Render( 1e-3 );
-    
     // Associate objects
     auto i = actors->m_RenderCommands.begin( );
     for( ; i != actors->m_RenderCommands.end( ); ++i )
@@ -1391,7 +1249,7 @@ _KeyCommand( void* data, const char& key )
   case 'r': case 'R':
   {
     actors->ResetCamera( );
-    actors->Render( 1e-3 );
+    actors->Render( );
 
     // Associate objects
     auto i = actors->m_RenderCommands.begin( );
@@ -1402,7 +1260,7 @@ _KeyCommand( void* data, const char& key )
   case 'w': case 'W':
   {
     actors->ResetWindowLevel( );
-    actors->Render( 1e-3 );
+    actors->Render( );
 
     // Associate objects
     auto i = actors->m_RenderCommands.begin( );
@@ -1425,7 +1283,7 @@ _EnterCommand( void* data )
 
   actors->ResetCursor( );
   actors->m_CursorActor->VisibilityOn( );
-  actors->Render( 1e-3 );
+  actors->Render( );
 }
 
 // -------------------------------------------------------------------------
@@ -1438,7 +1296,7 @@ _LeaveCommand( void* data )
 
   actors->ResetCursor( );
   actors->m_CursorActor->VisibilityOff( );
-  actors->Render( 1e-3 );
+  actors->Render( );
 }
 
 // eof - $RCSfile$