]> Creatis software - cpPlugins.git/commitdiff
OpenGL WL and LUT mapper integrated.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 12 Nov 2015 00:06:22 +0000 (19:06 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 12 Nov 2015 00:06:22 +0000 (19:06 -0500)
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpExtensions/Visualization/ImageSliceActors.h
lib/cpExtensions/Visualization/MPRActors.cxx
lib/cpPlugins/Interface/BaseMPRWidget.cxx
lib/cpPlugins/Interface/Parameters.cxx
lib/cpPlugins/Interface/Parameters.hxx

index ee4947e834d4394463a547de1e958d4752e66f58..374835d3cd3c7d57a829366e31646716af3717cd 100644 (file)
@@ -6,6 +6,7 @@
 #include <vtkCamera.h>
 #include <vtkCellArray.h>
 #include <vtkImageData.h>
+#include <vtkImageProperty.h>
 #include <vtkPoints.h>
 #include <vtkProperty.h>
 #include <vtkRenderer.h>
@@ -23,32 +24,28 @@ New( )
 }
 
 // -------------------------------------------------------------------------
-cpExtensions::Visualization::
-ImageBlender* cpExtensions::Visualization::ImageSliceActors::
-GetBlender( )
-{
-  return( this->m_ImageBlender );
-}
-
-// -------------------------------------------------------------------------
-const cpExtensions::Visualization::
-ImageBlender* cpExtensions::Visualization::ImageSliceActors::
-GetBlender( ) const
+void cpExtensions::Visualization::ImageSliceActors::
+SetAxis( int axis )
 {
-  return( this->m_ImageBlender );
+  this->m_ImageMapper->SetOrientation( axis );
+  this->m_ImageMapper->Update( );
+  this->SetSliceNumber( this->GetSliceNumberMinValue( ) );
+  this->m_ImageActor->Modified( );
+  this->Modified( );
+  this->ResetCamera( );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-SetBlender( ImageBlender* blender )
+AddInputConnection( vtkAlgorithmOutput* aout )
 {
-  this->m_ImageBlender = blender;
+  // Get input vtkImageData
+  if( aout == NULL )
+    return;
 
   // Create mapper and actors
   this->m_ImageMapper = vtkSmartPointer< vtkImageSliceMapper >::New( );
-  this->m_ImageMapper->SetInputConnection(
-    this->m_ImageBlender->GetOutputPort( )
-    );
+  this->m_ImageMapper->SetInputConnection( aout );
   this->m_ImageMapper->SetOrientation( 0 );
   this->m_ImageMapper->Update( );
 
@@ -65,53 +62,20 @@ SetBlender( ImageBlender* blender )
   this->SetSliceNumber( this->GetSliceNumberMinValue( ) );
   this->ResetCursor( );
   this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-SetAxis( int axis )
-{
-  this->m_ImageMapper->SetOrientation( axis );
-  this->m_ImageMapper->Update( );
-  this->SetSliceNumber( this->GetSliceNumberMinValue( ) );
-  this->m_ImageActor->Modified( );
-  this->Modified( );
-  this->ResetCamera( );
-}
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddInputConnection( vtkAlgorithmOutput* aout )
-{
-  // Get input vtkImageData
-  if( aout == NULL )
-    return;
-
-  if( this->m_ImageBlender.GetPointer( ) == NULL )
+  // Update window/level ranges
+  vtkImageData* data = this->GetInputImage( );
+  if( data != NULL )
   {
-    // Try to infere if input comes from a color mapping filter
-    vtkAlgorithm* producer = aout->GetProducer( );
-    vtkSmartPointer< ImageBlender > blender =
-      dynamic_cast< ImageBlender* >( producer );
-    if( blender.GetPointer( ) == NULL )
-    {
-      // Ok, create a new blender with default window level
-      vtkImageData* data = dynamic_cast< vtkImageData* >(
-        producer->GetOutputDataObject( aout->GetIndex( ) )
-        );
-      double r[ 2 ];
-      data->GetScalarRange( r );
-
-      blender = vtkSmartPointer< ImageBlender >::New( );
-      blender->AddInputConnection( aout );
-      blender->SetWindow( r[ 1 ] - r[ 0 ] );
-      blender->SetLevel( ( r[ 1 ] + r[ 0 ] ) / double( 2 ) );
+    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( );
 
-    } // fi
-    this->SetBlender( blender );
-  }
-  else
-    this->m_ImageBlender->AddInputConnection( aout );
+  } // fi
 }
 
 // -------------------------------------------------------------------------
@@ -122,21 +86,34 @@ AddInputData( vtkImageData* data )
   if( data == NULL )
     return;
 
-  if( this->m_ImageBlender.GetPointer( ) == NULL )
-  {
-    // Create a new blender with default window level
-    double r[ 2 ];
-    data->GetScalarRange( r );
+  // Create mapper and actors
+  this->m_ImageMapper = vtkSmartPointer< vtkImageSliceMapper >::New( );
+  this->m_ImageMapper->SetInputData( data );
+  this->m_ImageMapper->SetOrientation( 0 );
+  this->m_ImageMapper->Update( );
 
-    vtkSmartPointer< ImageBlender > blender =
-      vtkSmartPointer< ImageBlender >::New( );
-    blender->AddInputData( data );
-    blender->SetWindow( r[ 1 ] - r[ 0 ] );
-    blender->SetLevel( ( r[ 1 ] + r[ 0 ] ) / double( 2 ) );
-    this->SetBlender( blender );
-  }
-  else
-    this->m_ImageBlender->AddInputData( data );
+  // Create actor
+  this->m_ImageActor = vtkSmartPointer< vtkImageActor >::New( );
+  this->m_ImageActor->SetMapper( this->m_ImageMapper );
+  this->m_ImageActor->SetInterpolate( this->m_Interpolate );
+  this->m_ImageActor->Modified( );
+
+  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( );
+
+  // Update window/level ranges
+  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( );
 }
 
 // -------------------------------------------------------------------------
@@ -161,9 +138,8 @@ Clear( )
   this->RemoveAllItems( );
 
   // Delete all images
-  this->m_ImageActor   = NULL;
-  this->m_ImageMapper  = NULL;
-  this->m_ImageBlender = NULL;
+  this->m_ImageActor  = NULL;
+  this->m_ImageMapper = NULL;
 
   // Reconfigure unique objects
   this->m_Cursor               = vtkSmartPointer< vtkPolyData >::New( );
@@ -306,11 +282,11 @@ GetStyle( ) const
 
 // -------------------------------------------------------------------------
 vtkImageData* cpExtensions::Visualization::ImageSliceActors::
-GetInputImage( unsigned int id )
+GetInputImage( )
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
     return(
-      dynamic_cast< vtkImageData* >( this->m_ImageBlender->GetInput( id ) )
+      dynamic_cast< vtkImageData* >( this->m_ImageMapper->GetInput( ) )
       );
   else
     return( NULL );
@@ -318,12 +294,12 @@ GetInputImage( unsigned int id )
 
 // -------------------------------------------------------------------------
 const vtkImageData* cpExtensions::Visualization::ImageSliceActors::
-GetInputImage( unsigned int id ) const
+GetInputImage( ) const
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
+  if( this->m_ImageMapper.GetPointer( ) != NULL )
     return(
       dynamic_cast< const vtkImageData* >(
-        this->m_ImageBlender->GetInput( )
+        this->m_ImageMapper->GetInput( )
         )
       );
   else
@@ -604,48 +580,36 @@ SetCursor( double pos[ 3 ] )
 double cpExtensions::Visualization::ImageSliceActors::
 GetMinWindow( ) const
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
-    return( this->m_ImageBlender->GetMinWindow( ) );
-  else
-    return( double( 0 ) );
+  return( this->m_WLRange[ 0 ] );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetMaxWindow( ) const
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
-    return( this->m_ImageBlender->GetMaxWindow( ) );
-  else
-    return( double( 0 ) );
+  return( this->m_WLRange[ 1 ] );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetMinLevel( ) const
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
-    return( this->m_ImageBlender->GetMinLevel( ) );
-  else
-    return( double( 0 ) );
+  return( this->m_WLRange[ 2 ] );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetMaxLevel( ) const
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
-    return( this->m_ImageBlender->GetMaxLevel( ) );
-  else
-    return( double( 0 ) );
+  return( this->m_WLRange[ 3 ] );
 }
 
 // -------------------------------------------------------------------------
 double cpExtensions::Visualization::ImageSliceActors::
 GetWindow( ) const
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
-    return( this->m_ImageBlender->GetWindow( ) );
+  if( this->m_ImageActor.GetPointer( ) != NULL )
+    return( this->m_ImageActor->GetProperty( )->GetColorWindow( ) );
   else
     return( double( 0 ) );
 }
@@ -654,8 +618,8 @@ GetWindow( ) const
 double cpExtensions::Visualization::ImageSliceActors::
 GetLevel( ) const
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
-    return( this->m_ImageBlender->GetLevel( ) );
+  if( this->m_ImageActor.GetPointer( ) != NULL )
+    return( this->m_ImageActor->GetProperty( )->GetColorLevel( ) );
   else
     return( double( 0 ) );
 }
@@ -664,45 +628,46 @@ GetLevel( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 SetWindow( double w )
 {
-  if( this->m_ImageBlender.GetPointer( ) != NULL )
-  {
-    this->m_ImageBlender->SetWindow( w );
-    this->Modified( );
-
-  } // fi
+  if( this->m_ImageActor.GetPointer( ) == NULL )
+    return;
+  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_ImageBlender.GetPointer( ) != NULL )
-  {
-    this->m_ImageBlender->SetLevel( l );
-    this->Modified( );
-
-  } // fi
+  if( this->m_ImageActor.GetPointer( ) == NULL )
+    return;
+  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_ImageBlender.GetPointer( ) != NULL )
-  {
-    this->m_ImageBlender->SetWindowLevel( w, l );
-    this->UpdateText( w, l );
-    this->Modified( );
-
-  } // fi
+  if( this->m_ImageActor.GetPointer( ) == NULL )
+    return;
+  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 );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 ResetWindowLevel( )
 {
-  std::cerr << "ACA Resetear" << std::endl;
-  std::exit( 1 );
+  this->SetWindowLevel(
+    this->m_WLRange[ 1 ] * double( 0.5 ),
+    ( this->m_WLRange[ 3 ] + this->m_WLRange[ 2 ] ) * double( 0.5 )
+    );
 }
 
 // -------------------------------------------------------------------------
@@ -864,7 +829,7 @@ SetSliceNumber( const int& slice )
 void cpExtensions::Visualization::ImageSliceActors::
 SetSlice( double* pos )
 {
-  vtkImageData* image = this->GetInputImage( );
+  vtkImageData* image = this->GetInputImage( );
   if( image == NULL )
     return;
 
@@ -911,7 +876,7 @@ UpdateText( double pos[ 3 ] )
     else if( axId == 2 ) axis = 'Z';
     int slice = this->GetSliceNumber( );
 
-    vtkImageData* image = this->GetInputImage( );
+    vtkImageData* image = this->GetInputImage( );
     int ijk[ 3 ];
     double pcoords[ 3 ];
     image->ComputeStructuredCoordinates( pos, ijk, pcoords );
@@ -1093,7 +1058,7 @@ _MouseMoveCommand(
       auto i = actors->m_WindowLevelCommands.begin( );
       for( ; i != actors->m_WindowLevelCommands.end( ); ++i )
         i->first( dx, dy, i->second );
-      
+
     } // fi
 
   } // fi
@@ -1145,7 +1110,7 @@ _MouseWheelCommand(
 
     } // rof
     actors->Render( 1e-3 );
-    
+
     // Associate objects
     auto i = actors->m_RenderCommands.begin( );
     for( ; i != actors->m_RenderCommands.end( ); ++i )
index 8fff84881d01249d7283f281382366de4a7a510d..ae5b35251a75980197d58c84aa62d53a130834f9 100644 (file)
@@ -14,7 +14,6 @@
 #include <vtkTextActor.h>
 
 #include <cpExtensions/Interaction/ImageInteractorStyle.h>
-#include <cpExtensions/Visualization/ImageBlender.h>
 
 // -------------------------------------------------------------------------
 class vtkAlgorithmOutput;
@@ -62,9 +61,6 @@ namespace cpExtensions
       // Creation
       static ImageSliceActors* New( );
 
-      ImageBlender* GetBlender( );
-      const ImageBlender* GetBlender( ) const;
-      void SetBlender( ImageBlender* blender );
       void SetAxis( int axis );
       void AddInputConnection( vtkAlgorithmOutput* aout );
       void AddInputData( vtkImageData* data );
@@ -72,8 +68,8 @@ namespace cpExtensions
 
       void AssociateSlice( Self* slice );
 
-      vtkImageData* GetInputImage( unsigned int id );
-      const vtkImageData* GetInputImage( unsigned int id ) const;
+      vtkImageData* GetInputImage( );
+      const vtkImageData* GetInputImage( ) const;
 
       vtkInteractorStyle* GetStyle( );
       const vtkInteractorStyle* GetStyle( ) const;
@@ -164,11 +160,12 @@ namespace cpExtensions
       vtkRenderWindow* m_Window;
 
       // Multiple actors
-      vtkSmartPointer< ImageBlender >        m_ImageBlender;
       vtkSmartPointer< vtkImageSliceMapper > m_ImageMapper;
       vtkSmartPointer< vtkImageActor >       m_ImageActor;
       bool m_Interpolate;
 
+      double m_WLRange[ 4 ];
+
       int    m_VisibleExtent[ 6 ];
       double m_VisibleBounds[ 6 ];
 
index a7803b2ad77864d2ed9ce81bd316a6d827ff1e10..c0e8333860f020e5d661335b5c12d01a7e66c352 100644 (file)
@@ -31,65 +31,49 @@ GetSliceActors( const int& i ) const
 int cpExtensions::Visualization::MPRActors::
 AddInputConnection( vtkAlgorithmOutput* aout )
 {
-  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
-  if( blender == NULL )
+  for( unsigned int i = 0; i < 2; ++i )
   {
-    this->Slices[ 0 ][ 0 ]->AddInputConnection( aout );
-    blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
-    for( unsigned int i = 0; i < 2; ++i )
+    for( unsigned int j = 0; j < 3; ++j )
     {
-      for( unsigned int j = 0; j < 3; ++j )
-      {
-        if( i != 0 || j != 0 )
-          this->Slices[ i ][ j ]->SetBlender( blender );
-        this->Slices[ i ][ j ]->SetAxis( j );
-
-      } // rof
+      this->Slices[ i ][ j ]->AddInputConnection( aout );
+      this->Slices[ i ][ j ]->SetAxis( j );
 
     } // rof
-    this->_CreateBoundingBox( );
-  }
-  else
-    blender->AddInputConnection( aout );
-  return( blender->GetNumberOfImages( ) - 1 );
+
+  } // rof
+  this->_CreateBoundingBox( );
+  return( 0 );
 }
 
 // -------------------------------------------------------------------------
 int cpExtensions::Visualization::MPRActors::
 AddInputData( vtkImageData* new_image )
 {
-  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
-  if( blender == NULL )
+  for( unsigned int i = 0; i < 2; ++i )
   {
-    this->Slices[ 0 ][ 0 ]->AddInputData( new_image );
-    blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
-    for( unsigned int i = 0; i < 2; ++i )
+    for( unsigned int j = 0; j < 3; ++j )
     {
-      for( unsigned int j = 0; j < 3; ++j )
-      {
-        if( i != 0 || j != 0 )
-          this->Slices[ i ][ j ]->SetBlender( blender );
-        this->Slices[ i ][ j ]->SetAxis( j );
-
-      } // rof
+      this->Slices[ i ][ j ]->AddInputData( new_image );
+      this->Slices[ i ][ j ]->SetAxis( j );
 
     } // rof
-    this->_CreateBoundingBox( );
-  }
-  else
-    blender->AddInputData( new_image );
-  return( blender->GetNumberOfImages( ) - 1 );
+
+  } // rof
+  this->_CreateBoundingBox( );
+  return( 0 );
 }
 
 // -------------------------------------------------------------------------
 unsigned int cpExtensions::Visualization::MPRActors::
 GetNumberOfImages( ) const
 {
-  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
-  if( blender != NULL )
-    return( blender->GetNumberOfImages( ) );
-  else
-    return( 0 );
+  /* TODO
+     ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
+     if( blender != NULL )
+     return( blender->GetNumberOfImages( ) );
+     else
+  */
+  return( 0 );
 }
 
 // -------------------------------------------------------------------------
@@ -115,24 +99,26 @@ PushActorsInto(
   vtkRenderer* wren =
     ( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
 
-  if( xren != NULL )
-  {
-    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( ) );
-
-  } // fi
-  if( zren != NULL )
-  {
-    zren->AddActor( this->Slices[ 0 ][ 0 ]->GetPlaneActor( ) );
-    zren->AddActor( this->Slices[ 0 ][ 1 ]->GetPlaneActor( ) );
-
-  } // fi
+  /* TODO
+     if( xren != NULL )
+     {
+     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( ) );
+
+     } // fi
+     if( zren != NULL )
+     {
+     zren->AddActor( this->Slices[ 0 ][ 0 ]->GetPlaneActor( ) );
+     zren->AddActor( this->Slices[ 0 ][ 1 ]->GetPlaneActor( ) );
+
+     } // fi
+  */
   if( wren != NULL )
     wren->AddActor( this->ImageOutlineActor );
 }
@@ -203,11 +189,8 @@ GetSlice( const int& axis ) const
 void cpExtensions::Visualization::MPRActors::
 SetSlice( const int& axis, const int& slice )
 {
-  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
-  if( blender == NULL )
-    return;
   vtkImageData* image =
-    dynamic_cast< vtkImageData* >( blender->GetInput( ) );
+    dynamic_cast< vtkImageData* >( this->Slices[ 0 ][ 0 ]->GetInputImage( ) );
   if( image == NULL )
     return;
 
@@ -232,11 +215,8 @@ SetSlice( const int& axis, const int& slice )
 void cpExtensions::Visualization::MPRActors::
 SetSlice( const int& axis, const double& slice )
 {
-  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
-  if( blender == NULL )
-    return;
   vtkImageData* image =
-    dynamic_cast< vtkImageData* >( blender->GetInput( ) );
+    dynamic_cast< vtkImageData* >( this->Slices[ 0 ][ 0 ]->GetInputImage( ) );
   if( image == NULL )
     return;
 
@@ -297,32 +277,27 @@ cpExtensions::Visualization::MPRActors::
 void cpExtensions::Visualization::MPRActors::
 _CreateBoundingBox( )
 {
-  ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
-  if( blender == NULL )
+  vtkImageData* image =
+    dynamic_cast< vtkImageData* >( this->Slices[ 0 ][ 0 ]->GetInputImage( ) );
+  if( image == NULL )
     return;
-  if( blender->GetNumberOfImages( ) == 1 )
-  {
-    vtkImageData* image =
-      dynamic_cast< vtkImageData* >( blender->GetInput( ) );
 
-    // Create 3D outline
-    double bb[ 6 ];
-    image->GetBounds( bb );
+  // Create 3D outline
+  double bb[ 6 ];
+  image->GetBounds( bb );
 
-    vtkSmartPointer< vtkOutlineSource > img_ol =
-      vtkSmartPointer< vtkOutlineSource >::New( );
-    img_ol->SetBounds( 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 );
+  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
+  this->AddItem( this->ImageOutlineActor );
 }
 
 // -------------------------------------------------------------------------
@@ -353,6 +328,14 @@ _WindowLevelCommand( double window, double level, void* data )
   MPRActors* actors = reinterpret_cast< MPRActors* >( data );
   if( actors == NULL )
     return;
+
+  actors->Slices[ 0 ][ 0 ]->SetWindowLevel( window, level );
+  actors->Slices[ 0 ][ 1 ]->SetWindowLevel( window, level );
+  actors->Slices[ 0 ][ 2 ]->SetWindowLevel( window, level );
+  actors->Slices[ 1 ][ 0 ]->SetWindowLevel( window, level );
+  actors->Slices[ 1 ][ 1 ]->SetWindowLevel( window, level );
+  actors->Slices[ 1 ][ 2 ]->SetWindowLevel( window, level );
+
   actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
   actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
   actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
index 4a03cd95365f1e934c95629b41c662eacb9677cc..1bf778f1b7cbf729351060892fd26ddce6ecbd2a 100644 (file)
@@ -178,21 +178,21 @@ ShowData( const std::string& name )
   if( iIt == this->m_Data.end( ) )
     return;
 
-  /*
-    if( iIt->second.Tag == Data::IMAGE )
-    {
+  if( iIt->second.Tag == Data::IMAGE )
+  {
     this->m_MPRObjects->AddImage( iIt->second.Image );
-    }
-    else if( iIt->second.Tag == Data::MESH )
-    {
-    vtkRenderer* ren =
-    this->m_VTK[ 3 ]->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
-    if( ren == NULL )
-    return;
-    ren->AddActor( iIt->second.GetMeshActor( ) );
-    this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
-    } // fi
-  */
+  }
+  else if( iIt->second.Tag == Data::MESH )
+  {
+    /* TODO
+       vtkRenderer* ren =
+       this->m_VTK[ 3 ]->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
+       if( ren == NULL )
+       return;
+       ren->AddActor( iIt->second.GetMeshActor( ) );
+       this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
+    */
+  } // fi
 }
 
 // -------------------------------------------------------------------------
index f63fbbc1b802cb89d9e2c9da2b3391a855b6f4bf..8312246c510f899def13458bd4b0b92444a6912b 100644 (file)
@@ -47,7 +47,8 @@ Clear( )
 void cpPlugins::Interface::Parameters::
 ConfigureAsString( const TString& name, const TString& v )
 {
-  this->m_Parameters[ name ] = TParameter( Self::String, TValues( v, v ) );
+  this->m_Parameters[ name ] =
+    TParameter( Self::String, TValues( v, v ) );
   this->Modified( );
 }
 
index 791d526263ad5584ab0b0bfe73010e7403d7ba6a..4b4e3424f699f8b167aa9b0fe6a7d394affb33f0 100644 (file)
@@ -11,7 +11,8 @@ ConfigureAsIndex( const TString& name, const TUint& dim, const I& v )
   for( unsigned int d = 1; d < dim; ++d )
     str << ";" << v[ d ];
   std::string s = str.str( );
-  this->m_Parameters[ name ] = TParameter( Self::Index, TValues( s, s ) );
+  this->m_Parameters[ name ] =
+    TParameter( Self::Index, TValues( s, s ) );
   this->Modified( );
 }
 
@@ -25,7 +26,8 @@ ConfigureAsPoint( const TString& name, const TUint& dim, const P& v )
   for( unsigned int d = 1; d < dim; ++d )
     str << ";" << v[ d ];
   std::string s = str.str( );
-  this->m_Parameters[ name ] = TParameter( Self::Point, TValues( s, s ) );
+  this->m_Parameters[ name ] =
+    TParameter( Self::Point, TValues( s, s ) );
   this->Modified( );
 }