]> Creatis software - cpPlugins.git/commitdiff
Intermediary push, DO NOT USE
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 15 Oct 2015 15:45:11 +0000 (10:45 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 15 Oct 2015 15:45:11 +0000 (10:45 -0500)
lib/cpExtensions/Visualization/BaseInteractorStyle.cxx
lib/cpExtensions/Visualization/BaseInteractorStyle.h
lib/cpExtensions/Visualization/ImageInteractorStyle.cxx
lib/cpExtensions/Visualization/ImageInteractorStyle.h
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpExtensions/Visualization/ImageSliceActors.h

index 6b9c8efe30fb3c5dbbebe9752e442a40797f1d98..b5641012bc42e43a2fc1b239c601e734056f580e 100644 (file)
@@ -8,15 +8,97 @@
 #include <vtkRenderWindowInteractor.h>
 
 // -------------------------------------------------------------------------
-const long cpExtensions::Visualization::BaseInteractorStyle::MouseButtonEvent::
-MAX_DOUBLE_CLICK = 200; // ms
+long cpExtensions::Visualization::BaseInteractorStyle::_TMouseButtonEvent::
+MaxDoubleClick = 200; // ms
 
 // -------------------------------------------------------------------------
-cpExtensions::Visualization::BaseInteractorStyle::
-Self* cpExtensions::Visualization::BaseInteractorStyle::
-New( )
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddMouseMoveCommand( TMouseCommand command, void* data )
+{
+  this->m_MouseMoveCommands.push_back(
+    std::pair< TMouseCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddMouseClickCommand( TMouseCommand command, void* data )
+{
+  this->m_MouseClickCommands.push_back(
+    std::pair< TMouseCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddMouseDoubleClickCommand( TMouseCommand command, void* data )
 {
-  return( new Self );
+  this->m_MouseDoubleClickCommands.push_back(
+    std::pair< TMouseCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddMouseWheelCommand( TMouseWheelCommand command, void* data )
+{
+  this->m_MouseWheelCommands.push_back(
+    std::pair< TMouseWheelCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddKeyCommand( TKeyCommand command, void* data )
+{
+  this->m_KeyCommands.push_back(
+    std::pair< TKeyCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddExposeCommand( TVoidCommand command, void* data )
+{
+  this->m_ExposeCommands.push_back(
+    std::pair< TVoidCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddConfigureCommand( TVoidCommand command, void* data )
+{
+  this->m_ConfigureCommands.push_back(
+    std::pair< TVoidCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddEnterCommand( TVoidCommand command, void* data )
+{
+  this->m_EnterCommands.push_back(
+    std::pair< TVoidCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+AddLeaveCommand( TVoidCommand command, void* data )
+{
+  this->m_LeaveCommands.push_back(
+    std::pair< TVoidCommand, void* >( command, data )
+    );
+  this->Modified( );
 }
 
 // -------------------------------------------------------------------------
@@ -69,27 +151,74 @@ OnMouseMove( )
     } // fi
 
   } // fi
+
+  // Get mouse pointer position
+  double pos[ 3 ];
+  if( !( this->_PickPosition( pos ) ) )
+    return;
+
+  // Invoke possible specialized events
+  for( unsigned int i = 0; i < this->m_MouseMoveCommands.size( ); ++i )
+    this->m_MouseMoveCommands[ i ].first(
+      this->m_MouseMoveCommands[ i ].second, button, pos, alt, ctr, sft
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnMouseWheelForward( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_MouseWheelCommands.size( ); ++i )
+    this->m_MouseWheelCommands[ i ].first(
+      this->m_MouseWheelCommands[ i ].second, 1,
+      rwi->GetAltKey( ) == 1,
+      rwi->GetControlKey( ) == 1,
+      rwi->GetShiftKey( ) == 1
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnMouseWheelBackward( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_MouseWheelCommands.size( ); ++i )
+    this->m_MouseWheelCommands[ i ].first(
+      this->m_MouseWheelCommands[ i ].second, -1,
+      rwi->GetAltKey( ) == 1,
+      rwi->GetControlKey( ) == 1,
+      rwi->GetShiftKey( ) == 1
+      );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::BaseInteractorStyle::
 OnLeftButtonDown( )
 {
-  this->ActiveButton = Self::ButtonID_Left;
+  this->m_ActiveButton = Self::ButtonID_Left;
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::BaseInteractorStyle::
 OnLeftButtonUp( )
 {
-  this->ActiveButton = Self::ButtonID_None;
+  this->m_ActiveButton = Self::ButtonID_None;
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::BaseInteractorStyle::
 OnMiddleButtonDown( )
 {
-  this->ActiveButton = Self::ButtonID_Middle;
+  this->m_ActiveButton = Self::ButtonID_Middle;
 
   // Get current position on the associated actors
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -109,7 +238,7 @@ OnMiddleButtonDown( )
 void cpExtensions::Visualization::BaseInteractorStyle::
 OnMiddleButtonUp( )
 {
-  this->ActiveButton = Self::ButtonID_None;
+  this->m_ActiveButton = Self::ButtonID_None;
 
   // Get current position on the associated actors
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -135,7 +264,7 @@ OnMiddleButtonUp( )
 void cpExtensions::Visualization::BaseInteractorStyle::
 OnRightButtonDown( )
 {
-  this->ActiveButton = Self::ButtonID_Right;
+  this->m_ActiveButton = Self::ButtonID_Right;
 
   // Get current position on the associated actors
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -155,7 +284,7 @@ OnRightButtonDown( )
 void cpExtensions::Visualization::BaseInteractorStyle::
 OnRightButtonUp( )
 {
-  this->ActiveButton = Self::ButtonID_None;
+  this->m_ActiveButton = Self::ButtonID_None;
 
   // Get current position on the associated actors
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -177,6 +306,256 @@ OnRightButtonUp( )
   } // hctiws
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnLeftClick( )
+{
+  // Get current position on the associated actors
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Get mouse pointer position
+  double pos[ 3 ];
+  if( !( this->_PickPosition( pos ) ) )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
+    this->m_MouseClickCommands[ i ].first(
+      this->m_MouseClickCommands[ i ].second,
+      Self::ButtonID_Left,
+      pos,
+      rwi->GetAltKey( ) == 1,
+      rwi->GetControlKey( ) == 1,
+      rwi->GetShiftKey( ) == 1
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnLeftDoubleClick( )
+{
+  // Get current position on the associated actors
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Get mouse pointer position
+  double pos[ 3 ];
+  if( !( this->_PickPosition( pos ) ) )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
+    this->m_MouseDoubleClickCommands[ i ].first(
+      this->m_MouseDoubleClickCommands[ i ].second,
+      Self::ButtonID_Left,
+      pos,
+      rwi->GetAltKey( ) == 1,
+      rwi->GetControlKey( ) == 1,
+      rwi->GetShiftKey( ) == 1
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnMiddleClick( )
+{
+  // Get current position on the associated actors
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Get mouse pointer position
+  double pos[ 3 ];
+  if( !( this->_PickPosition( pos ) ) )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
+    this->m_MouseClickCommands[ i ].first(
+      this->m_MouseClickCommands[ i ].second,
+      Self::ButtonID_Middle,
+      pos,
+      rwi->GetAltKey( ) == 1,
+      rwi->GetControlKey( ) == 1,
+      rwi->GetShiftKey( ) == 1
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnMiddleDoubleClick( )
+{
+  // Get current position on the associated actors
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Get mouse pointer position
+  double pos[ 3 ];
+  if( !( this->_PickPosition( pos ) ) )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
+    this->m_MouseDoubleClickCommands[ i ].first(
+      this->m_MouseDoubleClickCommands[ i ].second,
+      Self::ButtonID_Middle,
+      pos,
+      rwi->GetAltKey( ) == 1,
+      rwi->GetControlKey( ) == 1,
+      rwi->GetShiftKey( ) == 1
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnRightClick( )
+{
+  // Get current position on the associated actors
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Get mouse pointer position
+  double pos[ 3 ];
+  if( !( this->_PickPosition( pos ) ) )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
+    this->m_MouseClickCommands[ i ].first(
+      this->m_MouseClickCommands[ i ].second,
+      Self::ButtonID_Right,
+      pos,
+      rwi->GetAltKey( ) == 1,
+      rwi->GetControlKey( ) == 1,
+      rwi->GetShiftKey( ) == 1
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnRightDoubleClick( )
+{
+  // Get current position on the associated actors
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Get mouse pointer position
+  double pos[ 3 ];
+  if( !( this->_PickPosition( pos ) ) )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
+    this->m_MouseDoubleClickCommands[ i ].first(
+      this->m_MouseDoubleClickCommands[ i ].second,
+      Self::ButtonID_Right,
+      pos,
+      rwi->GetAltKey( ) == 1,
+      rwi->GetControlKey( ) == 1,
+      rwi->GetShiftKey( ) == 1
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnChar( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_KeyCommands.size( ); ++i )
+    this->m_KeyCommands[ i ].first(
+      this->m_KeyCommands[ i ].second,
+      rwi->GetKeyCode( )
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnKeyDown( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnKeyUp( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnKeyPress( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnKeyRelease( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnExpose( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_ExposeCommands.size( ); ++i )
+    this->m_ExposeCommands[ i ].first( this->m_ExposeCommands[ i ].second );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnConfigure( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_ConfigureCommands.size( ); ++i )
+    this->m_ConfigureCommands[ i ].first(
+      this->m_ConfigureCommands[ i ].second
+      );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnEnter( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_EnterCommands.size( ); ++i )
+    this->m_EnterCommands[ i ].first( this->m_EnterCommands[ i ].second );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::BaseInteractorStyle::
+OnLeave( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+
+  // Invoke possible events
+  for( unsigned int i = 0; i < this->m_LeaveCommands.size( ); ++i )
+    this->m_LeaveCommands[ i ].first( this->m_LeaveCommands[ i ].second );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::BaseInteractorStyle::
 Dolly( )
@@ -187,7 +566,7 @@ Dolly( )
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
   double *center = this->CurrentRenderer->GetCenter( );
   int dy = rwi->GetEventPosition( )[ 1 ] - rwi->GetLastEventPosition( )[ 1 ];
-  double dyf = this->MotionFactor * dy / center[ 1 ];
+  double dyf = this->m_MotionFactor * dy / center[ 1 ];
   this->_Dolly( std::pow( 1.1, dyf ) );
 }
 
@@ -251,12 +630,12 @@ Pan( )
 cpExtensions::Visualization::BaseInteractorStyle::
 BaseInteractorStyle( )
   : Superclass( ),
-    MotionFactor( double( 10 ) )
+    m_MotionFactor( double( 10 ) )
 {
-  this->LeftButtonEvent.Reset( );
-  this->MiddleButtonEvent.Reset( );
-  this->RightButtonEvent.Reset( );
-  this->ActiveButton = Self::ButtonID_None;
+  this->m_LeftButtonEvent.Reset( );
+  this->m_MiddleButtonEvent.Reset( );
+  this->m_RightButtonEvent.Reset( );
+  this->m_ActiveButton = Self::ButtonID_None;
 
   this->EventCallbackCommand->SetCallback( Self::_ProcessEvents );
 }
@@ -312,7 +691,7 @@ _ProcessEvents(
   break;
   case vtkCommand::LeftButtonPressEvent:
   {
-    unsigned char nc = s->LeftButtonEvent.Clicks( );
+    unsigned char nc = s->m_LeftButtonEvent.Clicks( );
     if( nc == 2 )
       s->OnLeftDoubleClick( );
     else if( nc == 1 )
@@ -322,13 +701,13 @@ _ProcessEvents(
   break;
   case vtkCommand::LeftButtonReleaseEvent:
   {
-    s->LeftButtonEvent.Release( );
+    s->m_LeftButtonEvent.Release( );
     s->OnLeftButtonUp( );
   }
   break;
   case vtkCommand::MiddleButtonPressEvent:
   {
-    unsigned char nc = s->MiddleButtonEvent.Clicks( );
+    unsigned char nc = s->m_MiddleButtonEvent.Clicks( );
     if( nc == 2 )
       s->OnMiddleDoubleClick( );
     else if( nc == 1 )
@@ -338,13 +717,13 @@ _ProcessEvents(
   break;
   case vtkCommand::MiddleButtonReleaseEvent:
   {
-    s->MiddleButtonEvent.Release( );
+    s->m_MiddleButtonEvent.Release( );
     s->OnMiddleButtonUp( );
   }
   break;
   case vtkCommand::RightButtonPressEvent:
   {
-    unsigned char nc = s->RightButtonEvent.Clicks( );
+    unsigned char nc = s->m_RightButtonEvent.Clicks( );
     if( nc == 2 )
       s->OnRightDoubleClick( );
     else if( nc == 1 )
@@ -354,7 +733,7 @@ _ProcessEvents(
   break;
   case vtkCommand::RightButtonReleaseEvent:
   {
-    s->RightButtonEvent.Release( );
+    s->m_RightButtonEvent.Release( );
     s->OnRightButtonUp( );
   }
   break;
index 75c85d88f7eaf97442b0a35da00a5dc6b2387732..c02dbc7ee701e9e3e1fe957483a59ddc284c2337 100644 (file)
@@ -4,14 +4,12 @@
 #include <cpExtensions/cpExtensions_Export.h>
 
 #include <chrono>
+#include <utility>
+#include <vector>
 #include <vtkInteractorStyle.h>
 
-/*
- * Compile ITK and VTK with: cmake -DCMAKE_CXX_FLAGS="-std=c++11" /dir/to/source
- */
-
 /* =========================================================================
- * Double click algorithm taken from:
+ * Double click algorithm inspired from:
  * http://www.autohotkey.com/board/topic/56493-easiest-way-to-detect-double-clicks/
  * =========================================================================
  */
@@ -43,19 +41,34 @@ namespace cpExtensions
         ButtonID_Right
       };
 
+      // Callbacks types
+      typedef void ( *TMouseCommand )( void*, const ButtonID&, double*, bool, bool, bool );
+      typedef void ( *TMouseWheelCommand )( void*, const int&, bool, bool, bool );
+      typedef void ( *TKeyCommand )( void*, const char& );
+      typedef void ( *TVoidCommand )( void* );
+
     public:
-      static Self* New( );
+      // Associate callbacks for each event
+      void AddMouseMoveCommand( TMouseCommand command, void* data );
+      void AddMouseClickCommand( TMouseCommand command, void* data );
+      void AddMouseDoubleClickCommand( TMouseCommand command, void* data );
+      void AddMouseWheelCommand( TMouseWheelCommand command, void* data );
+      void AddKeyCommand( TKeyCommand command, void* data );
+      void AddExposeCommand( TVoidCommand command, void* data );
+      void AddConfigureCommand( TVoidCommand command, void* data );
+      void AddEnterCommand( TVoidCommand command, void* data );
+      void AddLeaveCommand( TVoidCommand command, void* data );
 
       void DelegateTDxEvent( unsigned long event, void* calldata );
 
       // Possible mouse motion events
       virtual void OnMouseMove( );
-      virtual void OnMouseWheelForward( ) { }
-      virtual void OnMouseWheelBackward( ) { }
+      virtual void OnMouseWheelForward( );
+      virtual void OnMouseWheelBackward( );
 
       // Possible mouse click-related events
       inline ButtonID GetButtonID( ) const
-      { return( this->ActiveButton ); }
+        { return( this->m_ActiveButton ); }
 
       virtual void OnLeftButtonDown( );
       virtual void OnLeftButtonUp( );
@@ -64,25 +77,25 @@ namespace cpExtensions
       virtual void OnRightButtonDown( );
       virtual void OnRightButtonUp( );
 
-      virtual void OnLeftClick( ) { }
-      virtual void OnLeftDoubleClick( ) { }
-      virtual void OnMiddleClick( ) { }
-      virtual void OnMiddleDoubleClick( ) { }
-      virtual void OnRightClick( ) { }
-      virtual void OnRightDoubleClick( ) { }
+      virtual void OnLeftClick( );
+      virtual void OnLeftDoubleClick( );
+      virtual void OnMiddleClick( );
+      virtual void OnMiddleDoubleClick( );
+      virtual void OnRightClick( );
+      virtual void OnRightDoubleClick( );
 
       // Keyboard-related events
-      virtual void OnChar( ) { }
-      virtual void OnKeyDown( ) { }
-      virtual void OnKeyUp( ) { }
-      virtual void OnKeyPress( ) { }
-      virtual void OnKeyRelease( ) { }
+      virtual void OnChar( );
+      virtual void OnKeyDown( );
+      virtual void OnKeyUp( );
+      virtual void OnKeyPress( );
+      virtual void OnKeyRelease( );
 
       // Other events
-      virtual void OnExpose( ) { }
-      virtual void OnConfigure( ) { }
-      virtual void OnEnter( ) { }
-      virtual void OnLeave( ) { }
+      virtual void OnExpose( );
+      virtual void OnConfigure( );
+      virtual void OnEnter( );
+      virtual void OnLeave( );
 
       virtual void Dolly( );
       virtual void Pan( );
@@ -93,6 +106,10 @@ namespace cpExtensions
 
       virtual void _Dolly( double factor );
 
+      // Extension interface
+      virtual bool _PickPosition( double pos[ 3 ] ) = 0;
+
+      // Main event callback
       static void _ProcessEvents(
         vtkObject* object,
         unsigned long event,
@@ -106,40 +123,51 @@ namespace cpExtensions
       Self& operator=( const Self& );
 
     protected:
-      double MotionFactor;
+      double m_MotionFactor;
+
+      // Callbacks
+      std::vector< std::pair< TMouseCommand, void* > >      m_MouseMoveCommands;
+      std::vector< std::pair< TMouseCommand, void* > >      m_MouseClickCommands;
+      std::vector< std::pair< TMouseCommand, void* > >      m_MouseDoubleClickCommands;
+      std::vector< std::pair< TMouseWheelCommand, void* > > m_MouseWheelCommands;
+      std::vector< std::pair< TKeyCommand, void* > >        m_KeyCommands;
+      std::vector< std::pair< TVoidCommand, void* > >       m_ExposeCommands;
+      std::vector< std::pair< TVoidCommand, void* > >       m_ConfigureCommands;
+      std::vector< std::pair< TVoidCommand, void* > >       m_EnterCommands;
+      std::vector< std::pair< TVoidCommand, void* > >       m_LeaveCommands;
 
       /**
        * Button events
        */
-      struct MouseButtonEvent
+      struct _TMouseButtonEvent
       {
-        static const long MAX_DOUBLE_CLICK;
-        long LastButtonUp;
-        long LastButtonHeld;
-        long LastButtonDown;
+        static long MaxDoubleClick;
+        long m_LastButtonUp;
+        long m_LastButtonHeld;
+        long m_LastButtonDown;
 
-        inline MouseButtonEvent( )
+        inline _TMouseButtonEvent( )
           { this->Reset( ); }
         inline void Reset( )
           {
-            this->LastButtonUp = 0;
-            this->LastButtonHeld = 0;
-            this->LastButtonDown = -1;
+            this->m_LastButtonUp = 0;
+            this->m_LastButtonHeld = 0;
+            this->m_LastButtonDown = -1;
           }
         inline void Release( )
           {
             long c = BaseInteractorStyle_DIFF_TIME;
-            this->LastButtonUp = c;
-            this->LastButtonHeld = c - this->LastButtonDown;
-            this->LastButtonDown = -1;
+            this->m_LastButtonUp = c;
+            this->m_LastButtonHeld = c - this->m_LastButtonDown;
+            this->m_LastButtonDown = -1;
           }
         inline unsigned char Clicks( )
           {
             unsigned char n = 0;
             long c = BaseInteractorStyle_DIFF_TIME;
             if(
-              this->LastButtonHeld < MAX_DOUBLE_CLICK &&
-              ( c - this->LastButtonUp ) < MAX_DOUBLE_CLICK
+              this->m_LastButtonHeld < MaxDoubleClick &&
+              ( c - this->m_LastButtonUp ) < MaxDoubleClick
               )
             {
               this->Reset( );
@@ -147,15 +175,15 @@ namespace cpExtensions
             }
             else
               n = 1;
-            if( this->LastButtonDown < 0 )
-              this->LastButtonDown = c;
+            if( this->m_LastButtonDown < 0 )
+              this->m_LastButtonDown = c;
             return( n );
           }
       };
-      MouseButtonEvent LeftButtonEvent;
-      MouseButtonEvent MiddleButtonEvent;
-      MouseButtonEvent RightButtonEvent;
-      ButtonID ActiveButton;
+      _TMouseButtonEvent m_LeftButtonEvent;
+      _TMouseButtonEvent m_MiddleButtonEvent;
+      _TMouseButtonEvent m_RightButtonEvent;
+      ButtonID         m_ActiveButton;
     };
 
   } // ecapseman
index 55df632c5997311e37ea50c3dcce16121baf4a51..9ed180ad93a42e45229d5508e5e5e4490b0a0e15 100644 (file)
@@ -11,317 +11,25 @@ New( )
   return( new Self );
 }
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-AssociateView( void* data )
-{
-  this->Data = data;
-}
-
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageInteractorStyle::
 AssociateImageActor( vtkImageActor* actor )
 {
-  this->PropPicker->AddPickList( actor );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-AssociateInteractor( vtkRenderWindowInteractor* rwi )
-{
-  if( rwi != NULL )
+  if( actor != NULL )
   {
-    this->AssociatedInteractors.push_back( rwi );
+    this->m_PropPicker->AddPickList( actor );
     this->Modified( );
 
   } // fi
 }
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMouseMove( )
-{
-  this->Superclass::OnMouseMove( );
-
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseMoveCommand == NULL )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-  ButtonID button = this->GetButtonID( );
-
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
-    return;
-
-  // Invoke possible events
-  this->MouseMoveCommand( this->Data, button, pos, alt, ctr, sft );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMouseWheelForward( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseWheelCommand == NULL )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-
-  // Invoke possible events
-  this->MouseWheelCommand( this->Data, 1, alt, ctr, sft );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMouseWheelBackward( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseWheelCommand == NULL )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-
-  // Invoke possible events
-  this->MouseWheelCommand( this->Data, -1, alt, ctr, sft );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnLeftClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseClickCommand == NULL )
-    return;
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-
-  // Invoke possible events
-  this->MouseClickCommand(
-    this->Data, Self::ButtonID_Left, pos, alt, ctr, sft
-    );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnLeftDoubleClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseDoubleClickCommand == NULL )
-    return;
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-
-  // Invoke possible events
-  this->MouseDoubleClickCommand(
-    this->Data, Self::ButtonID_Left, pos, alt, ctr, sft
-    );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMiddleClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseClickCommand == NULL )
-    return;
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-
-  // Invoke possible events
-  this->MouseClickCommand(
-    this->Data, Self::ButtonID_Middle, pos, alt, ctr, sft
-    );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMiddleDoubleClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseDoubleClickCommand == NULL )
-    return;
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-
-  // Invoke possible events
-  this->MouseDoubleClickCommand(
-    this->Data, Self::ButtonID_Middle, pos, alt, ctr, sft
-    );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnRightClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseClickCommand == NULL )
-    return;
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-
-  // Invoke possible events
-  this->MouseClickCommand(
-    this->Data, Self::ButtonID_Right, pos, alt, ctr, sft
-    );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnRightDoubleClick( )
-{
-  // Get current position on the associated actors
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->MouseDoubleClickCommand == NULL )
-    return;
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
-    return;
-
-  // Get modifiers
-  bool alt = ( rwi->GetAltKey( ) == 1 );
-  bool ctr = ( rwi->GetControlKey( ) == 1 );
-  bool sft = ( rwi->GetShiftKey( ) == 1 );
-
-  // Invoke possible events
-  this->MouseDoubleClickCommand(
-    this->Data, Self::ButtonID_Right, pos, alt, ctr, sft
-    );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnChar( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL || this->KeyCommand == NULL )
-    return;
-  this->KeyCommand( this->Data, rwi->GetKeyCode( ) );
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnExpose( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnConfigure( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnEnter( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnLeave( )
-{
-  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
-  if( rwi == NULL )
-    return;
-  rwi->Render( );
-  this->_RenderAssociatedInteractors( );
-}
-
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::ImageInteractorStyle::
 ImageInteractorStyle( )
-  : Superclass( ),
-    Data( NULL ),
-    MouseMoveCommand( NULL ),
-    MouseClickCommand( NULL ),
-    MouseDoubleClickCommand( NULL ),
-    MouseWheelCommand( NULL ),
-    KeyCommand( NULL )
+  : Superclass( )
 {
-  this->PropPicker = vtkSmartPointer< vtkPropPicker >::New( );
-  this->PropPicker->PickFromListOn( );
+  this->m_PropPicker = vtkSmartPointer< vtkPropPicker >::New( );
+  this->m_PropPicker->PickFromListOn( );
 }
 
 // -------------------------------------------------------------------------
@@ -334,6 +42,7 @@ cpExtensions::Visualization::ImageInteractorStyle::
 bool cpExtensions::Visualization::ImageInteractorStyle::
 _PickPosition( double pos[ 3 ] )
 {
+  static const double _0 = double( 0 );
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
   if( rwi == NULL )
     return( false );
@@ -344,705 +53,11 @@ _PickPosition( double pos[ 3 ] )
   this->FindPokedRenderer( x, y );
 
   // Pick a 3D position
-  int r = this->PropPicker->Pick( x, y, double( 0 ), this->CurrentRenderer );
+  int r = this->m_PropPicker->Pick( x, y, _0, this->CurrentRenderer );
   if( r == 0 )
     return( false );
-  this->PropPicker->GetPickPosition( pos );
-
-  return( true );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-_RenderAssociatedInteractors( )
-{
-  for( unsigned int i = 0; i < this->AssociatedInteractors.size( ); ++i )
-    this->AssociatedInteractors[ i ]->Render( );
-}
-
-/*
-#include <cmath>
-#include <ctime>
-
-#include <vtkAnnotatedCubeActor.h>
-#include <vtkAxesActor.h>
-#include <vtkCallbackCommand.h>
-#include <vtkCamera.h>
-#include <vtkCellArray.h>
-#include <vtkCommand.h>
-#include <vtkMatrix4x4.h>
-#include <vtkPropAssembly.h>
-#include <vtkProperty.h>
-#include <vtkRendererCollection.h>
-#include <vtkRenderWindow.h>
-#include <vtkRenderWindowInteractor.h>
-
-#include <cpExtensions/Visualization/ImageSliceActors.h>
-#include <cpExtensions/Visualization/MPRActors.h>
-
-// -------------------------------------------------------------------------
-const int cpExtensions::Visualization::
-ImageInteractorStyle::CursorEvent = vtkCommand::UserEvent + 1;
-const int cpExtensions::Visualization::
-ImageInteractorStyle::RadiusEvent = vtkCommand::UserEvent + 2;
-const int cpExtensions::Visualization::
-ImageInteractorStyle::DoubleClickEvent = vtkCommand::UserEvent + 3;
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageInteractorStyle::
-Self* cpExtensions::Visualization::ImageInteractorStyle::
-New( )
-{
-  return( new Self( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-Configure( ImageSliceActors* slice_actors, MPRActors* mpr_actors )
-{
-  this->m_SliceActors = slice_actors;
-  this->m_MPRActors = mpr_actors;
-  this->SetModeToNavigation( );
-  this->PropPicker->AddPickList( slice_actors->GetImageActor( 0 ) );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-AssociateInteractor( vtkRenderWindowInteractor* interactor )
-{
-  if( interactor != NULL )
-  {
-    this->AssociatedInteractors.push_back( interactor );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-SetModeToNavigation( )
-{
-  this->Mode = Self::NavigationMode;
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-SetModeToDeformation( )
-{
-  this->Mode = Self::DeformationMode;
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-SetInteractor( vtkRenderWindowInteractor* interactor, const int& axis )
-{
-  this->Superclass::SetInteractor( interactor );
-  this->OrientationWidget->SetInteractor( interactor );
-  interactor->SetInteractorStyle( this );
-  if( interactor == NULL )
-    return;
-
-  // Get camera, avoiding segfaults
-  vtkRenderer* ren =
-    interactor->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
-  if( ren == NULL )
-    return;
-  vtkCamera* cam = ren->GetActiveCamera( );
-  if( cam == NULL )
-    return;
-
-  // Parallel projections are better when displaying 2D images
-  cam->ParallelProjectionOn( );
-  cam->SetFocalPoint( double( 0 ), double( 0 ), double( 0 ) );
-  if( axis == 0 )
-  {
-    cam->SetPosition( double( 1 ), double( 0 ), double( 0 ) );
-    cam->SetViewUp  ( double( 0 ), double( 1 ), double( 0 ) );
-  }
-  else if( axis == 1 )
-  {
-    cam->SetPosition( double( 0 ), double( 1 ), double(  0 ) );
-    cam->SetViewUp  ( double( 0 ), double( 0 ), double( -1 ) );
-  }
-  else // if( axis == 2 )
-  {
-    cam->SetPosition( double( 0 ), double( 0 ), double( 1 ) );
-    cam->SetViewUp  ( double( 0 ), double( 1 ), double( 0 ) );
-
-  } // fi
-  ren->ResetCamera( );
-
-  // Enable 2D orientation widget
-  this->OrientationWidget->SetEnabled( 1 );
-  this->OrientationWidget->InteractiveOff( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMouseMove( )
-{
-  if( this->m_MPRActors == NULL )
-    return;
-
-  if( this->CursorMoving )
-  {
-    bool picked = this->_PickPosition( this->Cursor );
-    if( picked )
-    {
-      for( int i = 0; i < 3; ++i )
-        if( this->m_SliceActors->GetAxis( ) != i )
-          this->m_MPRActors->SetSlice( i, this->Cursor[ i ] );
-      this->InvokeEvent( Self::CursorEvent, this->Cursor );
-      this->Interactor->Render( );
-      this->_RenderAssociateInteractors( );
-
-    } // fi
-  }
-  else if( this->RadiusMoving )
-  {
-    bool picked = this->_PickPosition( this->Radius );
-    if( picked )
-    {
-      this->InvokeEvent( Self::RadiusEvent, this->Radius );
-      this->_UpdateRadius( );
-
-    } // fi
-  }
-  else
-  {
-    switch( this->State )
-    {
-    case VTKIS_WINDOW_LEVEL:
-      this->WindowLevel( );
-      break;
-    case VTKIS_DOLLY:
-      this->Dolly( );
-      break;
-    case VTKIS_PAN:
-      this->Pan( );
-      break;
-    } // hctiws
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnLeftButtonDown( )
-{
-  static double pnt[ 3 ];
-  static int pos[ 2 ];
-  this->Interactor->GetEventPosition( pos );
-  this->FindPokedRenderer( pos[ 0 ], pos[ 1 ] );
-  if( this->CurrentRenderer == NULL )
-    return;
-  this->GrabFocus( this->EventCallbackCommand );
-
-  // TODO: check this code
-  // Manage double-click
-  static const long epsilon_time = 800;
-  static long last_click_time = -( epsilon_time << 1 );
-  long click_time = static_cast< long >( std::clock( ) );
-  if( ( click_time - last_click_time ) < epsilon_time )
-  {
-    last_click_time = -( epsilon_time << 1 );
-    if( this->_PickPosition( pnt ) )
-      this->InvokeEvent( Self::DoubleClickEvent, pnt );
-  }
-  else
-  {
-    last_click_time = click_time;
-    if( this->Interactor->GetControlKey( ) )
-      this->StartCursorMoving( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnLeftButtonUp( )
-{
-  if( this->CursorMoving )
-  {
-    this->EndCursorMoving( );
-    if( this->Interactor )
-      this->ReleaseFocus( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMiddleButtonDown( )
-{
-  int x = this->Interactor->GetEventPosition( )[ 0 ];
-  int y = this->Interactor->GetEventPosition( )[ 1 ];
-
-  this->FindPokedRenderer( x, y );
-  if( this->CurrentRenderer == NULL )
-    return;
-  this->GrabFocus( this->EventCallbackCommand );
-
-  if( this->Interactor->GetAltKey( ) )
-  {
-  }
-  else if( this->Interactor->GetControlKey( ) )
-  {
-    this->StartRadiusMoving( );
-  }
-  else if( this->Interactor->GetShiftKey( ) )
-  {
-  }
-  else
-    this->StartPan( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMiddleButtonUp( )
-{
-  if( this->RadiusMoving )
-  {
-    this->EndRadiusMoving( );
-    if( this->Interactor )
-      this->ReleaseFocus( );
-  }
-  else
-  {
-    switch( this->State )
-    {
-    case VTKIS_PAN:
-      this->EndPan( );
-      break;
-    } // hctiws
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnRightButtonDown( )
-{
-  int x = this->Interactor->GetEventPosition( )[ 0 ];
-  int y = this->Interactor->GetEventPosition( )[ 1 ];
-
-  this->FindPokedRenderer( x, y );
-  if( this->CurrentRenderer == NULL )
-    return;
-  this->GrabFocus( this->EventCallbackCommand );
-
-  if( this->Interactor->GetControlKey( ) )
-  {
-    this->WindowLevelStartPosition[ 0 ] = x;
-    this->WindowLevelStartPosition[ 1 ] = y;
-    this->StartWindowLevel( );
-  }
-  else
-  {
-    this->StartDolly( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnRightButtonUp( )
-{
-  switch( this->State )
-  {
-  case VTKIS_WINDOW_LEVEL:
-  {
-    this->EndWindowLevel( );
-    if( this->Interactor )
-      this->ReleaseFocus( );
-  }
-  break;
-  case VTKIS_DOLLY:
-    this->EndDolly( );
-    break;
-  } // hctiws
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMouseWheelForward( )
-{
-  if( this->m_SliceActors == NULL || this->Interactor == NULL )
-    return;
-  int off = 1;
-  if( this->Interactor->GetShiftKey( ) == 1 )
-    off *= 10;
-  int s = this->m_SliceActors->GetSliceNumber( ) + off;
-  int maxs = this->m_SliceActors->GetSliceNumberMaxValue( );
-  this->m_SliceActors->SetSliceNumber( ( s < maxs )? s: maxs );
-  this->m_MPRActors->SetSlice(
-    this->m_SliceActors->GetAxis( ),
-    this->m_SliceActors->GetSliceNumber( )
-    );
-  this->Interactor->Render( );
-  this->_RenderAssociateInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnMouseWheelBackward( )
-{
-  if( this->m_SliceActors == NULL || this->Interactor == NULL )
-    return;
-  int off = 1;
-  if( this->Interactor->GetShiftKey( ) == 1 )
-    off *= 10;
-  int s = this->m_SliceActors->GetSliceNumber( ) - off;
-  int mins = this->m_SliceActors->GetSliceNumberMinValue( );
-  this->m_SliceActors->SetSliceNumber( ( mins < s )? s: mins );
-  this->m_MPRActors->SetSlice(
-    this->m_SliceActors->GetAxis( ),
-    this->m_SliceActors->GetSliceNumber( )
-    );
-  this->Interactor->Render( );
-  this->_RenderAssociateInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-OnChar( )
-{
-  switch( this->Interactor->GetKeyCode( ) )
-  {
-  case 'r': case 'R':
-  {
-    vtkRenderer* ren =
-      this->Interactor->GetRenderWindow( )->
-      GetRenderers( )->GetFirstRenderer( );
-    if( ren != NULL )
-      ren->ResetCamera( );
-    this->Interactor->Render( );
-  }
-  break;
-  case 'w': case 'W': case 'l': case 'L':
-  {
-    if( this->m_MPRActors != NULL )
-    {
-      this->m_MPRActors->ResetWindowLevel( 0 );
-      this->Interactor->Render( );
-      this->_RenderAssociateInteractors( );
-
-    } // fi
-  }
-  break;
-  } // hctiws
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-WindowLevel( )
-{
-  if( this->Mode == Self::NavigationMode )
-  {
-    if( this->Interactor == NULL )
-      return;
-    vtkRenderer* ren =
-      this->Interactor->GetRenderWindow( )->
-      GetRenderers( )->GetFirstRenderer( );
-    if( ren == NULL )
-      return;
-
-    // Compute scales
-    this->WindowLevelCurrentPosition[ 0 ] =
-      this->Interactor->GetEventPosition( )[ 0 ];
-    this->WindowLevelCurrentPosition[ 1 ] =
-      this->Interactor->GetEventPosition( )[ 1 ];
-    int* size = ren->GetSize( );
-    double sw = double(
-      this->WindowLevelCurrentPosition[ 0 ] -
-      this->WindowLevelStartPosition[ 0 ]
-      ) / double( size[ 0 ] );
-    double sl = (
-      this->WindowLevelStartPosition[ 1 ] -
-      this->WindowLevelCurrentPosition[ 1 ]
-      ) / double( size[ 1 ] );
-
-    double w = this->WindowLevelInitial[ 0 ] + ( sw * 1000.0 );
-    double l = this->WindowLevelInitial[ 1 ] + ( sl * 1000.0 );
-    double minw = this->m_MPRActors->GetMinWindow( 0 );
-    double maxw = this->m_MPRActors->GetMaxWindow( 0 );
-    double minl = this->m_MPRActors->GetMinLevel( 0 );
-    double maxl = this->m_MPRActors->GetMaxLevel( 0 );
-
-    if( w < minw ) w = minw;
-    if( maxw < w ) w = maxw;
-    if( l < minl ) l = minl;
-    if( maxl < l ) l = maxl;
-
-    this->m_MPRActors->SetWindowLevel( 0, w, l );
-    this->Interactor->Render( );
-    this->_RenderAssociateInteractors( );
-  }
-  else if( this->Mode == Self::DeformationMode )
-  {
-    // TODO
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-StartWindowLevel( )
-{
-  if( this->State != VTKIS_NONE )
-    return;
-  if( this->Mode == Self::NavigationMode )
-  {
-    this->StartState( VTKIS_WINDOW_LEVEL );
-
-    this->WindowLevelInitial[ 0 ] = this->m_MPRActors->GetWindow( 0 );
-    this->WindowLevelInitial[ 1 ] = this->m_MPRActors->GetLevel( 0 );
-  }
-  else if( this->Mode == Self::DeformationMode )
-  {
-    // TODO
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-EndWindowLevel( )
-{
-  if( this->Mode == Self::NavigationMode )
-  {
-    if( this->State != VTKIS_WINDOW_LEVEL )
-      return;
-    this->StopState( );
-  }
-  else
-  {
-    // TODO
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-StartCursorMoving( )
-{
-  if( this->CursorMoving )
-    return;
-  this->_PickPosition( this->Cursor );
-  this->CursorMoving = true;
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-EndCursorMoving( )
-{
-  if( !( this->CursorMoving ) )
-    return;
-  this->CursorMoving = false;
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-StartRadiusMoving( )
-{
-  if( this->RadiusMoving )
-    return;
-  this->_PickPosition( this->Radius );
-  this->RadiusMoving = true;
-  this->_UpdateRadius( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-EndRadiusMoving( )
-{
-  if( !( this->RadiusMoving ) )
-    return;
-  this->RadiusMoving = false;
-  this->_UpdateRadius( );
-  this->InvokeEvent( Self::RadiusEvent, NULL );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageInteractorStyle::
-ImageInteractorStyle( )
-  : Superclass( ),
-    Mode( Self::NavigationMode ),
-    m_SliceActors( NULL ),
-    m_MPRActors( NULL ),
-    CursorMoving( false ),
-    RadiusMoving( false )
-{
-  // Orientation marks
-  vtkSmartPointer< vtkAnnotatedCubeActor > cube =
-    vtkSmartPointer< vtkAnnotatedCubeActor >::New( );
-  cube->GetCubeProperty( )->SetColor( 0.9, 0.7, 0.2 );
-  cube->GetTextEdgesProperty( )->SetLineWidth( 1 );
-  cube->GetTextEdgesProperty( )->SetDiffuse( 0 );
-  cube->GetTextEdgesProperty( )->SetAmbient( 1 );
-  cube->GetTextEdgesProperty( )->SetColor( 0.18, 0.28, 0.23 );
-  cube->GetXPlusFaceProperty( )->SetColor( 1, 0, 0 );
-  cube->GetXPlusFaceProperty( )->SetInterpolationToFlat( );
-  cube->GetXMinusFaceProperty( )->SetColor( 1, 0, 0 );
-  cube->GetXMinusFaceProperty( )->SetInterpolationToFlat( );
-  cube->GetYPlusFaceProperty( )->SetColor( 0, 1, 0 );
-  cube->GetYPlusFaceProperty( )->SetInterpolationToFlat( );
-  cube->GetYMinusFaceProperty( )->SetColor( 0, 1, 0 );
-  cube->GetYMinusFaceProperty( )->SetInterpolationToFlat( );
-  cube->GetZPlusFaceProperty( )->SetColor( 0, 0, 1 );
-  cube->GetZPlusFaceProperty( )->SetInterpolationToFlat( );
-  cube->GetZMinusFaceProperty( )->SetColor( 0, 0, 1 );
-  cube->GetZMinusFaceProperty( )->SetInterpolationToFlat( );
-
-  vtkSmartPointer< vtkAxesActor > axes =
-    vtkSmartPointer< vtkAxesActor >::New( );
-  axes->AxisLabelsOff( );
-  axes->SetShaftTypeToCylinder( );
-  axes->SetTotalLength( 2, 2, 2 );
-
-  vtkSmartPointer< vtkPropAssembly > actors =
-    vtkSmartPointer< vtkPropAssembly >::New( );
-  actors->AddPart( cube );
-  actors->AddPart( axes );
-
-  this->OrientationWidget =
-    vtkSmartPointer< vtkOrientationMarkerWidget >::New( );
-  this->OrientationWidget->SetOutlineColor( 0.93, 0.57, 0.13 );
-  this->OrientationWidget->SetOrientationMarker( actors );
-  this->OrientationWidget->SetViewport( 0.0, 0.0, 0.2, 0.2 );
-
-  // Circle
-  unsigned long circle_samples = 1000;
-  this->Circle = vtkSmartPointer< vtkPolyData >::New( );
-
-  vtkSmartPointer< vtkPoints > circle_points =
-    vtkSmartPointer< vtkPoints >::New( );
-  vtkSmartPointer< vtkCellArray > circle_lines =
-    vtkSmartPointer< vtkCellArray >::New( );
-  for( unsigned long s = 0; s < circle_samples; ++s )
-  {
-    double t = double( 6.2832 ) * double( s ) / double( circle_samples );
-    circle_points->InsertNextPoint(
-      std::cos( t ), std::sin( t ), double( 0 )
-      );
-
-    circle_lines->InsertNextCell( 2 );
-    circle_lines->InsertCellPoint( s );
-    circle_lines->InsertCellPoint( ( s + 1 ) % circle_samples );
-
-  } // rof
-  this->Circle->SetPoints( circle_points );
-  this->Circle->SetLines( circle_lines );
-
-  this->CircleMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->CircleMapper->SetInputData( this->Circle );
-  this->CircleActor = vtkSmartPointer< vtkActor >::New( );
-  this->CircleActor->SetMapper( this->CircleMapper );
-  this->CircleActor->GetProperty( )->SetColor( 1, 0, 1 );
-  this->CircleActor->GetProperty( )->SetLineWidth( 2 );
-
-  this->PropPicker = vtkSmartPointer< vtkPropPicker >::New( );
-  this->PropPicker->PickFromListOn( );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageInteractorStyle::
-~ImageInteractorStyle( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-_RenderAssociateInteractors( )
-{
-  std::vector< vtkRenderWindowInteractor* >::iterator rIt =
-    this->AssociatedInteractors.begin( );
-  for( ; rIt != this->AssociatedInteractors.end( ); ++rIt )
-    ( *rIt )->Render( );
-}
-
-// -------------------------------------------------------------------------
-bool cpExtensions::Visualization::ImageInteractorStyle::
-_PickPosition( double pos[ 3 ] )
-{
-  if( this->m_SliceActors == NULL )
-    return( false );
-
-  double x = double( this->Interactor->GetEventPosition( )[ 0 ] );
-  double y = double( this->Interactor->GetEventPosition( )[ 1 ] );
-  this->FindPokedRenderer( x, y );
-  int success =
-    this->PropPicker->Pick( x, y, double( 0 ), this->CurrentRenderer );
-  if( success == 0 )
-    return( false );
-  this->PropPicker->GetPickPosition( pos );
-
-  int axis = this->m_SliceActors->GetAxis( );
-  double* bounds = this->m_SliceActors->GetDisplayBounds( );
-  pos[ axis ] = bounds[ axis << 1 ];
-
+  this->m_PropPicker->GetPickPosition( pos );
   return( true );
 }
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-_UpdateCursor( )
-{
-  std::cout << "upcur" << std::endl;
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
-_UpdateRadius( )
-{
-  vtkRenderer* ren =
-    this->Interactor->GetRenderWindow( )->
-    GetRenderers( )->GetFirstRenderer( );
-  if( ren == NULL )
-    return;
-  vtkCamera* cam = ren->GetActiveCamera( );
-  if( cam == NULL )
-    return;
-
-  if( this->RadiusMoving )
-  {
-    double x = this->Cursor[ 0 ] - this->Radius[ 0 ];
-    double y = this->Cursor[ 1 ] - this->Radius[ 1 ];
-    double z = this->Cursor[ 2 ] - this->Radius[ 2 ];
-    double r = std::sqrt( ( x * x ) + ( y * y ) + ( z * z ) );
-
-    vtkMatrix4x4* cam_matrix = cam->GetModelViewTransformMatrix( );
-    vtkSmartPointer< vtkMatrix4x4 > circle_matrix =
-      this->CircleActor->GetUserMatrix( );
-    if( circle_matrix.GetPointer( ) == NULL )
-    {
-      circle_matrix = vtkSmartPointer< vtkMatrix4x4 >::New( );
-      this->CircleActor->SetUserMatrix( circle_matrix );
-
-    } // fi
-    for( int i = 0; i < 4; ++i )
-    {
-      for( int j = 0; j < 4; ++j )
-      {
-        double v = cam_matrix->GetElement( i, j );
-        if( i < 3 && j == 3 )
-          v = this->Cursor[ i ];
-        if( i < 3 && j < 3 )
-          v *= r;
-        circle_matrix->SetElement( i, j, v );
-
-      } // rof
-
-    } // rof
-    this->CircleActor->Modified( );
-    ren->AddActor( this->CircleActor );
-  }
-  else
-    ren->RemoveActor( this->CircleActor );
-
-  this->Interactor->Render( );
-}
-*/
-
 // eof - $RCSfile$
index 169f09b9fcbfde16abd358560c100b3819fce0f3..9048926cb8822f8ead5a697f51f9396a3ba18de7 100644 (file)
@@ -8,24 +8,6 @@
 #include <vtkSmartPointer.h>
 #include <vtkPropPicker.h>
 
-/* TODO
-   #include <vtkInteractorStyleImage.h>
-   #include <vtkOrientationMarkerWidget.h>
-
-   #include <cpExtensions/cpExtensions_Export.h>
-
-   // -------------------------------------------------------------------------
-   #define cpPlugins_ImageInteractorStyle_ObserverMacro( e )  \
-   inline unsigned long Add##e##Observer( vtkCommand* observer )        \
-   { return( this->AddObserver( Self::e##Event, observer ) ); }         \
-   inline void Remove##e##Observer( unsigned long tag )                 \
-   { this->RemoveObserver( tag ); }                                     \
-   inline void Remove##e##Observer( vtkCommand* observer )              \
-   { this->RemoveObserver( observer ); }                                \
-   inline void Remove##e##Observers( )                                  \
-   { this->RemoveObservers( Self::e##Event ); }
-*/
-
 // Forward definitions
 class vtkImageActor;
 
@@ -42,58 +24,17 @@ namespace cpExtensions
       typedef ImageInteractorStyle Self;
       vtkTypeMacro( ImageInteractorStyle, BaseInteractorStyle );
 
-    public:
-      typedef void ( *TMouseCommand )( void*, const ButtonID&, double*, bool, bool, bool );
-      typedef void ( *TMouseWheelCommand )( void*, const int&, bool, bool, bool );
-      typedef void ( *TKeyCommand )( void*, const char& );
-
-      vtkGetMacro( MouseMoveCommand, TMouseCommand );
-      vtkGetMacro( MouseClickCommand, TMouseCommand );
-      vtkGetMacro( MouseDoubleClickCommand, TMouseCommand );
-      vtkGetMacro( MouseWheelCommand, TMouseWheelCommand );
-      vtkGetMacro( KeyCommand, TKeyCommand );
-
-      vtkSetMacro( MouseMoveCommand, TMouseCommand );
-      vtkSetMacro( MouseClickCommand, TMouseCommand );
-      vtkSetMacro( MouseDoubleClickCommand, TMouseCommand );
-      vtkSetMacro( MouseWheelCommand, TMouseWheelCommand );
-      vtkSetMacro( KeyCommand, TKeyCommand );
-
     public:
       static Self* New( );
 
-      virtual void AssociateView( void* data );
+      // Data for local picker
       virtual void AssociateImageActor( vtkImageActor* actor );
-      virtual void AssociateInteractor( vtkRenderWindowInteractor* rwi );
-
-      // Possible mouse motion events
-      virtual void OnMouseMove( );
-      virtual void OnMouseWheelForward( );
-      virtual void OnMouseWheelBackward( );
-
-      // Possible mouse click-related events
-      virtual void OnLeftClick( );
-      virtual void OnLeftDoubleClick( );
-      virtual void OnMiddleClick( );
-      virtual void OnMiddleDoubleClick( );
-      virtual void OnRightClick( );
-      virtual void OnRightDoubleClick( );
-
-      // Keyboard-related events
-      virtual void OnChar( );
-
-      // Other events
-      virtual void OnExpose( );
-      virtual void OnConfigure( );
-      virtual void OnEnter( );
-      virtual void OnLeave( );
 
     protected:
       ImageInteractorStyle( );
       virtual ~ImageInteractorStyle( );
 
-      bool _PickPosition( double pos[ 3 ] );
-      void _RenderAssociatedInteractors( );
+      virtual bool _PickPosition( double pos[ 3 ] );
 
     private:
       // Purposely not implemented
@@ -101,145 +42,9 @@ namespace cpExtensions
       Self& operator=( const Self& );
 
     protected:
-      vtkSmartPointer< vtkPropPicker > PropPicker;
-
-      std::vector< vtkSmartPointer< vtkRenderWindowInteractor > >
-      AssociatedInteractors;
-
-      // Commands
-      void* Data;
-      TMouseCommand      MouseMoveCommand;
-      TMouseCommand      MouseClickCommand;
-      TMouseCommand      MouseDoubleClickCommand;
-      TMouseWheelCommand MouseWheelCommand;
-      TKeyCommand        KeyCommand;
+      vtkSmartPointer< vtkPropPicker > m_PropPicker;
     };
 
-    /*
-      class ImageSliceActors;
-      class MPRActors;
-    */
-
-    /**
-     */
-    /*
-      class cpExtensions_EXPORT ImageInteractorStyle
-      : public vtkInteractorStyleImage
-      {
-      public:
-      typedef ImageInteractorStyle Self;
-
-      enum InteractionMode
-      {
-      NavigationMode = 0,
-      DeformationMode
-      };
-
-      public:
-      vtkTypeMacro( ImageInteractorStyle, vtkInteractorStyleImage );
-
-      cpPlugins_ImageInteractorStyle_ObserverMacro( DoubleClick );
-      cpPlugins_ImageInteractorStyle_ObserverMacro( Cursor );
-      cpPlugins_ImageInteractorStyle_ObserverMacro( Radius );
-
-      public:
-      static Self* New( );
-
-      void Configure(
-      ImageSliceActors* slice_actors,
-      MPRActors* mpr_actors = NULL
-      );
-      void AssociateInteractor( vtkRenderWindowInteractor* interactor );
-
-      void SetModeToNavigation( );
-      void SetModeToDeformation( );
-      virtual void SetInteractor(
-      vtkRenderWindowInteractor* interactor, const int& axis
-      );
-
-      // Description:
-      // Event bindings controlling the effects of pressing mouse buttons
-      // or moving the mouse.
-      virtual void OnMouseMove( );
-      virtual void OnLeftButtonDown( );
-      virtual void OnLeftButtonUp( );
-      virtual void OnMiddleButtonDown( );
-      virtual void OnMiddleButtonUp( );
-      virtual void OnRightButtonDown( );
-      virtual void OnRightButtonUp( );
-      virtual void OnMouseWheelForward( );
-      virtual void OnMouseWheelBackward( );
-
-      // Description:
-      // Override the "fly-to" (f keypress) for images.
-      virtual void OnChar( );
-
-      // These methods for the different interactions in different modes
-      // are overridden in subclasses to perform the correct motion. Since
-      // they might be called from OnTimer, they do not have mouse coord
-      // parameters (use interactor's GetEventPosition and
-      // GetLastEventPosition)
-
-      virtual void Rotate( ) { }
-      virtual void Spin( )   { }
-      virtual void Zoom( )   { }
-      virtual void Pick( )   { }
-      virtual void Slice( )  { }
-      virtual void WindowLevel( );
-
-      // Interaction mode entry points used internally.
-      virtual void StartPick( )  { }
-      virtual void EndPick( )    { }
-      virtual void StartSlice( ) { }
-      virtual void EndSlice( )   { }
-      virtual void StartWindowLevel( );
-      virtual void EndWindowLevel( );
-
-      // New events
-      virtual void StartCursorMoving( );
-      virtual void EndCursorMoving( );
-      virtual void StartRadiusMoving( );
-      virtual void EndRadiusMoving( );
-
-      protected:
-      ImageInteractorStyle( );
-      virtual ~ImageInteractorStyle( );
-
-      void _RenderAssociateInteractors( );
-      void _UpdateCursor( );
-      void _UpdateRadius( );
-
-      private:
-      // Purposely not implemented
-      ImageInteractorStyle( const Self& );
-      Self& operator=( const Self& );
-
-      protected:
-      Self::InteractionMode Mode;
-
-      ImageSliceActors* m_SliceActors;
-      MPRActors*        m_MPRActors;
-
-      vtkSmartPointer< vtkOrientationMarkerWidget > OrientationWidget;
-
-      std::vector< vtkRenderWindowInteractor* > AssociatedInteractors;
-
-      bool CursorMoving;
-      double Cursor[ 3 ];
-
-      bool RadiusMoving;
-      double Radius[ 3 ];
-      vtkSmartPointer< vtkPolyData > Circle;
-      vtkSmartPointer< vtkPolyDataMapper > CircleMapper;
-      vtkSmartPointer< vtkActor > CircleActor;
-
-      public:
-      static const int CursorEvent;
-      static const int RadiusEvent;
-      static const int DoubleClickEvent;
-      };
-    */
-
   } // ecapseman
 
 } // ecapseman
index 5ecb83fa934876563ebf33a2b476c05b63dc9ffd..676f297427dad8219cf368b31d4ce1ada91c795e 100644 (file)
@@ -27,23 +27,38 @@ New( )
   return( new Self( ) );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+AddCursorCommand( TCursorCommand command, void* data )
+{
+  this->m_CursorCommands.push_back(
+    std::pair< TCursorCommand, void* >( command, data )
+    );
+  this->Modified( );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 AddInputConnection( vtkAlgorithmOutput* aout, int axis )
 {
+  // Get input vtkImageData
+  if( aout == NULL )
+    return;
+  vtkAlgorithm* producer = aout->GetProducer( );
   vtkImageData* data = dynamic_cast< vtkImageData* >(
-    aout->GetProducer( )->GetOutputDataObject( aout->GetIndex( ) )
+    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* >( aout->GetProducer( ) );
+    dynamic_cast< vtkImageMapToColors* >( producer );
   if( new_map == NULL )
   {
-    // Configure LUT
+    // Configure LUT, if possible (NULL is returned if not)
     this->_ConfigureNewLUT( data );
-    new_map = *( this->ImageMaps.rbegin( ) );
+    new_map = *( this->m_ImageMaps.rbegin( ) );
     if( new_map != NULL )
     {
       new_map->SetInputConnection( aout );
@@ -52,7 +67,7 @@ AddInputConnection( vtkAlgorithmOutput* aout, int axis )
     } // fi
   }
   else
-    this->ImageMaps.push_back( new_map );
+    this->m_ImageMaps.push_back( new_map );
   
   // Create mapper and actors
   vtkSmartPointer< vtkImageSliceMapper > mapper =
@@ -61,7 +76,7 @@ AddInputConnection( vtkAlgorithmOutput* aout, int axis )
     mapper->SetInputConnection( new_map->GetOutputPort( ) );
   else
     mapper->SetInputConnection( aout );
-  this->SliceMappers.push_back( mapper );
+  this->m_SliceMappers.push_back( mapper );
   this->_ConfigureNewInput( axis );
 }
 
@@ -69,9 +84,9 @@ AddInputConnection( vtkAlgorithmOutput* aout, int axis )
 void cpExtensions::Visualization::ImageSliceActors::
 AddInputData( vtkImageData* data, int axis )
 {
-  // Configure LUT
+  // Configure LUT, if possible (NULL is returned if not)
   this->_ConfigureNewLUT( data );
-  vtkImageMapToColors* new_map = *( this->ImageMaps.rbegin( ) );
+  vtkImageMapToColors* new_map = *( this->m_ImageMaps.rbegin( ) );
   if( new_map != NULL )
   {
     new_map->SetInputData( data );
@@ -86,7 +101,7 @@ AddInputData( vtkImageData* data, int axis )
     mapper->SetInputConnection( new_map->GetOutputPort( ) );
   else
     mapper->SetInputData( data );
-  this->SliceMappers.push_back( mapper );
+  this->m_SliceMappers.push_back( mapper );
   this->_ConfigureNewInput( axis );
 }
 
@@ -98,22 +113,22 @@ Clear( )
   this->RemoveAllItems( );
 
   // Delete all images
-  this->ImageMaps.clear( );
-  this->SliceMappers.clear( );
-  this->ImageActors.clear( );
-  this->AssociatedSlices.clear( );
-  this->AssociatedActors.clear( );
+  this->m_ImageMaps.clear( );
+  this->m_SliceMappers.clear( );
+  this->m_ImageActors.clear( );
+  this->m_AssociatedSlices.clear( );
+  this->m_AssociatedActors.clear( );
 
   // Reconfigure unique objects
-  this->Cursor        = vtkSmartPointer< vtkPolyData >::New( );
-  this->CursorMapper  = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->CursorActor   = vtkSmartPointer< vtkActor >::New( );
-  this->PlaneFunction = vtkSmartPointer< vtkPlane >::New( );
-  this->Plane         = vtkSmartPointer< vtkPolyData >::New( );
-  this->PlaneMapper   = vtkSmartPointer< vtkPolyDataMapper >::New( );
-  this->TextActor     = vtkSmartPointer< vtkTextActor >::New( );
-  this->PlaneActor    = vtkSmartPointer< vtkActor >::New( );
-  this->TextBuffer[ 0 ] = '\0';
+  this->m_Cursor        = vtkSmartPointer< vtkPolyData >::New( );
+  this->m_CursorMapper  = vtkSmartPointer< vtkPolyDataMapper >::New( );
+  this->m_CursorActor   = vtkSmartPointer< vtkActor >::New( );
+  this->m_PlaneFunction = vtkSmartPointer< vtkPlane >::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';
 
   // Unique objects configuration
   vtkSmartPointer< vtkPoints > cursor_points =
@@ -140,10 +155,10 @@ Clear( )
   cursor_lines->InsertNextCell( 2 );
   cursor_lines->InsertCellPoint( 6 );
   cursor_lines->InsertCellPoint( 7 );
-  this->Cursor->SetPoints( cursor_points );
-  this->Cursor->SetLines( cursor_lines );
-  this->CursorMapper->SetInputData( this->Cursor );
-  this->CursorActor->SetMapper( this->CursorMapper );
+  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 );
 
   vtkSmartPointer< vtkPoints > plane_points =
     vtkSmartPointer< vtkPoints >::New( );
@@ -160,14 +175,14 @@ Clear( )
   plane_lines->InsertCellPoint( 2 );
   plane_lines->InsertCellPoint( 3 );
   plane_lines->InsertCellPoint( 0 );
-  this->Plane->SetPoints( plane_points );
-  this->Plane->SetLines( plane_lines );
+  this->m_Plane->SetPoints( plane_points );
+  this->m_Plane->SetLines( plane_lines );
 
-  this->PlaneMapper->SetInputData( this->Plane );
-  this->PlaneActor->SetMapper( this->PlaneMapper );
+  this->m_PlaneMapper->SetInputData( this->m_Plane );
+  this->m_PlaneActor->SetMapper( this->m_PlaneMapper );
 
-  this->TextActor->SetTextScaleModeToNone( );
-  vtkTextProperty* textprop = this->TextActor->GetTextProperty( );
+  this->m_TextActor->SetTextScaleModeToNone( );
+  vtkTextProperty* textprop = this->m_TextActor->GetTextProperty( );
   textprop->SetColor( 1, 1, 1 );
   textprop->SetFontFamilyToCourier( );
   textprop->SetFontSize( 18 );
@@ -176,16 +191,21 @@ Clear( )
   textprop->ShadowOff( );
   textprop->SetJustificationToLeft( );
   textprop->SetVerticalJustificationToBottom( );
-  vtkCoordinate* coord = this->TextActor->GetPositionCoordinate( );
+  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_TextActor );
+  this->AddItem( this->m_PlaneActor );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 AssociateSlice( Self* other )
 {
-  this->AssociatedSlices.push_back( other );
+  this->m_AssociatedSlices.push_back( other );
   this->Modified( );
 }
 
@@ -202,14 +222,14 @@ SetSlicesCommand( TCursorCommand cmd, void* data )
 vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors::
 GetStyle( )
 {
-  return( this->Style.GetPointer( ) );
+  return( this->m_Style.GetPointer( ) );
 }
 
 // -------------------------------------------------------------------------
 const vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors::
 GetStyle( ) const
 {
-  return( this->Style.GetPointer( ) );
+  return( this->m_Style.GetPointer( ) );
 }
 
 // -------------------------------------------------------------------------
@@ -225,26 +245,28 @@ PushActorsInto( vtkRenderWindow* window, bool force_style )
   
   // Update style
   if( force_style )
-    if( rwi->GetInteractorStyle( ) != this->Style.GetPointer( ) )
-      rwi->SetInteractorStyle( this->Style );
+  {
+    this->_ConfigureStyle( );
+    rwi->SetInteractorStyle( this->m_Style );
+
+  } // fi
 
   // Update actors
-  unsigned int N = this->GetNumberOfImageActors( );
-  for( unsigned int n = 0; n < N; ++n )
-    renderer->AddActor( this->GetImageActor( n ) );
-  renderer->AddActor( this->CursorActor );
-  renderer->AddActor( this->PlaneActor );
-  renderer->AddActor( this->TextActor );
-  renderer->Modified( );
+# error USE vtkActorCollection interface
+  /* TODO
+     for( unsigned int n = 0; n < this->GetNumberOfImageActors( ); ++n )
+     renderer->AddActor( this->GetImageActor( n ) );
+     renderer->AddActor( this->m_CursorActor );
+     renderer->AddActor( this->m_PlaneActor );
+     renderer->AddActor( this->m_TextActor );
+     renderer->Modified( );
+  */
 
   // Configure camera
   vtkCamera* camera = renderer->GetActiveCamera( );
-  if( camera == NULL )
-    return;
-
-  // Parallel projections are better when displaying 2D images
-  if( force_style )
+  if( camera != NULL && force_style )
   {
+    // Parallel projections are better when displaying 2D images
     int axis = this->GetAxis( );
     camera->ParallelProjectionOn( );
     camera->SetFocalPoint( double( 0 ), double( 0 ), double( 0 ) );
@@ -280,30 +302,34 @@ PopActorsFrom( vtkRenderWindow* window )
   if( renderer != NULL )
   {
     // Update actors
-    unsigned int N = this->GetNumberOfImageActors( );
-    for( unsigned int n = 0; n < N; ++n )
-      renderer->RemoveActor( this->GetImageActor( n ) );
-    renderer->RemoveActor( this->CursorActor );
-    renderer->RemoveActor( this->PlaneActor );
-    renderer->RemoveActor( this->TextActor );
-    renderer->Modified( );
+# error USE vtkActorCollection interface
+    /* TODO
+       for( unsigned int n = 0; n < this->GetNumberOfImageActors( ); ++n )
+       renderer->RemoveActor( this->GetImageActor( n ) );
+       renderer->RemoveActor( this->m_CursorActor );
+       renderer->RemoveActor( this->m_PlaneActor );
+       renderer->RemoveActor( this->m_TextActor );
+       renderer->Modified( );
+    */
 
   } // fi
+  if( rwi != NULL )
+    rwi->Render( );
 }
 
 // -------------------------------------------------------------------------
 unsigned int cpExtensions::Visualization::ImageSliceActors::
 GetNumberOfImageActors( ) const
 {
-  return( this->ImageActors.size( ) );
+  return( this->m_ImageActors.size( ) );
 }
 
 // -------------------------------------------------------------------------
 vtkImageActor* cpExtensions::Visualization::ImageSliceActors::
 GetImageActor( unsigned int id )
 {
-  if( id < this->ImageActors.size( ) )
-    return( this->ImageActors[ id ] );
+  if( id < this->m_ImageActors.size( ) )
+    return( this->m_ImageActors[ id ] );
   else
     return( NULL );
 }
@@ -312,8 +338,8 @@ GetImageActor( unsigned int id )
 const vtkImageActor* cpExtensions::Visualization::ImageSliceActors::
 GetImageActor( unsigned int id ) const
 {
-  if( id < this->ImageActors.size( ) )
-    return( this->ImageActors[ id ] );
+  if( id < this->m_ImageActors.size( ) )
+    return( this->m_ImageActors[ id ] );
   else
     return( NULL );
 }
@@ -322,49 +348,49 @@ GetImageActor( unsigned int id ) const
 vtkTextActor* cpExtensions::Visualization::ImageSliceActors::
 GetTextActor( )
 {
-  return( this->TextActor );
+  return( this->m_TextActor );
 }
 
 // -------------------------------------------------------------------------
 const vtkTextActor* cpExtensions::Visualization::ImageSliceActors::
 GetTextActor( ) const
 {
-  return( this->TextActor );
+  return( this->m_TextActor );
 }
 
 // -------------------------------------------------------------------------
 vtkActor* cpExtensions::Visualization::ImageSliceActors::
 GetPlaneActor( )
 {
-  return( this->PlaneActor );
+  return( this->m_PlaneActor );
 }
 
 // -------------------------------------------------------------------------
 const vtkActor* cpExtensions::Visualization::ImageSliceActors::
 GetPlaneActor( ) const
 {
-  return( this->PlaneActor );
+  return( this->m_PlaneActor );
 }
 
 // -------------------------------------------------------------------------
 vtkPlane* cpExtensions::Visualization::ImageSliceActors::
 GetPlaneFunction( )
 {
-  return( this->PlaneFunction );
+  return( this->m_PlaneFunction );
 }
 
 // -------------------------------------------------------------------------
 const vtkPlane* cpExtensions::Visualization::ImageSliceActors::
 GetPlaneFunction( ) const
 {
-  return( this->PlaneFunction );
+  return( this->m_PlaneFunction );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 AddActor( vtkAlgorithm* algorithm, vtkActor* actor )
 {
-  this->AssociatedActors.push_back( TAssociatedActor( algorithm, actor ) );
+  this->m_AssociatedActors.push_back( TAssociatedActor( algorithm, actor ) );
   this->AddItem( actor );
 }
 
@@ -381,8 +407,8 @@ SetInterpolate( bool v )
 {
   if( this->Interpolate != v )
   {
-    for( unsigned int i = 0; i < this->ImageActors.size( ); ++i )
-      this->ImageActors[ i ]->SetInterpolate( v );
+    for( unsigned int i = 0; i < this->m_ImageActors.size( ); ++i )
+      this->m_ImageActors[ i ]->SetInterpolate( v );
     this->Interpolate = v;
     this->Modified( );
 
@@ -407,8 +433,8 @@ InterpolateOff( )
 double* cpExtensions::Visualization::ImageSliceActors::
 GetDisplayBounds( ) const
 {
-  if( this->ImageActors.size( ) > 0 )
-    return( this->ImageActors[ 0 ]->GetDisplayBounds( ) );
+  if( this->m_ImageActors.size( ) > 0 )
+    return( this->m_ImageActors[ 0 ]->GetDisplayBounds( ) );
   else
     return( NULL );
 }
@@ -417,20 +443,20 @@ GetDisplayBounds( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 GetDisplayBounds( double bounds[ 6 ] ) const
 {
-  if( this->ImageActors.size( ) == 0 )
+  if( this->m_ImageActors.size( ) == 0 )
   {
     bounds[ 0 ] = bounds[ 2 ] = bounds[ 4 ] = double( -1 );
     bounds[ 1 ] = bounds[ 3 ] = bounds[ 5 ] = double( -1 );
   }
   else
-    this->ImageActors[ 0 ]->GetDisplayBounds( bounds );
+    this->m_ImageActors[ 0 ]->GetDisplayBounds( bounds );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 ResetCursor( )
 {
-  vtkPoints* points = this->Cursor->GetPoints( );
+  vtkPoints* points = this->m_Cursor->GetPoints( );
   points->SetPoint( 0, 0, 0, 0 );
   points->SetPoint( 1, 0, 0, 0 );
   points->SetPoint( 2, 0, 0, 0 );
@@ -439,16 +465,16 @@ ResetCursor( )
   points->SetPoint( 5, 0, 0, 0 );
   points->SetPoint( 6, 0, 0, 0 );
   points->SetPoint( 7, 0, 0, 0 );
-  this->Cursor->Modified( );
-  this->CursorMapper->Modified( );
-  this->CursorActor->Modified( );
+  this->m_Cursor->Modified( );
+  this->m_CursorMapper->Modified( );
+  this->m_CursorActor->Modified( );
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 SetCursor( double pos[ 3 ] )
 {
-  if( this->SliceMappers.size( ) == 0 )
+  if( this->m_SliceMappers.size( ) == 0 )
     return;
 
   // Get ordered axes
@@ -460,7 +486,7 @@ SetCursor( double pos[ 3 ] )
   int ma2 = a2 << 1;
 
   double bounds[ 6 ];
-  this->SliceMappers[ 0 ]->GetInput( )->GetBounds( bounds );
+  this->m_SliceMappers[ 0 ]->GetInput( )->GetBounds( bounds );
 
   double
     p0[ 3 ], p1[ 3 ], p2[ 3 ], p3[ 3 ],
@@ -475,7 +501,7 @@ SetCursor( double pos[ 3 ] )
   p2[ a2 ] = p6[ a2 ] = bounds[ ma2 ];
   p3[ a2 ] = p7[ a2 ] = bounds[ ma2 + 1 ];
 
-  vtkPoints* points = this->Cursor->GetPoints( );
+  vtkPoints* points = this->m_Cursor->GetPoints( );
   points->SetPoint( 0, p0 );
   points->SetPoint( 1, p1 );
   points->SetPoint( 2, p2 );
@@ -484,17 +510,17 @@ SetCursor( double pos[ 3 ] )
   points->SetPoint( 5, p5 );
   points->SetPoint( 6, p6 );
   points->SetPoint( 7, p7 );
-  this->Cursor->Modified( );
-  this->CursorMapper->Modified( );
-  this->CursorActor->Modified( );
+  this->m_Cursor->Modified( );
+  this->m_CursorMapper->Modified( );
+  this->m_CursorActor->Modified( );
 }
 
 // -------------------------------------------------------------------------
 vtkImageMapToColors* cpExtensions::Visualization::ImageSliceActors::
 GetImageMap( unsigned int id )
 {
-  if( id < this->ImageMaps.size( ) )
-    return( this->ImageMaps[ id ].GetPointer( ) );
+  if( id < this->m_ImageMaps.size( ) )
+    return( this->m_ImageMaps[ id ].GetPointer( ) );
   else
     return( NULL );
 }
@@ -503,8 +529,8 @@ GetImageMap( unsigned int id )
 const vtkImageMapToColors* cpExtensions::Visualization::ImageSliceActors::
 GetImageMap( unsigned int id ) const
 {
-  if( id < this->ImageMaps.size( ) )
-    return( this->ImageMaps[ id ].GetPointer( ) );
+  if( id < this->m_ImageMaps.size( ) )
+    return( this->m_ImageMaps[ id ].GetPointer( ) );
   else
     return( NULL );
 }
@@ -513,13 +539,13 @@ GetImageMap( unsigned int id ) const
 double cpExtensions::Visualization::ImageSliceActors::
 GetWindow( ) const
 {
-  if( this->ImageMaps.size( ) > 0 )
+  if( this->m_ImageMaps.size( ) > 0 )
   {
-    if( this->ImageMaps[ 0 ].GetPointer( ) != NULL )
+    if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL )
     {
       vtkWindowLevelLookupTable* lut =
         dynamic_cast< vtkWindowLevelLookupTable* >(
-          this->ImageMaps[ 0 ]->GetLookupTable( )
+          this->m_ImageMaps[ 0 ]->GetLookupTable( )
           );
       if( lut != NULL )
         return( lut->GetWindow( ) );
@@ -537,13 +563,13 @@ GetWindow( ) const
 double cpExtensions::Visualization::ImageSliceActors::
 GetLevel( ) const
 {
-  if( this->ImageMaps.size( ) > 0 )
+  if( this->m_ImageMaps.size( ) > 0 )
   {
-    if( this->ImageMaps[ 0 ].GetPointer( ) != NULL )
+    if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL )
     {
       vtkWindowLevelLookupTable* lut =
         dynamic_cast< vtkWindowLevelLookupTable* >(
-          this->ImageMaps[ 0 ]->GetLookupTable( )
+          this->m_ImageMaps[ 0 ]->GetLookupTable( )
           );
       if( lut != NULL )
         return( lut->GetLevel( ) );
@@ -561,13 +587,13 @@ GetLevel( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 SetWindow( double w )
 {
-  if( this->ImageMaps.size( ) > 0 )
+  if( this->m_ImageMaps.size( ) > 0 )
   {
-    if( this->ImageMaps[ 0 ].GetPointer( ) != NULL )
+    if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL )
     {
       vtkWindowLevelLookupTable* lut =
         dynamic_cast< vtkWindowLevelLookupTable* >(
-          this->ImageMaps[ 0 ]->GetLookupTable( )
+          this->m_ImageMaps[ 0 ]->GetLookupTable( )
           );
       if( lut != NULL )
       {
@@ -579,7 +605,7 @@ SetWindow( double w )
         */
         lut->SetWindow( w );
         lut->Build( );
-        this->ImageMaps[ 0 ]->Modified( );
+        this->m_ImageMaps[ 0 ]->Modified( );
         this->Modified( );
 
       } // fi
@@ -593,13 +619,13 @@ SetWindow( double w )
 void cpExtensions::Visualization::ImageSliceActors::
 SetLevel( double l )
 {
-  if( this->ImageMaps.size( ) > 0 )
+  if( this->m_ImageMaps.size( ) > 0 )
   {
-    if( this->ImageMaps[ 0 ].GetPointer( ) != NULL )
+    if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL )
     {
       vtkWindowLevelLookupTable* lut =
         dynamic_cast< vtkWindowLevelLookupTable* >(
-          this->ImageMaps[ 0 ]->GetLookupTable( )
+          this->m_ImageMaps[ 0 ]->GetLookupTable( )
           );
       if( lut != NULL )
       {
@@ -611,7 +637,7 @@ SetLevel( double l )
         */
         lut->SetLevel( l );
         lut->Build( );
-        this->ImageMaps[ 0 ]->Modified( );
+        this->m_ImageMaps[ 0 ]->Modified( );
         this->Modified( );
 
       } // fi
@@ -625,13 +651,13 @@ SetLevel( double l )
 void cpExtensions::Visualization::ImageSliceActors::
 SetWindowLevel( double w, double l )
 {
-  if( this->ImageMaps.size( ) > 0 )
+  if( this->m_ImageMaps.size( ) > 0 )
   {
-    if( this->ImageMaps[ 0 ].GetPointer( ) != NULL )
+    if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL )
     {
       vtkWindowLevelLookupTable* lut =
         dynamic_cast< vtkWindowLevelLookupTable* >(
-          this->ImageMaps[ 0 ]->GetLookupTable( )
+          this->m_ImageMaps[ 0 ]->GetLookupTable( )
           );
       if( lut != NULL )
       {
@@ -652,7 +678,7 @@ SetWindowLevel( double w, double l )
         lut->SetWindow( w );
         lut->SetLevel( l );
         lut->Build( );
-        this->ImageMaps[ 0 ]->Modified( );
+        this->m_ImageMaps[ 0 ]->Modified( );
         this->Modified( );
 
       } // fi
@@ -676,12 +702,12 @@ ResetWindowLevel( )
 void cpExtensions::Visualization::ImageSliceActors::
 SetLookupTable( unsigned int id, vtkLookupTable* lut )
 {
-  if( id < this->ImageMaps.size( ) && id > 0 )
+  if( id < this->m_ImageMaps.size( ) && id > 0 )
   {
-    if( this->ImageMaps[ id ].GetPointer( ) != NULL )
+    if( this->m_ImageMaps[ id ].GetPointer( ) != NULL )
     {
-      this->ImageMaps[ id ]->SetLookupTable( lut );
-      this->ImageMaps[ id ]->Modified( );
+      this->m_ImageMaps[ id ]->SetLookupTable( lut );
+      this->m_ImageMaps[ id ]->Modified( );
       this->Modified( );
 
     } // fi
@@ -700,11 +726,11 @@ SetLookupTableAsColor( unsigned int id, double r, double g, double b )
   static const double _OPACITY = double( 0.6 );
 
   // Check ID consistency
-  if( id == 0 || id >= this->ImageMaps.size( ) )
+  if( id == 0 || id >= this->m_ImageMaps.size( ) )
     return;
 
   // Get image scalar range
-  vtkAlgorithmOutput* aout = this->ImageMaps[ id ]->GetOutputPort( );
+  vtkAlgorithmOutput* aout = this->m_ImageMaps[ id ]->GetOutputPort( );
   vtkImageData* image = dynamic_cast< vtkImageData* >(
     aout->GetProducer( )->GetOutputDataObject( aout->GetIndex( ) )
     );
@@ -749,8 +775,8 @@ SetLookupTableAsColor( unsigned int id, double r, double g, double b )
 int cpExtensions::Visualization::ImageSliceActors::
 GetAxis( ) const
 {
-  if( this->SliceMappers.size( ) > 0 )
-    return( this->SliceMappers[ 0 ]->GetOrientation( ) );
+  if( this->m_SliceMappers.size( ) > 0 )
+    return( this->m_SliceMappers[ 0 ]->GetOrientation( ) );
   else
     return( -1 );
 }
@@ -759,8 +785,8 @@ GetAxis( ) const
 int cpExtensions::Visualization::ImageSliceActors::
 GetSliceNumber( ) const
 {
-  if( this->SliceMappers.size( ) > 0 )
-    return( this->SliceMappers[ 0 ]->GetSliceNumber( ) );
+  if( this->m_SliceMappers.size( ) > 0 )
+    return( this->m_SliceMappers[ 0 ]->GetSliceNumber( ) );
   else
     return( -1 );
 }
@@ -769,8 +795,8 @@ GetSliceNumber( ) const
 int cpExtensions::Visualization::ImageSliceActors::
 GetSliceNumberMinValue( ) const
 {
-  if( this->SliceMappers.size( ) > 0 )
-    return( this->SliceMappers[ 0 ]->GetSliceNumberMinValue( ) );
+  if( this->m_SliceMappers.size( ) > 0 )
+    return( this->m_SliceMappers[ 0 ]->GetSliceNumberMinValue( ) );
   else
     return( -1 );
 }
@@ -779,8 +805,8 @@ GetSliceNumberMinValue( ) const
 int cpExtensions::Visualization::ImageSliceActors::
 GetSliceNumberMaxValue( ) const
 {
-  if( this->SliceMappers.size( ) > 0 )
-    return( this->SliceMappers[ 0 ]->GetSliceNumberMaxValue( ) );
+  if( this->m_SliceMappers.size( ) > 0 )
+    return( this->m_SliceMappers[ 0 ]->GetSliceNumberMaxValue( ) );
   else
     return( -1 );
 }
@@ -789,29 +815,29 @@ GetSliceNumberMaxValue( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 SetSliceNumber( const int& slice )
 {
-  unsigned int nImages = this->SliceMappers.size( );
+  unsigned int nImages = this->m_SliceMappers.size( );
   if( nImages == 0 )
     return;
 
   // Change visualization extent
   for( unsigned int i = 0; i < nImages; ++i )
   {
-    this->SliceMappers[ i ]->SetSliceNumber( slice );
-    this->SliceMappers[ i ]->Modified( );
-    this->ImageActors[ i ]->Modified( );
-    this->SliceMappers[ i ]->Update( );
+    this->m_SliceMappers[ i ]->SetSliceNumber( slice );
+    this->m_SliceMappers[ i ]->Modified( );
+    this->m_ImageActors[ i ]->Modified( );
+    this->m_SliceMappers[ i ]->Update( );
 
   } // rof
 
   // Compute plane
-  vtkAlgorithm* algo = this->SliceMappers[ 0 ]->GetInputAlgorithm( );
+  vtkAlgorithm* algo = this->m_SliceMappers[ 0 ]->GetInputAlgorithm( );
   vtkInformation* info = algo->GetOutputInformation( 0 );
   int ext[ 6 ];
   double ori[ 3 ], spac[ 3 ], pos[ 3 ];
   info->Get( vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT( ), ext );
   info->Get( vtkDataObject::ORIGIN( ), ori );
   info->Get( vtkDataObject::SPACING( ), spac );
-  this->SliceMappers[ 0 ]->GetSlicePlane( )->GetOrigin( pos );
+  this->m_SliceMappers[ 0 ]->GetSlicePlane( )->GetOrigin( pos );
 
   // Prevent obscuring voxels by offsetting the plane geometry
   double xbnds[ ] =
@@ -853,45 +879,45 @@ SetSliceNumber( const int& slice )
   } // fi
 
   // Plane function origin
-  this->PlaneFunction->SetOrigin( pos );
+  this->m_PlaneFunction->SetOrigin( pos );
 
   // Configure visualization and implicit plane orientation
-  int axis = this->SliceMappers[ 0 ]->GetOrientation( );
-  this->PlaneActor->GetProperty( )->SetRepresentationToWireframe( );
-  this->PlaneActor->GetProperty( )->SetLineWidth( 2 );
-  vtkPoints* plane_points = this->Plane->GetPoints( );
+  int axis = this->m_SliceMappers[ 0 ]->GetOrientation( );
+  this->m_PlaneActor->GetProperty( )->SetRepresentationToWireframe( );
+  this->m_PlaneActor->GetProperty( )->SetLineWidth( 2 );
+  vtkPoints* plane_points = this->m_Plane->GetPoints( );
   if( axis == 0 ) // YZ, x-normal
   {
-    this->PlaneFunction->SetNormal( 1, 0, 0 );
+    this->m_PlaneFunction->SetNormal( 1, 0, 0 );
     plane_points->SetPoint( 0, pos[ 0 ], ybnds[ 0 ], zbnds[ 0 ] );
     plane_points->SetPoint( 1, pos[ 0 ], ybnds[ 1 ], zbnds[ 0 ] );
     plane_points->SetPoint( 2, pos[ 0 ], ybnds[ 1 ], zbnds[ 1 ] );
     plane_points->SetPoint( 3, pos[ 0 ], ybnds[ 0 ], zbnds[ 1 ] );
-    this->PlaneActor->GetProperty( )->SetColor( 1, 0, 0 );
+    this->m_PlaneActor->GetProperty( )->SetColor( 1, 0, 0 );
   }
   else if( axis == 1 ) // ZX, y-normal
   {
-    this->PlaneFunction->SetNormal( 0, 1, 0 );
+    this->m_PlaneFunction->SetNormal( 0, 1, 0 );
     plane_points->SetPoint( 0, xbnds[ 0 ], pos[ 1 ], zbnds[ 0 ] );
     plane_points->SetPoint( 1, xbnds[ 0 ], pos[ 1 ], zbnds[ 1 ] );
     plane_points->SetPoint( 2, xbnds[ 1 ], pos[ 1 ], zbnds[ 1 ] );
     plane_points->SetPoint( 3, xbnds[ 1 ], pos[ 1 ], zbnds[ 0 ] );
-    this->PlaneActor->GetProperty( )->SetColor( 0, 1, 0 );
+    this->m_PlaneActor->GetProperty( )->SetColor( 0, 1, 0 );
   }
   else // XY, z-normal
   {
-    this->PlaneFunction->SetNormal( 0, 0, 1 );
+    this->m_PlaneFunction->SetNormal( 0, 0, 1 );
     plane_points->SetPoint( 0, xbnds[ 0 ], ybnds[ 0 ], pos[ 2 ] );
     plane_points->SetPoint( 1, xbnds[ 1 ], ybnds[ 0 ], pos[ 2 ] );
     plane_points->SetPoint( 2, xbnds[ 1 ], ybnds[ 1 ], pos[ 2 ] );
     plane_points->SetPoint( 3, xbnds[ 0 ], ybnds[ 1 ], pos[ 2 ] );
-    this->PlaneActor->GetProperty( )->SetColor( 0, 0, 1 );
+    this->m_PlaneActor->GetProperty( )->SetColor( 0, 0, 1 );
 
   } // fi
-  this->PlaneFunction->Modified( );
-  this->Plane->Modified( );
-  this->PlaneMapper->Modified( );
-  this->PlaneActor->Modified( );
+  this->m_PlaneFunction->Modified( );
+  this->m_Plane->Modified( );
+  this->m_PlaneMapper->Modified( );
+  this->m_PlaneActor->Modified( );
 
   // Prepare other actors to update
   /* TODO
@@ -921,9 +947,9 @@ SetSliceNumber( const int& slice )
   this->UpdateText( );
 
   // Associated slices
-  for( unsigned int i = 0; i < this->AssociatedSlices.size( ); ++i )
-    if( this->AssociatedSlices[ i ]->GetAxis( ) == this->GetAxis( ) )
-      this->AssociatedSlices[ i ]->SetSliceNumber( slice );
+  for( unsigned int i = 0; i < this->m_AssociatedSlices.size( ); ++i )
+    if( this->m_AssociatedSlices[ i ]->GetAxis( ) == this->GetAxis( ) )
+      this->m_AssociatedSlices[ i ]->SetSliceNumber( slice );
 }
 
 // -------------------------------------------------------------------------
@@ -931,11 +957,11 @@ void cpExtensions::Visualization::ImageSliceActors::
 SetSlice( double* pos )
 {
   vtkImageData* image;
-  if( this->ImageMaps[ 0 ] != NULL )
+  if( this->m_ImageMaps[ 0 ] != NULL )
     image =
-      dynamic_cast< vtkImageData* >( this->ImageMaps[ 0 ]->GetInput( ) );
+      dynamic_cast< vtkImageData* >( this->m_ImageMaps[ 0 ]->GetInput( ) );
   else
-    image = this->SliceMappers[ 0 ]->GetInput( );
+    image = this->m_SliceMappers[ 0 ]->GetInput( );
 
   int ijk[ 3 ];
   double pcoords[ 3 ];
@@ -947,23 +973,23 @@ SetSlice( double* pos )
 void cpExtensions::Visualization::ImageSliceActors::
 UpdateText( )
 {
-  if( this->SliceMappers.size( ) > 0 )
+  if( this->m_SliceMappers.size( ) > 0 )
   {
     char axis;
-    int axId = this->SliceMappers[ 0 ]->GetOrientation( );
+    int axId = this->m_SliceMappers[ 0 ]->GetOrientation( );
     if     ( axId == 0 ) axis = 'X';
     else if( axId == 1 ) axis = 'Y';
     else if( axId == 2 ) axis = 'Z';
 
     std::sprintf(
-      this->TextBuffer, "Axis: %c (%d)",
-      axis, this->SliceMappers[ 0 ]->GetSliceNumber( )
+      this->m_TextBuffer, "Axis: %c (%d)",
+      axis, this->m_SliceMappers[ 0 ]->GetSliceNumber( )
       );
   }
   else
-    this->TextBuffer[ 0 ] = '\0';
-  this->TextActor->SetInput( this->TextBuffer );
-  this->TextActor->Modified( );
+    this->m_TextBuffer[ 0 ] = '\0';
+  this->m_TextActor->SetInput( this->m_TextBuffer );
+  this->m_TextActor->Modified( );
   this->Modified( );
 }
 
@@ -972,21 +998,21 @@ void cpExtensions::Visualization::ImageSliceActors::
 UpdateText( double pos[ 3 ] )
 {
   /* TODO
-  if( this->SliceMappers.size( ) > 0 )
+  if( this->m_SliceMappers.size( ) > 0 )
   {
     char axis;
-    int axId = this->SliceMappers[ 0 ]->GetOrientation( );
+    int axId = this->m_SliceMappers[ 0 ]->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->ImageMaps[ 0 ] != NULL )
+    if( this->m_ImageMaps[ 0 ] != NULL )
       image =
-        dynamic_cast< vtkImageData* >( this->ImageMaps[ 0 ]->GetInput( ) );
+        dynamic_cast< vtkImageData* >( this->m_ImageMaps[ 0 ]->GetInput( ) );
     else
-      image = this->SliceMappers[ 0 ]->GetInput( );
+      image = this->m_SliceMappers[ 0 ]->GetInput( );
 
     int ijk[ 3 ];
     double pcoords[ 3 ];
@@ -1017,16 +1043,16 @@ UpdateText( double pos[ 3 ] )
             );
       str << ")";
       std::sprintf(
-        this->TextBuffer, "Axis: %c (%d)\nPixel %s",
+        this->m_TextBuffer, "Axis: %c (%d)\nPixel %s",
         axis, slice, str.str( ).c_str( )
         );
 
     } // fi
   }
   else
-    this->TextBuffer[ 0 ] = '\0';
-  this->TextActor->SetInput( this->TextBuffer );
-  this->TextActor->Modified( );
+    this->m_TextBuffer[ 0 ] = '\0';
+  this->m_TextActor->SetInput( this->m_TextBuffer );
+  this->m_TextActor->Modified( );
   this->Modified( );
   */
 }
@@ -1035,23 +1061,23 @@ UpdateText( double pos[ 3 ] )
 void cpExtensions::Visualization::ImageSliceActors::
 UpdateText( const double& w, const double& l )
 {
-  if( this->SliceMappers.size( ) > 0 )
+  if( this->m_SliceMappers.size( ) > 0 )
   {
     char axis;
-    int axId = this->SliceMappers[ 0 ]->GetOrientation( );
+    int axId = this->m_SliceMappers[ 0 ]->GetOrientation( );
     if     ( axId == 0 ) axis = 'X';
     else if( axId == 1 ) axis = 'Y';
     else if( axId == 2 ) axis = 'Z';
 
     std::sprintf(
-      this->TextBuffer, "Axis: %c (%d)\nW/L (%.2f/%.2f)",
-      axis, this->SliceMappers[ 0 ]->GetSliceNumber( ), w, l
+      this->m_TextBuffer, "Axis: %c (%d)\nW/L (%.2f/%.2f)",
+      axis, this->m_SliceMappers[ 0 ]->GetSliceNumber( ), w, l
       );
   }
   else
-    this->TextBuffer[ 0 ] = '\0';
-  this->TextActor->SetInput( this->TextBuffer );
-  this->TextActor->Modified( );
+    this->m_TextBuffer[ 0 ] = '\0';
+  this->m_TextActor->SetInput( this->m_TextBuffer );
+  this->m_TextActor->Modified( );
   this->Modified( );
 }
 
@@ -1064,15 +1090,6 @@ ImageSliceActors( )
   this->Clear( );
 
   this->SlicesCommand = NULL;
-
-  // Connect this view with a controller
-  this->Style = vtkSmartPointer< ImageInteractorStyle >::New( );
-  this->Style->AssociateView( this );
-  this->Style->SetMouseMoveCommand( Self::_MouseMoveCommand );
-  this->Style->SetMouseClickCommand( Self::_MouseClickCommand );
-  this->Style->SetMouseDoubleClickCommand( Self::_MouseDoubleClickCommand );
-  this->Style->SetMouseWheelCommand( Self::_MouseWheelCommand );
-  this->Style->SetKeyCommand( Self::_KeyCommand );
 }
 
 // -------------------------------------------------------------------------
@@ -1081,23 +1098,38 @@ cpExtensions::Visualization::ImageSliceActors::
 {
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_ConfigureStyle( )
+{
+  // Connect this view with a controller
+  this->m_Style = vtkSmartPointer< ImageInteractorStyle >::New( );
+  this->m_Style->AddMouseMoveCommand( Self::_MouseMoveCommand, this );
+  this->m_Style->AddMouseClickCommand( Self::_MouseClickCommand, this );
+  this->m_Style->AddMouseDoubleClickCommand(
+    Self::_MouseDoubleClickCommand, this
+    );
+  this->m_Style->AddMouseWheelCommand( Self::_MouseWheelCommand, this );
+  this->m_Style->AddKeyCommand( Self::_KeyCommand, this );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 _ConfigureNewLUT( vtkImageData* data )
 {
   // Does the new LUT is a window-level one?
-  unsigned int nImgs = this->ImageMaps.size( );
+  unsigned int nImgs = this->m_ImageMaps.size( );
   unsigned int nCmps = data->GetNumberOfScalarComponents( );
 
   if( nCmps > 1 )
   {
-    this->ImageMaps.push_back( NULL );
+    this->m_ImageMaps.push_back( NULL );
     return;
 
   } // fi
 
   // Create LUT filter
-  this->ImageMaps.push_back( vtkSmartPointer< vtkImageMapToColors >::New( ) );
+  this->m_ImageMaps.push_back( vtkSmartPointer< vtkImageMapToColors >::New( ) );
   if( nImgs == 0 )
   {
     double range[ 2 ];
@@ -1109,7 +1141,7 @@ _ConfigureNewLUT( vtkImageData* data )
     lut->SetWindow( range[ 1 ] - range[ 0 ] );
     lut->SetLevel( ( range[ 1 ] + range[ 0 ] ) / double( 2 ) );
     lut->Build( );
-    this->ImageMaps[ 0 ]->SetLookupTable( lut );
+    this->m_ImageMaps[ 0 ]->SetLookupTable( lut );
 
     this->MinWindow = double( 0 );
     this->MaxWindow = range[ 1 ] - range[ 0 ];
@@ -1124,32 +1156,26 @@ _ConfigureNewLUT( vtkImageData* data )
 void cpExtensions::Visualization::ImageSliceActors::
 _ConfigureNewInput( int axis )
 {
-  unsigned int nImages = this->ImageActors.size( );
+  unsigned int nImages = this->m_ImageActors.size( );
 
   // Configure mapper
-  vtkImageSliceMapper* mapper = this->SliceMappers[ nImages ];
+  vtkImageSliceMapper* mapper = this->m_SliceMappers[ nImages ];
   if( nImages == 0 )
     mapper->SetOrientation( axis );
   else
-    mapper->SetOrientation( this->SliceMappers[ 0 ]->GetOrientation( ) );
+    mapper->SetOrientation( this->m_SliceMappers[ 0 ]->GetOrientation( ) );
   mapper->Update( );
 
   // Create actor
   vtkSmartPointer< vtkImageActor > actor =
     vtkSmartPointer< vtkImageActor >::New( );
-  this->ImageActors.push_back( actor );
+  this->m_ImageActors.push_back( actor );
   actor->SetMapper( mapper );
   actor->SetInterpolate( this->Interpolate );
   actor->Modified( );
 
   if( nImages == 0 )
-  {
-    this->AddItem( this->CursorActor );
-    this->AddItem( this->PlaneActor );
-    this->AddItem( this->TextActor );
-    this->Style->AssociateImageActor( actor );
-
-  } // fi
+    this->m_Style->AssociateImageActor( actor );
   this->AddItem( actor );
 
   if( nImages > 1 )
@@ -1186,7 +1212,7 @@ _MouseMoveCommand(
     if( !alt && !ctr && sft )
     {
       double bounds[ 6 ];
-      actors->SliceMappers[ 0 ]->GetBounds( bounds );
+      actors->m_SliceMappers[ 0 ]->GetBounds( bounds );
 
       int a0 = actors->GetAxis( );
       int a1 = ( a0 + 1 ) % 3;
@@ -1246,11 +1272,11 @@ _MouseDoubleClickCommand(
     else if( !alt && ctr && !sft && actors->SlicesCommand != NULL )
     {
       actors->SlicesCommand( pos, actors->GetAxis( ), actors->SlicesData );
-      for( unsigned int i = 0; i < actors->CursorCommands.size( ); ++i )
-        actors->CursorCommands[ i ].first(
+      for( unsigned int i = 0; i < actors->m_CursorCommands.size( ); ++i )
+        actors->m_CursorCommands[ i ].first(
           pos,
           actors->GetAxis( ),
-          actors->CursorCommands[ i ].second
+          actors->m_CursorCommands[ i ].second
           );
 
     } // fi
index 6c97448f48c5c0cfcec9192ccc49642225da77f4..21eef1e3d5f30a701ee2b4568dcdc29c9e12297e 100644 (file)
@@ -38,9 +38,10 @@ namespace cpExtensions
       typedef ImageSliceActors Self;
 
       typedef void ( *TCursorCommand )( double*, int, void* );
-      typedef ImageInteractorStyle::TMouseCommand      TMouseCommand;
-      typedef ImageInteractorStyle::TMouseWheelCommand TMouseWheelCommand;
-      typedef ImageInteractorStyle::TKeyCommand        TKeyCommand;
+      typedef BaseInteractorStyle::TMouseCommand      TMouseCommand;
+      typedef BaseInteractorStyle::TMouseWheelCommand TMouseWheelCommand;
+      typedef BaseInteractorStyle::TKeyCommand        TKeyCommand;
+      typedef BaseInteractorStyle::TVoidCommand       TVoidCommand;
 
     public:
       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
@@ -54,14 +55,7 @@ namespace cpExtensions
       // Creation
       static ImageSliceActors* New( );
 
-      void AddCursorCommand( TCursorCommand command, void* data )
-      {
-        this->CursorCommands.push_back(
-          std::pair< TCursorCommand, void* >(
-            command, data
-            )
-          );
-      }
+      void AddCursorCommand( TCursorCommand command, void* data );
 
       void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
       void AddInputData( vtkImageData* data, int axis = 2 );
@@ -127,23 +121,24 @@ namespace cpExtensions
       ImageSliceActors( );
       virtual ~ImageSliceActors( );
 
+      void _ConfigureStyle( );
       void _ConfigureNewLUT( vtkImageData* data );
       void _ConfigureNewInput( int axis );
 
       // Events
       static void _MouseMoveCommand(
         void* data,
-        const ImageInteractorStyle::ButtonID& btn, double* pos,
+        const BaseInteractorStyle::ButtonID& btn, double* pos,
         bool alt, bool ctr, bool sft
         );
       static void _MouseClickCommand(
         void* data,
-        const ImageInteractorStyle::ButtonID& btn, double* pos,
+        const BaseInteractorStyle::ButtonID& btn, double* pos,
         bool alt, bool ctr, bool sft
         );
       static void _MouseDoubleClickCommand(
         void* data,
-        const ImageInteractorStyle::ButtonID& btn, double* pos,
+        const BaseInteractorStyle::ButtonID& btn, double* pos,
         bool alt, bool ctr, bool sft
         );
       static void _MouseWheelCommand(
@@ -161,49 +156,42 @@ namespace cpExtensions
       Self& operator=( const Self& );
 
     protected:
-      vtkSmartPointer< ImageInteractorStyle > Style;
+      vtkSmartPointer< ImageInteractorStyle > m_Style;
 
       // Multiple actors
-      std::vector< vtkSmartPointer< vtkImageMapToColors > > ImageMaps;
-      std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
-      std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
-      bool Interpolate;
+      std::vector< vtkSmartPointer< vtkImageMapToColors > > m_ImageMaps;
+      std::vector< vtkSmartPointer< vtkImageSliceMapper > > m_SliceMappers;
+      std::vector< vtkSmartPointer< vtkImageActor > >       m_ImageActors;
+      bool m_Interpolate;
 
       // Window-Level values
-      double MinWindow, MaxWindow;
-      double MinLevel, MaxLevel;
+      double m_MinWindow, m_MaxWindow;
+      double m_MinLevel, m_MaxLevel;
 
       // Other associated slices
-      std::vector< vtkSmartPointer< Self > > AssociatedSlices;
-      TCursorCommand SlicesCommand;
-      void* SlicesData;
+      std::vector< vtkSmartPointer< Self > > m_AssociatedSlices;
 
       // Associated commands
-      std::vector< std::pair< TCursorCommand, void* > > CursorCommands;
-      std::vector< TMouseCommand >      MouseCommands;
-      std::vector< TMouseCommand >      MouseClickCommands;
-      std::vector< TMouseCommand >      MouseDoubleClickCommands;
-      std::vector< TMouseWheelCommand > MouseWheelCommands;
-      std::vector< TKeyCommand >        KeyCommands;
+      std::vector< std::pair< TCursorCommand, void* > > m_CursorCommands;
 
       // Other associated actors
       typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
       typedef std::vector< TAssociatedActor >       TAssociatedActors;
-      TAssociatedActors AssociatedActors;
+      TAssociatedActors m_AssociatedActors;
 
       // Unique objects
-      vtkSmartPointer< vtkPolyData >       Cursor;
-      vtkSmartPointer< vtkPolyDataMapper > CursorMapper;
-      vtkSmartPointer< vtkActor >          CursorActor;
-      vtkSmartPointer< vtkPlane >          PlaneFunction;
-      vtkSmartPointer< vtkPolyData >       Plane;
-      vtkSmartPointer< vtkPolyDataMapper > PlaneMapper;
-      char                                 TextBuffer[ 1024 ];
-      vtkSmartPointer< vtkTextActor >      TextActor;
-      vtkSmartPointer< vtkActor >          PlaneActor;
-
-      double StartWindowLevelPos[ 3 ];
-      double StartWindowLevel[ 2 ];
+      vtkSmartPointer< vtkPolyData >       m_Cursor;
+      vtkSmartPointer< vtkPolyDataMapper > m_CursorMapper;
+      vtkSmartPointer< vtkActor >          m_CursorActor;
+      vtkSmartPointer< vtkPlane >          m_PlaneFunction;
+      vtkSmartPointer< vtkPolyData >       m_Plane;
+      vtkSmartPointer< vtkPolyDataMapper > m_PlaneMapper;
+      char                                 m_TextBuffer[ 1024 ];
+      vtkSmartPointer< vtkTextActor >      m_TextActor;
+      vtkSmartPointer< vtkActor >          m_PlaneActor;
+
+      double m_StartWindowLevelPos[ 3 ];
+      double m_StartWindowLevel[ 2 ];
     };
 
   } // ecapseman