]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/MPRActors.cxx
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/cpPlugins
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRActors.cxx
index 2f7ce682a97e80585589e6a01a14873b52b3636a..72bf719729b46078d34948f7aacf5477e859a71c 100644 (file)
@@ -1,12 +1,9 @@
 #include <cpExtensions/Visualization/MPRActors.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*
@@ -28,111 +25,265 @@ GetSliceActors( const int& i ) const
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-SetInputConnection( vtkAlgorithmOutput* aout )
+int cpExtensions::Visualization::MPRActors::
+AddInputConnection(
+  vtkAlgorithmOutput* aout, ImageSliceActors::LUTType lut
+  )
 {
-  this->ImageMapToColors->SetInputConnection( aout );
-  this->SetLookupTableToWindowLevel( );
-  this->_UpdateSlices( );
+  int N = this->Slices[ 0 ][ 0 ]->GetNumberOfImageActors( );
+  if( N == 0 )
+  {
+    this->Slices[ 0 ][ 0 ]->AddInputConnection( aout, 0, lut );
+    vtkImageMapToColors* imap = this->Slices[ 0 ][ 0 ]->GetImageMap( 0 );
+    for( unsigned int i = 0; i < 2; ++i )
+      for( unsigned int j = 0; j < 3; ++j )
+        if( i != 0 || j != 0 )
+          this->Slices[ i ][ j ]->AddInputConnection(
+            ( ( imap != NULL )? imap->GetOutputPort( ): aout ), j,
+            ImageSliceActors::LUTType_None
+            );
+  }
+  else
+  {
+    /*
+    // Check if the image share the same space
+    vtkImageData* ref_image = this->_Image( 0 );
+    vtkImageData* new_image =
+      vtkImageData::SafeDownCast(
+        aout->GetProducer( )->GetOutputInformation( 0 )->
+        Get( vtkDataObject::DATA_OBJECT( ) )
+        );
+    int ref_ext[ 6 ], new_ext[ 6 ];
+    ref_image->GetExtent( ref_ext );
+    new_image->GetExtent( new_ext );
+    if(
+      ref_ext[ 0 ] == new_ext[ 0 ] && ref_ext[ 1 ] == new_ext[ 1 ] &&
+      ref_ext[ 2 ] == new_ext[ 2 ] && ref_ext[ 3 ] == new_ext[ 3 ] &&
+      ref_ext[ 4 ] == new_ext[ 4 ] && ref_ext[ 5 ] == new_ext[ 5 ]
+      )
+    {
+      this->ImageMaps.push_back(
+        vtkSmartPointer< vtkImageMapToColors >::New( )
+        );
+      this->ImageMaps[ N ]->SetInputConnection( aout );
+      this->SetLookupTableToColor(
+        N, double( 1 ), double( 0 ), double( 0 )
+        );
+      this->_Update( N );
+      return( N );
+    }
+    else
+    N = -1;
+  */
+
+  } // fi
+  return( N );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-SetInputData( vtkImageData* image )
+int cpExtensions::Visualization::MPRActors::
+AddInputData( vtkImageData* image, ImageSliceActors::LUTType lut )
 {
-  this->ImageMapToColors->SetInputData( image );
-  this->SetLookupTableToWindowLevel( );
-  this->_UpdateSlices( );
+  int N = this->Slices[ 0 ][ 0 ]->GetNumberOfImageActors( );
+  if( N == 0 )
+  {
+    this->Slices[ 0 ][ 0 ]->AddInputData( image, 0, lut );
+    vtkImageMapToColors* imap = this->Slices[ 0 ][ 0 ]->GetImageMap( 0 );
+    for( unsigned int i = 0; i < 2; ++i )
+      for( unsigned int j = 0; j < 3; ++j )
+        if( i != 0 || j != 0 )
+        {
+          if( imap != NULL )
+            this->Slices[ i ][ j ]->AddInputConnection(
+              imap->GetOutputPort( ), j,
+              ImageSliceActors::LUTType_None
+              );
+          else
+            this->Slices[ i ][ j ]->AddInputData(
+              image, j,
+              ImageSliceActors::LUTType_None
+              );
+        } // fi
+  }
+  else
+  {
+  } // fi
+  return( N );
+  /*
+  int N = this->ImageMaps.size( );
+  if( N == 0 )
+  {
+    this->ImageMaps.push_back(
+      vtkSmartPointer< vtkImageMapToColors >::New( )
+      );
+    this->ImageMaps[ 0 ]->SetInputData( image );
+    this->SetLookupTableToWindowLevel( 0 );
+    this->_Update( 0 );
+    this->ResetWindowLevel( 0 );
+    return( 0 );
+  }
+  else
+  {
+    // Check if the image share the same space
+    vtkImageData* ref_image = this->_Image( 0 );
+    vtkImageData* new_image = image;
+    int ref_ext[ 6 ], new_ext[ 6 ];
+    ref_image->GetExtent( ref_ext );
+    new_image->GetExtent( new_ext );
+    if(
+      ref_ext[ 0 ] == new_ext[ 0 ] && ref_ext[ 1 ] == new_ext[ 1 ] &&
+      ref_ext[ 2 ] == new_ext[ 2 ] && ref_ext[ 3 ] == new_ext[ 3 ] &&
+      ref_ext[ 4 ] == new_ext[ 4 ] && ref_ext[ 5 ] == new_ext[ 5 ]
+      )
+    {
+      this->ImageMaps.push_back(
+        vtkSmartPointer< vtkImageMapToColors >::New( )
+        );
+      this->ImageMaps[ N ]->SetInputData( image );
+      this->SetLookupTableToColor(
+        N, double( 1 ), double( 0 ), double( 0 )
+        );
+      this->_Update( N );
+      return( N );
+    }
+    else
+      return( -1 );
+
+  } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-PushDataInto(
-  vtkRenderer* x, vtkRenderer* y, vtkRenderer* z, vtkRenderer* w
+PushActorsInto(
+  vtkRenderWindow* x, vtkRenderWindow* y, vtkRenderWindow* z,
+  vtkRenderWindow* w
   )
 {
-  vtkRenderer* rends[] = { x, y, z };
+  this->Slices[ 0 ][ 0 ]->PushActorsInto( x, true );
+  this->Slices[ 0 ][ 1 ]->PushActorsInto( y, true );
+  this->Slices[ 0 ][ 2 ]->PushActorsInto( z, true );
+
+  vtkRenderer* wren =
+    ( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
+  vtkRenderer* rends[ ] =
+    {
+      ( x != NULL )? x->GetRenderers( )->GetFirstRenderer( ): NULL,
+      ( y != NULL )? y->GetRenderers( )->GetFirstRenderer( ): NULL,
+      ( z != NULL )? z->GetRenderers( )->GetFirstRenderer( ): NULL
+    };
   for( int i = 0; i < 3; ++i )
   {
     if( rends[ i ] != NULL )
-    {
-      rends[ i ]->AddActor( this->Slices[ 0 ][ i ]->GetImageActor( ) );
-      rends[ i ]->AddActor( this->Slices[ 0 ][ i ]->GetTextActor( ) );
       for( int j = 0; j < 3; ++j )
-        rends[ i ]->AddActor( this->Slices[ 0 ][ j ]->GetPlaneActor( ) );
-
-    } // fi
-    if( w != NULL )
+        if( i != j )
+          rends[ i ]->AddActor( this->Slices[ 0 ][ j ]->GetPlaneActor( ) );
+    if( wren != NULL )
     {
-      w->AddActor( this->Slices[ 1 ][ i ]->GetImageActor( ) );
-      w->AddActor( this->Slices[ 1 ][ i ]->GetPlaneActor( ) );
+      for(
+        unsigned int k = 0;
+        k < this->Slices[ 1 ][ i ]->GetNumberOfImageActors( );
+        ++k
+        )
+        wren->AddActor( this->Slices[ 1 ][ i ]->GetImageActor( k ) );
+      wren->AddActor( this->Slices[ 1 ][ i ]->GetPlaneActor( ) );
 
     } // fi
 
   } // rof
-  if( w != NULL )
-    w->AddActor( this->ImageOutlineActor );
+  if( wren != NULL )
+    wren->AddActor( this->ImageOutlineActor );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-PopDataFrom( vtkRenderer* x, vtkRenderer* y, vtkRenderer* z, vtkRenderer* w )
+PopDataFrom(
+  vtkRenderer* x,
+  vtkRenderer* y,
+  vtkRenderer* z,
+  vtkRenderer* w
+  )
 {
+  /*
   vtkRenderer* rends[] = { x, y, z };
   for( int i = 0; i < 3; ++i )
   {
     if( rends[ i ] != NULL )
     {
-      rends[ i ]->RemoveActor( this->Slices[ 0 ][ i ]->GetImageActor( ) );
+      for(
+        unsigned int k = 0;
+        k < this->Slices[ 0 ][ i ]->GetNumberOfImageActors( );
+        ++k
+        )
+        rends[ i ]->RemoveActor( this->Slices[ 0 ][ i ]->GetImageActor( k ) );
       rends[ i ]->RemoveActor( this->Slices[ 0 ][ i ]->GetTextActor( ) );
       for( int j = 0; j < 3; ++j )
         rends[ i ]->RemoveActor( this->Slices[ 0 ][ j ]->GetPlaneActor( ) );
-      if( w != NULL )
-      {
-        w->RemoveActor( this->Slices[ 1 ][ i ]->GetImageActor( ) );
-        w->RemoveActor( this->Slices[ 1 ][ i ]->GetPlaneActor( ) );
 
-      } // fi
+    } // fi
+    if( w != NULL )
+    {
+      for(
+        unsigned int k = 0;
+        k < this->Slices[ 1 ][ i ]->GetNumberOfImageActors( );
+        ++k
+        )
+        w->RemoveActor( this->Slices[ 1 ][ i ]->GetImageActor( k ) );
+      w->RemoveActor( this->Slices[ 1 ][ i ]->GetPlaneActor( ) );
 
     } // fi
 
   } // rof
-
   if( w != NULL )
     w->RemoveActor( this->ImageOutlineActor );
+  */
 }
 
 // -------------------------------------------------------------------------
-vtkScalarsToColors* cpExtensions::Visualization::MPRActors::
-GetLookupTable( ) const
+  /*
+void cpExtensions::Visualization::MPRActors::
+LinkInteractors( )
 {
-  return( this->ImageMapToColors->GetLookupTable( ) );
+  this->_Update( 0 );
+  this->_Update( 1 );
+  this->_Update( 2 );
 }
+  */
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-SetLookupTable( vtkScalarsToColors* lut )
+SetLookupTable( unsigned int i, vtkScalarsToColors* lut )
 {
-  this->ImageMapToColors->SetLookupTable( lut );
-  this->ImageMapToColors->Update( );
-  this->Modified( );
+  /*
+  if( i < this->ImageMaps.size( ) )
+  {
+    this->ImageMaps[ i ]->SetLookupTable( lut );
+    this->ImageMaps[ i ]->Update( );
+    this->Modified( );
+
+  } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
-vtkWindowLevelLookupTable* cpExtensions::Visualization::MPRActors::
-GetLookupTableAsWindowLevel( ) const
+vtkScalarsToColors* cpExtensions::Visualization::MPRActors::
+GetLookupTable( unsigned int i ) const
 {
-  return(
-    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( ) )
-    );
+  /*
+  if( i < this->ImageMaps.size( ) )
+    return( this->ImageMaps[ i ]->GetLookupTable( ) );
+  else
+    return( NULL );
+    */
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-SetLookupTableToWindowLevel( )
+SetLookupTableToWindowLevel( unsigned int i )
 {
+  /*
   // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
+  vtkImageData* image = this->_Image( i );
   if( image == NULL )
     return;
 
@@ -145,142 +296,231 @@ SetLookupTableToWindowLevel( )
   lut->SetTableRange( r );
   lut->Build( );
 
-  this->SetLookupTable( lut );
+  this->SetLookupTable( i, lut );
+  */
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::MPRActors::
-GetMinWindow( ) const
+GetMinWindow( unsigned int i ) const
 {
-  return( double( 0 ) );
+  return( 0 );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::MPRActors::
-GetMaxWindow( ) const
+GetMaxWindow( unsigned int i ) const
 {
+  /*
   // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
+  vtkImageData* image = this->_Image( i );
   if( image == NULL )
     return( double( 0 ) );
 
   double r[ 2 ];
   image->GetScalarRange( r );
   return( r[ 1 ] - r[ 0 ] );
+  */
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::MPRActors::
-GetMinLevel( ) const
+GetMinLevel( unsigned int i ) const
 {
+  /*
   // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
+  vtkImageData* image = this->_Image( i );
   if( image == NULL )
     return( double( 0 ) );
 
   double r[ 2 ];
   image->GetScalarRange( r );
   return( r[ 0 ] );
+  */
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::MPRActors::
-GetMaxLevel( ) const
+GetMaxLevel( unsigned int i ) const
 {
+  /*
   // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
+  vtkImageData* image = this->_Image( i );
   if( image == NULL )
     return( double( 0 ) );
 
   double r[ 2 ];
   image->GetScalarRange( r );
   return( r[ 1 ] );
+  */
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::MPRActors::
-GetWindow( ) const
+GetWindow( unsigned int i ) const
 {
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
+  /*
+  vtkWindowLevelLookupTable* lut =
+    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( i ) );
   if( lut != NULL )
     return( lut->GetWindow( ) );
   else
     return( double( 0 ) );
+  */
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::MPRActors::
-GetLevel( ) const
+GetLevel( unsigned int i ) const
 {
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
+  /*
+  vtkWindowLevelLookupTable* lut =
+    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( i ) );
   if( lut != NULL )
     return( lut->GetLevel( ) );
   else
     return( double( 0 ) );
+  */
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-SetWindow( const double& w )
+SetWindow( unsigned int i, const double& w )
 {
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
+  /*
+  vtkWindowLevelLookupTable* lut =
+    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( i ) );
   if( lut != NULL )
   {
     lut->SetWindow( w );
     lut->Build( );
-    this->ImageMapToColors->Modified( );
+    this->ImageMaps[ i ]->Modified( );
     this->Modified( );
 
   } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-SetLevel( const double& l )
+SetLevel( unsigned int i, const double& l )
 {
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
+  /*
+  vtkWindowLevelLookupTable* lut =
+    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( i ) );
   if( lut != NULL )
   {
     lut->SetLevel( l );
     lut->Build( );
-    this->ImageMapToColors->Modified( );
+    this->ImageMaps[ i ]->Modified( );
     this->Modified( );
 
   } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-SetWindowLevel( const double& w, const double& l )
+SetWindowLevel( unsigned int i, const double& w, const double& l )
 {
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
+  /*
+  vtkWindowLevelLookupTable* lut =
+    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( i ) );
   if( lut != NULL )
   {
-    lut->SetWindow( l );
+    lut->SetWindow( w );
     lut->SetLevel( l );
     lut->Build( );
-    this->ImageMapToColors->Modified( );
+    this->ImageMaps[ i ]->Modified( );
+
+    for( unsigned int j = 0; j < 3; ++j )
+      this->Slices[ 0 ][ j ]->UpdateText( w, l );
+
     this->Modified( );
 
   } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-ResetWindowLevel( )
+ResetWindowLevel( unsigned int i )
 {
-  vtkImageData* image = this->_InputImage( );
-  vtkWindowLevelLookupTable* lut = this->GetLookupTableAsWindowLevel( );
+  /*
+  vtkImageData* image = this->_Image( i );
+  vtkWindowLevelLookupTable* lut =
+    dynamic_cast< vtkWindowLevelLookupTable* >( this->GetLookupTable( i ) );
   if( image != NULL && lut != NULL )
   {
     double r[ 2 ];
     image->GetScalarRange( r );
     lut->SetTableRange( r );
+    lut->SetWindow( r[ 1 ] - r[ 0 ] );
+    lut->SetLevel( ( r[ 1 ] + r[ 0 ] ) / double( 2 ) );
     lut->Build( );
-    this->ImageMapToColors->Modified( );
+    this->ImageMaps[ i ]->Modified( );
     this->Modified( );
 
   } // fi
+  */
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+SetLookupTableToColor(
+  unsigned int i, const double& r, const double& g, const double& b
+  )
+{
+  /*
+  static const double _0 = double( 0 );
+  static const double _1 = double( 1 );
+  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 if the input has been configured
+  vtkImageData* image = this->_Image( i );
+  if( image == NULL )
+    return;
+
+  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 *= _1 / _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( i, lut );
+  */
 }
 
 // -------------------------------------------------------------------------
@@ -308,7 +548,7 @@ GetSlice( const int& axis ) const
 void cpExtensions::Visualization::MPRActors::
 SetSlice( const int& axis, const int& slice )
 {
-  vtkImageData* image = this->_InputImage( );
+  vtkImageData* image = this->_Image( 0 );
   if( image == NULL )
     return;
 
@@ -333,7 +573,7 @@ SetSlice( const int& axis, const int& slice )
 void cpExtensions::Visualization::MPRActors::
 SetSlice( const int& axis, const double& slice )
 {
-  vtkImageData* image = this->_InputImage( );
+  vtkImageData* image = this->_Image( 0 );
   if( image == NULL )
     return;
 
@@ -350,16 +590,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( )
+        );
 }
 
 // -------------------------------------------------------------------------
@@ -367,14 +602,10 @@ cpExtensions::Visualization::MPRActors::
 MPRActors( )
   : Superclass( )
 {
-  this->ImageMapToColors = vtkSmartPointer< vtkImageMapToColors >::New( );
   this->ImageOutlineActor = vtkSmartPointer< vtkActor >::New( );
-  this->Slices[ 0 ][ 0 ] = vtkSmartPointer< _TSlice >::New( );
-  this->Slices[ 0 ][ 1 ] = vtkSmartPointer< _TSlice >::New( );
-  this->Slices[ 0 ][ 2 ] = vtkSmartPointer< _TSlice >::New( );
-  this->Slices[ 1 ][ 0 ] = vtkSmartPointer< _TSlice >::New( );
-  this->Slices[ 1 ][ 1 ] = vtkSmartPointer< _TSlice >::New( );
-  this->Slices[ 1 ][ 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( );
 }
 
 // -------------------------------------------------------------------------
@@ -385,126 +616,78 @@ cpExtensions::Visualization::MPRActors::
 
 // -------------------------------------------------------------------------
 vtkImageData* cpExtensions::Visualization::MPRActors::
-_InputImage( ) const
+_Image( unsigned int i ) const
 {
-  vtkAlgorithm* algo = this->ImageMapToColors->GetInputAlgorithm( );
-  vtkInformation* info = algo->GetOutputInformation( 0 );
-  return(
-    vtkImageData::SafeDownCast( info->Get( vtkDataObject::DATA_OBJECT( ) ) )
-    );
+  /*
+  if( i < this->ImageMaps.size( ) )
+  {
+    vtkAlgorithm* algo = this->ImageMaps[ i ]->GetInputAlgorithm( );
+    vtkInformation* info = algo->GetOutputInformation( 0 );
+    return(
+      vtkImageData::SafeDownCast(
+        info->Get( vtkDataObject::DATA_OBJECT( ) )
+        )
+      );
+  }
+  else
+  */
+  return( NULL );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-_UpdateSlices( )
+_Update( unsigned int i )
 {
+  /*
   // Check if the input has been configured
-  vtkImageData* image = this->_InputImage( );
+  vtkImageData* image = this->_Image( i );
   if( image == NULL )
     return;
-  this->ImageMapToColors->Update( );
+  this->ImageMaps[ i ]->Update( );
 
   for( int j = 0; j < 2; ++j )
   {
-    for( int i = 0; i < 3; ++i )
+    for( int k = 0; k < 3; ++k )
     {
-      this->Slices[ j ][ i ]->SetInputConnection(
-        this->ImageMapToColors->GetOutputPort( ), i
+      this->Slices[ j ][ k ]->AddInputConnection(
+        this->ImageMaps[ i ]->GetOutputPort( ), k
         );
-      this->Slices[ j ][ i ]->UpdateText( );
+      this->Slices[ j ][ k ]->UpdateText( );
 
-    } // rof
+      // Add all of slice's props
+      this->Slices[ j ][ k ]->InitTraversal( );
+      vtkProp* prop = this->Slices[ j ][ k ]->GetNextProp( );
+      while( prop != NULL )
+      {
+        this->AddItem( prop );
+        prop = this->Slices[ j ][ k ]->GetNextProp( );
 
-  } // rof
+      } // elihw
 
-  // Create 3D outline
-  double bb[ 6 ];
-  image->GetBounds( bb );
+    } // rof
 
-  vtkSmartPointer< vtkOutlineSource > img_ol =
-    vtkSmartPointer< vtkOutlineSource >::New( );
-  img_ol->SetBounds( bb );
+  } // rof
 
-  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 );
+  if( i == 0 )
+  {
+    // Create 3D outline
+    double bb[ 6 ];
+    image->GetBounds( bb );
 
-  this->ImageOutlineActorIndex = this->GetNumberOfItems( );
-  this->AddItem( this->ImageOutlineActor );
+    vtkSmartPointer< vtkOutlineSource > img_ol =
+      vtkSmartPointer< vtkOutlineSource >::New( );
+    img_ol->SetBounds( bb );
 
-  // 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 );
+    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 );
 
-    } // 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( );
+    this->AddItem( this->ImageOutlineActor );
 
-  /*
-    #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( );
+  } // fi
   */
 }