]> Creatis software - cpPlugins.git/commitdiff
Widget integration (step 5/6): generic widget controller finished and tested on linux...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 8 Oct 2015 00:50:23 +0000 (19:50 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 8 Oct 2015 00:50:23 +0000 (19:50 -0500)
45 files changed:
appli/examples/CMakeLists.txt
appli/examples/example_BaseInteractorStyle.cxx
appli/examples/example_View2DImage.cxx [new file with mode: 0644]
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
lib/cpExtensions/Visualization/MPRObjects.cxx
lib/cpExtensions/Visualization/MPRObjects.h
lib/cpPlugins/Interface/BaseProcessObjects.h
lib/cpPlugins/Interface/DataObject.cxx
lib/cpPlugins/Interface/DataObject.h
lib/cpPlugins/Interface/Image.cxx
lib/cpPlugins/Interface/Image.h
lib/cpPlugins/Interface/Mesh.cxx
lib/cpPlugins/Interface/Mesh.h
lib/cpPlugins/Interface/Object.h
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx
lib/cpPlugins/Plugins/BasicFilters/Cutter.h
lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h
lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx
lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.h
lib/cpPlugins/Plugins/IO/ImageReader.cxx
lib/cpPlugins/Plugins/IO/ImageReader.h
lib/cpPlugins/Plugins/IO/ImageWriter.cxx
lib/cpPlugins/Plugins/IO/ImageWriter.h
lib/cpPlugins/Plugins/IO/MeshReader.cxx
lib/cpPlugins/Plugins/IO/MeshReader.h
lib/cpPlugins/Plugins/IO/MeshWriter.cxx
lib/cpPlugins/Plugins/IO/MeshWriter.h

index 794346030772213185f36ca56d19bfa0b3c8620f..afbe04113da493603eea136ba984915891356b58 100644 (file)
@@ -8,6 +8,7 @@ SET(
   example_TestParameters
   example_LoadPlugins
   example_ReadWriteImage
+  example_View2DImage
   ##example_MarchingCubes
   ##example_OtsuFilter
   ##example_RGBImageToHSVChannels
@@ -35,7 +36,7 @@ SET(
   NOPLUGINS_EXAMPLES_PROGRAMS
   example_BaseInteractorStyle
   example_ContourWidget
-  example_Test_DoubleClick
+  ## example_Test_DoubleClick
   ## example_ExtractDICOMSeries
   ## example_ImageGaussianModelEstimator
   ## example_ReadQuadEdgeMeshWithoutPlugins
index 8ec545a7027aa1f3819d0b53d5554a2a90be7d29..922511abed03b96da51e24dc9006ebd61179b326 100644 (file)
@@ -6,6 +6,66 @@
 #include <vtkRenderWindowInteractor.h>
 #include <cpExtensions/Visualization/BaseInteractorStyle.h>
 
+// -------------------------------------------------------------------------
+#define example_BaseInteractorStyle_Macro( x )  \
+  virtual void On##x( )                         \
+  { std::cout << "On" << #x << "( )" << std::endl; }
+
+// -------------------------------------------------------------------------
+class example_BaseInteractorStyle
+  : public cpExtensions::Visualization::BaseInteractorStyle
+{
+public:
+  typedef example_BaseInteractorStyle Self;
+  vtkTypeMacro(
+    example_BaseInteractorStyle,
+    cpExtensions::Visualization::BaseInteractorStyle
+    );
+
+public:
+  static Self* New( )
+    { return( new Self ); }
+
+  // Possible events
+  example_BaseInteractorStyle_Macro( MouseMove );
+  example_BaseInteractorStyle_Macro( MouseWheelForward );
+  example_BaseInteractorStyle_Macro( MouseWheelBackward );
+  example_BaseInteractorStyle_Macro( LeftButtonDown );
+  example_BaseInteractorStyle_Macro( LeftButtonUp );
+  example_BaseInteractorStyle_Macro( LeftClick );
+  example_BaseInteractorStyle_Macro( LeftDoubleClick );
+  example_BaseInteractorStyle_Macro( MiddleButtonDown );
+  example_BaseInteractorStyle_Macro( MiddleButtonUp );
+  example_BaseInteractorStyle_Macro( MiddleClick );
+  example_BaseInteractorStyle_Macro( MiddleDoubleClick );
+  example_BaseInteractorStyle_Macro( RightButtonDown );
+  example_BaseInteractorStyle_Macro( RightButtonUp );
+  example_BaseInteractorStyle_Macro( RightClick );
+  example_BaseInteractorStyle_Macro( RightDoubleClick );
+  example_BaseInteractorStyle_Macro( Char );
+  example_BaseInteractorStyle_Macro( KeyDown );
+  example_BaseInteractorStyle_Macro( KeyUp );
+  example_BaseInteractorStyle_Macro( KeyPress );
+  example_BaseInteractorStyle_Macro( KeyRelease );
+  example_BaseInteractorStyle_Macro( Expose );
+  example_BaseInteractorStyle_Macro( Configure );
+  example_BaseInteractorStyle_Macro( Enter );
+  example_BaseInteractorStyle_Macro( Leave );
+
+protected:
+  example_BaseInteractorStyle( )
+    : Superclass( )
+    { }
+  virtual ~example_BaseInteractorStyle( )
+    { }
+
+private:
+  // Purposely not implemented
+  example_BaseInteractorStyle( const Self& );
+  Self& operator=( const Self& );
+};
+
+// -------------------------------------------------------------------------
 int main( int argc, char* argv[] )
 {
   // Configure visualization objects
@@ -19,9 +79,8 @@ int main( int argc, char* argv[] )
   window->SetSize( 600, 600 );
 
   // Set up interaction style
-  typedef cpExtensions::Visualization::BaseInteractorStyle TInteractorStyle;
-  vtkSmartPointer< TInteractorStyle > style =
-    vtkSmartPointer< TInteractorStyle >::New( );
+  vtkSmartPointer< example_BaseInteractorStyle > style =
+    vtkSmartPointer< example_BaseInteractorStyle >::New( );
 
   // Set up the interaction
   vtkSmartPointer< vtkRenderWindowInteractor > interactor =
diff --git a/appli/examples/example_View2DImage.cxx b/appli/examples/example_View2DImage.cxx
new file mode 100644 (file)
index 0000000..66eaf29
--- /dev/null
@@ -0,0 +1,112 @@
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+#include <cpPlugins/Interface/Image.h>
+
+#include <cpExtensions/Visualization/ImageSliceActors.h>
+
+// -------------------------------------------------------------------------
+typedef cpPlugins::Interface::Interface     TInterface;
+typedef cpPlugins::Interface::ProcessObject TProcessObject;
+typedef cpPlugins::Interface::DataObject    TDataObject;
+typedef cpPlugins::Interface::Image         TImage;
+typedef cpPlugins::Interface::Parameters    TParameters;
+typedef TInterface::TClasses                TClasses;
+
+typedef cpExtensions::Visualization::ImageSliceActors TSliceActors;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " plugins_file input_image"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create interface
+  TInterface plugins;
+  if( !plugins.Load( argv[ 1 ] ) )
+  {
+    std::cerr << "Failed to load plugins." << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create objects
+  TProcessObject::Pointer reader;
+  reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
+  if( reader.IsNull( ) )
+  {
+    std::cerr
+      << "No suitable reader found in plugins." << std::endl
+      << "Reader: " << reader.GetPointer( ) << std::endl
+      << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Configure reader
+  TParameters reader_params = reader->GetDefaultParameters( );
+  for( int i = 2; i < argc; ++i )
+    reader_params.AddValueToStringList( "FileNames", argv[ i ] );
+  reader->SetParameters( reader_params );
+
+  // Execute pipeline
+  std::string err = reader->Update( );
+  if( err != "" )
+  {
+    std::cerr << "ERROR: " << err << std::endl;
+    return( 1 );
+
+  } // fi
+  TImage* image = reader->GetOutput< TImage >( 0 );
+
+  // Configure visualization objects
+  vtkSmartPointer< vtkRenderer > renderer =
+    vtkSmartPointer< vtkRenderer >::New( );
+  renderer->SetBackground( 0.1, 0.3, 0.5 );
+
+  vtkSmartPointer< vtkRenderWindow > window =
+    vtkSmartPointer< vtkRenderWindow >::New( );
+  window->AddRenderer( renderer );
+  window->SetSize( 600, 600 );
+
+  // Set up interaction style
+  /*
+    vtkSmartPointer< example_BaseInteractorStyle > style =
+    vtkSmartPointer< example_BaseInteractorStyle >::New( );
+  */
+
+  // Set up the interaction
+  vtkSmartPointer< vtkRenderWindowInteractor > interactor =
+    vtkSmartPointer< vtkRenderWindowInteractor >::New( );
+  // interactor->SetInteractorStyle( style );
+  window->SetInteractor( interactor );
+
+  // Create slice actors
+  vtkSmartPointer< TSliceActors > image_actors =
+    vtkSmartPointer< TSliceActors >::New( );
+  image_actors->AddInputData( image->GetVTK< vtkImageData >( ) );
+  image_actors->PushActorsInto( renderer );
+  interactor->SetInteractorStyle( image_actors->GetStyle( ) );
+
+  // Begin interaction
+  window->Render( );
+  interactor->Start( );
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
index 8eb3feed603cf5221df395c461cf5fcc3690389b..ba89696a5679d698af2fc10570d242e7e228d890 100644 (file)
@@ -1,21 +1,10 @@
 #include <cpExtensions/Visualization/BaseInteractorStyle.h>
 
-/* =========================================================================
- * Double click algorithm taken from:
- * http://www.autohotkey.com/board/topic/56493-easiest-way-to-detect-double-clicks/
- * =========================================================================
-*/
-
-/*
-  Compile ITK and VTK with: cmake -DCMAKE_CXX_FLAGS="-std=c++11" /dir/to/source
-*/
-
-#include <chrono>
 #include <vtkCallbackCommand.h>
 
 // -------------------------------------------------------------------------
-const long cpExtensions::Visualization::BaseInteractorStyle::
-MAX_DOUBLE_CLICK = 200;
+const long cpExtensions::Visualization::BaseInteractorStyle::MouseButtonEvent::
+MAX_DOUBLE_CLICK = 200; // ms
 
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::BaseInteractorStyle::
@@ -30,6 +19,8 @@ void cpExtensions::Visualization::BaseInteractorStyle::
 DelegateTDxEvent( unsigned long event, void* calldata )
 {
   // TODO
+  std::cerr << "No TDx support at this time!" << std::endl;
+  std::exit( 1 );
 }
 
 // -------------------------------------------------------------------------
@@ -37,10 +28,11 @@ cpExtensions::Visualization::BaseInteractorStyle::
 BaseInteractorStyle( )
   : Superclass( )
 {
-  this->LastButton = Self::ButtonID_None;
-  this->LastButtonUp = 0;
-  this->LastButtonHeld = 0;
-  this->LastButtonDown = -1;
+  this->LeftButtonEvent.Reset( );
+  this->MiddleButtonEvent.Reset( );
+  this->RightButtonEvent.Reset( );
+  this->ActiveButton = Self::ButtonID_None;
+
   this->EventCallbackCommand->SetCallback( Self::_ProcessEvents );
 }
 
@@ -59,7 +51,7 @@ _ProcessEvents(
   void* calldata
   )
 {
-  // Get active style
+  // Get active style and interactor
   Self* s = reinterpret_cast< Self* >( clientdata );
   if( s == NULL )
     return;
@@ -69,163 +61,102 @@ _ProcessEvents(
   {
   case vtkCommand::MouseMoveEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::MouseMoveEvent ) )
-      s->InvokeEvent( vtkCommand::MouseMoveEvent, NULL );
-    else
-      s->OnMouseMove( );
+    s->OnMouseMove( );
   }
   break;
   case vtkCommand::LeftButtonPressEvent:
   {
-    long tick_count =
-      std::chrono::duration_cast< std::chrono::milliseconds >(
-        std::chrono::system_clock::now( ).time_since_epoch( )
-        ).count( );
-    if(
-      s->LastButtonHeld < Self::MAX_DOUBLE_CLICK &&
-      ( tick_count - s->LastButtonUp ) < Self::MAX_DOUBLE_CLICK
-      )
-    {
-      std::cout << "double!!!" << std::endl;
-    }
-    else
-    {
-      std::cout << "single!!!" << std::endl;
-
-    } // fi
-    if( s->LastButtonDown < 0 )
-      s->LastButtonDown = tick_count;
-
-    /*
-      if( s->LastButton != Self::ButtonID_Left )
-      {
-      s->LastButton = Self::ButtonID_Left;
-      s->LastButtonClicks = 1;
-      s->LastButtonTime = std::chrono::system_clock::now( );
-      }
-      else if( s->LastButton == Self::ButtonID_Left )
-      s->LastButtonClicks++;
-    */
+    unsigned char nc = s->LeftButtonEvent.Clicks( );
+    if( nc == 2 )
+      s->OnLeftDoubleClick( );
+    else if( nc == 1 )
+      s->OnLeftClick( );
+    s->ActiveButton = Self::ButtonID_Left;
   }
   break;
   case vtkCommand::LeftButtonReleaseEvent:
   {
-    long tick_count =
-      std::chrono::duration_cast< std::chrono::milliseconds >(
-        std::chrono::system_clock::now( ).time_since_epoch( )
-        ).count( );
-    s->LastButtonUp = tick_count;
-    s->LastButtonHeld = tick_count - s->LastButtonDown;
-    s->LastButtonDown = -1;
-
-    /*
-      if( s->LastButton == Self::ButtonID_Left )
-      {
-      long d = std::chrono::duration_cast< std::chrono::milliseconds >(
-      std::chrono::system_clock::now( ) - s->LastButtonTime
-      ).count( );
-      if( d < 500 )
-      {
-      } // fi
-
-      } // fi
-    */
+    s->LeftButtonEvent.Release( );
+    s->ActiveButton = Self::ButtonID_None;
   }
   break;
   case vtkCommand::MiddleButtonPressEvent:
   {
+    unsigned char nc = s->MiddleButtonEvent.Clicks( );
+    if( nc == 2 )
+      s->OnMiddleDoubleClick( );
+    else if( nc == 1 )
+      s->OnMiddleClick( );
+    s->ActiveButton = Self::ButtonID_Middle;
   }
   break;
   case vtkCommand::MiddleButtonReleaseEvent:
   {
+    s->MiddleButtonEvent.Release( );
+    s->ActiveButton = Self::ButtonID_None;
   }
   break;
   case vtkCommand::RightButtonPressEvent:
   {
+    unsigned char nc = s->RightButtonEvent.Clicks( );
+    if( nc == 2 )
+      s->OnRightDoubleClick( );
+    else if( nc == 1 )
+      s->OnRightClick( );
+    s->ActiveButton = Self::ButtonID_Right;
   }
   break;
   case vtkCommand::RightButtonReleaseEvent:
   {
+    s->RightButtonEvent.Release( );
+    s->ActiveButton = Self::ButtonID_None;
   }
   break;
   case vtkCommand::MouseWheelForwardEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::MouseWheelForwardEvent ) )
-      s->InvokeEvent( vtkCommand::MouseWheelForwardEvent, NULL );
-    else
-      s->OnMouseWheelForward( );
+    s->OnMouseWheelForward( );
   }
   break;
   case vtkCommand::MouseWheelBackwardEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::MouseWheelBackwardEvent ) )
-      s->InvokeEvent( vtkCommand::MouseWheelBackwardEvent, NULL );
-    else
-      s->OnMouseWheelBackward( );
+    s->OnMouseWheelBackward( );
   }
   break;
   case vtkCommand::KeyPressEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::KeyPressEvent ) )
-      s->InvokeEvent( vtkCommand::KeyPressEvent, NULL );
-    else
-    {
-      s->OnKeyDown( );
-      s->OnKeyPress( );
-
-    } // fi
+    s->OnKeyDown( );
+    s->OnKeyPress( );
   }
   break;
   case vtkCommand::KeyReleaseEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::KeyReleaseEvent ) )
-      s->InvokeEvent( vtkCommand::KeyReleaseEvent, NULL );
-    else
-    {
-      s->OnKeyUp( );
-      s->OnKeyRelease( );
-
-    } // fi
+    s->OnKeyUp( );
+    s->OnKeyRelease( );
   }
   break;
   case vtkCommand::CharEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::CharEvent ) )
-      s->InvokeEvent( vtkCommand::CharEvent, NULL );
-    else
-      s->OnChar( );
+    s->OnChar( );
   }
   break;
   case vtkCommand::ExposeEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::ExposeEvent ) )
-      s->InvokeEvent( vtkCommand::ExposeEvent, NULL );
-    else
-      s->OnExpose( );
+    s->OnExpose( );
   }
   break;
   case vtkCommand::ConfigureEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::ConfigureEvent ) )
-      s->InvokeEvent( vtkCommand::ConfigureEvent, NULL );
-    else
-      s->OnConfigure( );
+    s->OnConfigure( );
   }
   break;
   case vtkCommand::EnterEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::EnterEvent ) )
-      s->InvokeEvent( vtkCommand::EnterEvent, NULL );
-    else
-      s->OnEnter( );
+    s->OnEnter( );
   }
   break;
   case vtkCommand::LeaveEvent:
   {
-    if( s->HandleObservers && s->HasObserver( vtkCommand::LeaveEvent ) )
-      s->InvokeEvent( vtkCommand::LeaveEvent, NULL );
-    else
-      s->OnLeave( );
+    s->OnLeave( );
   }
   break;
   case vtkCommand::TimerEvent:
index f10a9bb493f1a48fae532d2d7a6470028cb2a72a..02dd1503e29fe8da240dd4423bfddee4fb9b15c8 100644 (file)
@@ -3,8 +3,25 @@
 
 #include <cpExtensions/cpExtensions_Export.h>
 
+#include <chrono>
 #include <vtkInteractorStyle.h>
 
+/*
+ * Compile ITK and VTK with: cmake -DCMAKE_CXX_FLAGS="-std=c++11" /dir/to/source
+ */
+
+/* =========================================================================
+ * Double click algorithm taken from:
+ * http://www.autohotkey.com/board/topic/56493-easiest-way-to-detect-double-clicks/
+ * =========================================================================
+ */
+
+// -------------------------------------------------------------------------
+#define BaseInteractorStyle_DIFF_TIME                           \
+  std::chrono::duration_cast< std::chrono::milliseconds >(      \
+    std::chrono::system_clock::now( ).time_since_epoch( )       \
+    ).count( )
+
 namespace cpExtensions
 {
   namespace Visualization
@@ -20,10 +37,10 @@ namespace cpExtensions
 
       enum ButtonID
       {
-        ButtonID_None   = 0x00,
-        ButtonID_Left   = 0x01,
-        ButtonID_Middle = 0x02,
-        ButtonID_Right  = 0x03
+        ButtonID_None 0,
+        ButtonID_Left,
+        ButtonID_Middle,
+        ButtonID_Right
       };
 
     public:
@@ -37,6 +54,8 @@ namespace cpExtensions
       virtual void OnMouseWheelBackward( ) { }
 
       // Possible mouse click-related events
+      inline ButtonID GetButtonID( ) const
+      { return( this->ActiveButton ); }
       virtual void OnLeftButtonDown( ) { }
       virtual void OnLeftButtonUp( ) { }
       virtual void OnLeftClick( ) { }
@@ -103,11 +122,55 @@ namespace cpExtensions
       Self& operator=( const Self& );
 
     protected:
-      static const long MAX_DOUBLE_CLICK;
-      ButtonID LastButton;
-      long LastButtonUp;
-      long LastButtonHeld;
-      long LastButtonDown;
+
+      /**
+       * Button events
+       */
+      struct MouseButtonEvent
+      {
+        static const long MAX_DOUBLE_CLICK;
+        long LastButtonUp;
+        long LastButtonHeld;
+        long LastButtonDown;
+
+        inline MouseButtonEvent( )
+          { this->Reset( ); }
+        inline void Reset( )
+          {
+            this->LastButtonUp = 0;
+            this->LastButtonHeld = 0;
+            this->LastButtonDown = -1;
+          }
+        inline void Release( )
+          {
+            long c = BaseInteractorStyle_DIFF_TIME;
+            this->LastButtonUp = c;
+            this->LastButtonHeld = c - this->LastButtonDown;
+            this->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->Reset( );
+              n = 2;
+            }
+            else
+              n = 1;
+            if( this->LastButtonDown < 0 )
+              this->LastButtonDown = c;
+            return( n );
+          }
+      };
+      MouseButtonEvent LeftButtonEvent;
+      MouseButtonEvent MiddleButtonEvent;
+      MouseButtonEvent RightButtonEvent;
+      ButtonID ActiveButton;
     };
 
   } // ecapseman
index b784808ede8fbff1b1a0ff37e3402a7018724748..aa688bff93ddfbc1e54ab54e6615c50bec858b43 100644 (file)
@@ -1,5 +1,304 @@
 #include <cpExtensions/Visualization/ImageInteractorStyle.h>
 
+#include <vtkImageActor.h>
+#include <vtkRenderWindowInteractor.h>
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::ImageInteractorStyle::
+Self* cpExtensions::Visualization::ImageInteractorStyle::
+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::
+OnMouseMove( )
+{
+  // Get current position on the associated actors
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL || this->MouseMoveCommand == 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 );
+  ButtonID button = this->GetButtonID( );
+
+  // Invoke possible events
+  this->MouseMoveCommand( this->Data, button, pos, alt, ctr, sft );
+  rwi->Render( );
+}
+
+// -------------------------------------------------------------------------
+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 );
+}
+
+// -------------------------------------------------------------------------
+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 );
+}
+
+// -------------------------------------------------------------------------
+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 );
+}
+
+// -------------------------------------------------------------------------
+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 );
+}
+
+// -------------------------------------------------------------------------
+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 );
+}
+
+// -------------------------------------------------------------------------
+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 );
+}
+
+// -------------------------------------------------------------------------
+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 );
+}
+
+// -------------------------------------------------------------------------
+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 );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageInteractorStyle::
+OnChar( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL || this->KeyCommand == NULL )
+    return;
+  this->KeyCommand( this->Data, rwi->GetKeyCode( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageInteractorStyle::
+OnExpose( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageInteractorStyle::
+OnConfigure( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageInteractorStyle::
+OnEnter( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageInteractorStyle::
+OnLeave( )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return;
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::ImageInteractorStyle::
+ImageInteractorStyle( )
+  : Superclass( ),
+    Data( NULL ),
+    MouseMoveCommand( NULL ),
+    MouseClickCommand( NULL ),
+    MouseDoubleClickCommand( NULL ),
+    MouseWheelCommand( NULL ),
+    KeyCommand( NULL )
+{
+  this->PropPicker = vtkSmartPointer< vtkPropPicker >::New( );
+  this->PropPicker->PickFromListOn( );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::ImageInteractorStyle::
+~ImageInteractorStyle( )
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::Visualization::ImageInteractorStyle::
+_PickPosition( double pos[ 3 ] )
+{
+  vtkRenderWindowInteractor* rwi = this->GetInteractor( );
+  if( rwi == NULL )
+    return( false );
+
+  // Find the renderer where the event has been raised
+  double x = double( rwi->GetEventPosition( )[ 0 ] );
+  double y = double( rwi->GetEventPosition( )[ 1 ] );
+  this->FindPokedRenderer( x, y );
+
+  // Pick a 3D position
+  int r = this->PropPicker->Pick( x, y, double( 0 ), this->CurrentRenderer );
+  if( r == 0 )
+    return( false );
+  this->PropPicker->GetPickPosition( pos );
+
+  return( true );
+}
+
+/*
 #include <cmath>
 #include <ctime>
 
@@ -682,5 +981,6 @@ _UpdateRadius( )
 
   this->Interactor->Render( );
 }
+*/
 
 // eof - $RCSfile$
index df8422c72b273acdb652535c8e80961beaeb1c73..e58c28d54a543d26543eb4d3689cf2ae9b5f8b35 100644 (file)
 #ifndef __CPEXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
 #define __CPEXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
 
-#include <vector>
+#include <cpExtensions/Visualization/BaseInteractorStyle.h>
 
-#include <vtkInteractorStyleImage.h>
-#include <vtkOrientationMarkerWidget.h>
-#include <vtkPropPicker.h>
 #include <vtkSmartPointer.h>
+#include <vtkPropPicker.h>
+
+/* TODO
+   #include <vector>
+
+   #include <vtkInteractorStyleImage.h>
+   #include <vtkOrientationMarkerWidget.h>
 
-#include <cpExtensions/cpExtensions_Export.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 ); }
+   // -------------------------------------------------------------------------
+   #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;
 
 namespace cpExtensions
 {
   namespace Visualization
   {
-    class ImageSliceActors;
-    class MPRActors;
-
     /**
      */
     class cpExtensions_EXPORT ImageInteractorStyle
-      : public vtkInteractorStyleImage
+      : public BaseInteractorStyle
     {
     public:
       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 );
+      virtual void AssociateImageActor( vtkImageActor* actor );
+
+      // 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 ] );
+
+    private:
+      // Purposely not implemented
+      ImageInteractorStyle( const Self& );
+      Self& operator=( const Self& );
+
+    protected:
+      vtkSmartPointer< vtkPropPicker > PropPicker;
+
+      // Commands
+      void* Data;
+      TMouseCommand      MouseMoveCommand;
+      TMouseCommand      MouseClickCommand;
+      TMouseCommand      MouseDoubleClickCommand;
+      TMouseWheelCommand MouseWheelCommand;
+      TKeyCommand        KeyCommand;
+    };
+
+    /*
+      class ImageSliceActors;
+      class MPRActors;
+    */
+
+    /**
+     */
+    /*
+      class cpExtensions_EXPORT ImageInteractorStyle
+      : public vtkInteractorStyleImage
+      {
+      public:
+      typedef ImageInteractorStyle Self;
 
       enum InteractionMode
       {
-        NavigationMode = 0,
-        DeformationMode
+      NavigationMode = 0,
+      DeformationMode
       };
 
-    public:
+      public:
       vtkTypeMacro( ImageInteractorStyle, vtkInteractorStyleImage );
 
       cpPlugins_ImageInteractorStyle_ObserverMacro( DoubleClick );
       cpPlugins_ImageInteractorStyle_ObserverMacro( Cursor );
       cpPlugins_ImageInteractorStyle_ObserverMacro( Radius );
 
-    public:
+      public:
       static Self* New( );
 
       void Configure(
-        ImageSliceActors* slice_actors,
-        MPRActors* mpr_actors = NULL
-        );
+      ImageSliceActors* slice_actors,
+      MPRActors* mpr_actors = NULL
+      );
       void AssociateInteractor( vtkRenderWindowInteractor* interactor );
 
       void SetModeToNavigation( );
       void SetModeToDeformation( );
       virtual void SetInteractor(
-        vtkRenderWindowInteractor* interactor, const int& axis
-        );
+      vtkRenderWindowInteractor* interactor, const int& axis
+      );
 
       // Description:
       // Event bindings controlling the effects of pressing mouse buttons
@@ -108,28 +196,26 @@ namespace cpExtensions
       virtual void StartRadiusMoving( );
       virtual void EndRadiusMoving( );
 
-    protected:
+      protected:
       ImageInteractorStyle( );
       virtual ~ImageInteractorStyle( );
 
       void _RenderAssociateInteractors( );
-      bool _PickPosition( double pos[ 3 ] );
       void _UpdateCursor( );
       void _UpdateRadius( );
 
-    private:
+      private:
       // Purposely not implemented
       ImageInteractorStyle( const Self& );
       Self& operator=( const Self& );
 
-    protected:
+      protected:
       Self::InteractionMode Mode;
 
       ImageSliceActors* m_SliceActors;
       MPRActors*        m_MPRActors;
 
       vtkSmartPointer< vtkOrientationMarkerWidget > OrientationWidget;
-      vtkSmartPointer< vtkPropPicker > PropPicker;
 
       std::vector< vtkRenderWindowInteractor* > AssociatedInteractors;
 
@@ -142,11 +228,12 @@ namespace cpExtensions
       vtkSmartPointer< vtkPolyDataMapper > CircleMapper;
       vtkSmartPointer< vtkActor > CircleActor;
 
-    public:
+      public:
       static const int CursorEvent;
       static const int RadiusEvent;
       static const int DoubleClickEvent;
-    };
+      };
+    */
 
   } // ecapseman
 
index 469f270f6b7df5886232ed7601f339c857579110..5722c583d608b0159ebe9537e61ca5fcbcb84909 100644 (file)
@@ -1,5 +1,7 @@
 #include <cpExtensions/Visualization/ImageSliceActors.h>
 
+#include <sstream>
+
 #include <vtkAlgorithmOutput.h>
 #include <vtkCellArray.h>
 #include <vtkImageData.h>
@@ -7,6 +9,7 @@
 #include <vtkPlane.h>
 #include <vtkPoints.h>
 #include <vtkProperty.h>
+#include <vtkRenderer.h>
 #include <vtkStreamingDemandDrivenPipeline.h>
 #include <vtkTextProperty.h>
 
@@ -50,7 +53,7 @@ Clear( )
   // Delete all images
   this->SliceMappers.clear( );
   this->ImageActors.clear( );
-  this->OtherActors.clear( );
+  this->AssociatedActors.clear( );
 
   // Reconfigure unique objects
   this->PlaneFunction = vtkSmartPointer< vtkPlane >::New( );
@@ -97,6 +100,44 @@ Clear( )
   coord->SetValue( 0.01, 0.01 );
 }
 
+// -------------------------------------------------------------------------
+vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors::
+GetStyle( )
+{
+  return( this->Style.GetPointer( ) );
+}
+
+// -------------------------------------------------------------------------
+const vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors::
+GetStyle( ) const
+{
+  return( this->Style.GetPointer( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+PushActorsInto( vtkRenderer* renderer )
+{
+  unsigned int N = this->GetNumberOfImageActors( );
+  for( unsigned int n = 0; n < N; ++n )
+    renderer->AddActor( this->GetImageActor( n ) );
+  renderer->AddActor( this->GetTextActor( ) );
+  renderer->AddActor( this->GetPlaneActor( ) );
+  renderer->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+PopActorsFrom( vtkRenderer* renderer )
+{
+  unsigned int N = this->GetNumberOfImageActors( );
+  for( unsigned int n = 0; n < N; ++n )
+    renderer->RemoveActor( this->GetImageActor( n ) );
+  renderer->RemoveActor( this->GetTextActor( ) );
+  renderer->RemoveActor( this->GetPlaneActor( ) );
+  renderer->Modified( );
+}
+
 // -------------------------------------------------------------------------
 unsigned int cpExtensions::Visualization::ImageSliceActors::
 GetNumberOfImageActors( ) const
@@ -170,7 +211,7 @@ GetPlaneFunction( ) const
 void cpExtensions::Visualization::ImageSliceActors::
 AddActor( vtkAlgorithm* algorithm, vtkActor* actor )
 {
-  this->OtherActors.push_back( TActorPair( algorithm, actor ) );
+  this->AssociatedActors.push_back( TAssociatedActor( algorithm, actor ) );
   this->AddItem( actor );
 }
 
@@ -381,26 +422,28 @@ SetSliceNumber( const int& slice )
   this->PlaneActor->Modified( );
 
   // Prepare other actors to update
-  for( unsigned int i = 0; i < this->OtherActors.size( ); ++i )
-  {
-    if( this->OtherActors[ i ].first.GetPointer( ) != NULL )
-    {
-      this->OtherActors[ i ].first->Modified( );
-      this->OtherActors[ i ].first->Update( );
+  /* TODO
+     for( unsigned int i = 0; i < this->OtherActors.size( ); ++i )
+     {
+     if( this->OtherActors[ i ].first.GetPointer( ) != NULL )
+     {
+     this->OtherActors[ i ].first->Modified( );
+     this->OtherActors[ i ].first->Update( );
 
-    } // fi
+     } // fi
 
-    if( this->OtherActors[ i ].second.GetPointer( ) != NULL )
-    {
-      this->OtherActors[ i ].second->GetMapper( )->Modified( );
-      this->OtherActors[ i ].second->Modified( );
+     if( this->OtherActors[ i ].second.GetPointer( ) != NULL )
+     {
+     this->OtherActors[ i ].second->GetMapper( )->Modified( );
+     this->OtherActors[ i ].second->Modified( );
 
-    } // fi
+     } // fi
 
-  } // rof
+     } // rof
 
-  if( this->m_UpdateCommand != NULL )
-    this->m_UpdateCommand( this->m_UpdateData );
+     if( this->m_UpdateCommand != NULL )
+     this->m_UpdateCommand( this->m_UpdateData );
+  */
 
   // Update text
   this->UpdateText( );
@@ -430,6 +473,57 @@ UpdateText( )
   this->Modified( );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+UpdateText( double pos[ 3 ] )
+{
+  if( this->SliceMappers.size( ) > 0 )
+  {
+    char axis;
+    int axId = this->SliceMappers[ 0 ]->GetOrientation( );
+    if     ( axId == 0 ) axis = 'X';
+    else if( axId == 1 ) axis = 'Y';
+    else if( axId == 2 ) axis = 'Z';
+
+    vtkImageData* image = this->SliceMappers[ 0 ]->GetInput( );
+
+    int ijk[ 3 ];
+    double pcoords[ 3 ];
+    image->ComputeStructuredCoordinates( pos, ijk, pcoords );
+    {
+      int nScl = image->GetNumberOfScalarComponents( );
+      std::stringstream str;
+      str
+        << "[" << ijk[ 0 ]
+        << "," << ijk[ 1 ]
+        << "," << ijk[ 2 ] << "]=(";
+      str <<
+        image->GetScalarComponentAsFloat(
+          ijk[ 0 ], ijk[ 1 ], ijk[ 2 ], 0
+          );
+      for( int n = 1; n < nScl; ++n )
+        str
+          << " "
+          << image->GetScalarComponentAsFloat(
+            ijk[ 0 ], ijk[ 1 ], ijk[ 2 ], n
+            );
+      str << ")";
+      std::sprintf(
+        this->TextBuffer, "Axis: %c (%d) | Pixel %s",
+        axis,
+        this->SliceMappers[ 0 ]->GetSliceNumber( ),
+        str.str( ).c_str( )
+        );
+
+    } // fi
+  }
+  else
+    this->TextBuffer[ 0 ] = '\0';
+  this->TextActor->SetInput( this->TextBuffer );
+  this->TextActor->Modified( );
+  this->Modified( );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 UpdateText( const double& w, const double& l )
@@ -458,10 +552,17 @@ UpdateText( const double& w, const double& l )
 cpExtensions::Visualization::ImageSliceActors::
 ImageSliceActors( )
   : Superclass( ),
-    Interpolate( false ),
-    m_UpdateCommand( NULL ),
-    m_UpdateData( NULL )
+    Interpolate( false )
 {
+  // 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 );
+
   this->Clear( );
 }
 
@@ -497,6 +598,7 @@ _ConfigureNewInput( int axis )
   {
     this->AddItem( this->TextActor );
     this->AddItem( this->PlaneActor );
+    this->Style->AssociateImageActor( actor );
 
   } // fi
   this->AddItem( actor );
@@ -506,4 +608,69 @@ _ConfigureNewInput( int axis )
   this->Modified( );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_MouseMoveCommand(
+  void* data,
+  const ImageInteractorStyle::ButtonID& btn, double* pos,
+  bool alt, bool ctr, bool sft
+  )
+{
+  ImageSliceActors* actors = reinterpret_cast< ImageSliceActors* >( data );
+  if( actors == NULL )
+    return;
+
+  if( btn == ImageInteractorStyle::ButtonID_None )
+  {
+    actors->UpdateText( pos );
+  }
+  else if( btn == ImageInteractorStyle::ButtonID_Left )
+  {
+  }
+  else if( btn == ImageInteractorStyle::ButtonID_Middle )
+  {
+  }
+  else if( btn == ImageInteractorStyle::ButtonID_Right )
+  {
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_MouseClickCommand(
+  void* data,
+  const ImageInteractorStyle::ButtonID& btn, double* pos,
+  bool alt, bool ctr, bool sft
+  )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_MouseDoubleClickCommand(
+  void* data,
+  const ImageInteractorStyle::ButtonID& btn, double* pos,
+  bool alt, bool ctr, bool sft
+  )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_MouseWheelCommand(
+  void* data,
+  const int& dir, bool alt, bool ctr, bool sft
+  )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_KeyCommand(
+  void* data,
+  const char& key
+  )
+{
+}
+
 // eof - $RCSfile$
index 1a5bf49c998b9383fb74f0506b86148192e579c5..f940a90a6ff6f93a6af1dce2fda93df14c4c575e 100644 (file)
@@ -16,6 +16,8 @@
 #include <vtkSmartPointer.h>
 #include <vtkTextActor.h>
 
+#include <cpExtensions/Visualization/ImageInteractorStyle.h>
+
 // -------------------------------------------------------------------------
 class vtkAlgorithmOutput;
 class vtkImageData;
@@ -33,8 +35,6 @@ namespace cpExtensions
     public:
       typedef ImageSliceActors Self;
 
-      typedef void ( *TUpdateCommand )( void* );
-
     public:
       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
 
@@ -42,10 +42,15 @@ namespace cpExtensions
       // Creation
       static ImageSliceActors* New( );
 
-      void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 0 );
-      void AddInputData( vtkImageData* data, int axis = 0 );
+      void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
+      void AddInputData( vtkImageData* data, int axis = 2 );
       void Clear( );
 
+      vtkInteractorStyle* GetStyle( );
+      const vtkInteractorStyle* GetStyle( ) const;
+
+      void PushActorsInto( vtkRenderer* renderer );
+      void PopActorsFrom( vtkRenderer* renderer );
       unsigned int GetNumberOfImageActors( ) const;
       vtkImageActor* GetImageActor( unsigned int id );
       const vtkImageActor* GetImageActor( unsigned int id ) const;
@@ -72,36 +77,58 @@ namespace cpExtensions
       int GetSliceNumberMaxValue( ) const;
       void SetSliceNumber( const int& slice );
       void UpdateText( );
+      void UpdateText( double pos[ 3 ] );
       void UpdateText( const double& w, const double& l );
 
-      void SetUpdateCommand( TUpdateCommand cmd, void* data )
-        {
-          this->m_UpdateCommand = cmd;
-          this->m_UpdateData = data;
-        }
-
     protected:
       ImageSliceActors( );
       virtual ~ImageSliceActors( );
 
       void _ConfigureNewInput( int axis );
 
+      // Events
+      static void _MouseMoveCommand(
+        void* data,
+        const ImageInteractorStyle::ButtonID& btn, double* pos,
+        bool alt, bool ctr, bool sft
+        );
+      static void _MouseClickCommand(
+        void* data,
+        const ImageInteractorStyle::ButtonID& btn, double* pos,
+        bool alt, bool ctr, bool sft
+        );
+      static void _MouseDoubleClickCommand(
+        void* data,
+        const ImageInteractorStyle::ButtonID& btn, double* pos,
+        bool alt, bool ctr, bool sft
+        );
+      static void _MouseWheelCommand(
+        void* data,
+        const int& dir, bool alt, bool ctr, bool sft
+        );
+      static void _KeyCommand(
+        void* data,
+        const char& key
+        );
+
     private:
       // Purposely not implemented
       ImageSliceActors( const Self& );
       Self& operator=( const Self& );
 
     protected:
+      vtkSmartPointer< ImageInteractorStyle > Style;
+
       // Multiple actors
       std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
       std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
-
-      typedef
-      std::pair< vtkSmartPointer< vtkAlgorithm >, vtkSmartPointer< vtkActor > >
-      TActorPair;
-      std::vector< TActorPair > OtherActors;
       bool Interpolate;
 
+      // Other associated actors
+      typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
+      typedef std::vector< TAssociatedActor >       TAssociatedActors;
+      TAssociatedActors AssociatedActors;
+
       // Unique objects
       vtkSmartPointer< vtkPlane >          PlaneFunction;
       vtkSmartPointer< vtkPolyData >       PlaneSource;
@@ -109,10 +136,6 @@ namespace cpExtensions
       char                                 TextBuffer[ 1024 ];
       vtkSmartPointer< vtkTextActor >      TextActor;
       vtkSmartPointer< vtkActor >          PlaneActor;
-
-
-      TUpdateCommand m_UpdateCommand;
-      void* m_UpdateData;
     };
 
   } // ecapseman
index a32824c455926d3f674f3f6d310afa629668af2c..0076ad5334b6b4cfb1d071a0e4e79e19bace8f72 100644 (file)
@@ -95,7 +95,7 @@ ActivateInteractors( )
     // Check prerrequisites
     if( this->m_Windows[ i ] == NULL || this->m_Renderers[ i ] == NULL )
     {
-      this->m_Styles[ i ] = NULL;
+      // TODO: this->m_Styles[ i ] = NULL;
       continue;
 
     } // fi
@@ -103,16 +103,18 @@ ActivateInteractors( )
     ImageSliceActors* actors = this->m_MPRActors->GetSliceActors( i );
     if( actors == NULL )
     {
-      this->m_Styles[ i ] = NULL;
+      // TODO: this->m_Styles[ i ] = NULL;
       continue;
 
     } // fi
 
-    this->m_Styles[ i ] = vtkSmartPointer< TStyle >::New( );
-    this->m_Styles[ i ]->Configure( actors, this->m_MPRActors );
-    this->m_Styles[ i ]->
-      SetInteractor( this->m_Windows[ i ]->GetInteractor( ), i );
-    this->m_Styles[ i ]->SetModeToNavigation( );
+    /* TODO
+       this->m_Styles[ i ] = vtkSmartPointer< TStyle >::New( );
+       this->m_Styles[ i ]->Configure( actors, this->m_MPRActors );
+       this->m_Styles[ i ]->
+       SetInteractor( this->m_Windows[ i ]->GetInteractor( ), i );
+       this->m_Styles[ i ]->SetModeToNavigation( );
+    */
 
   } // rof
 
@@ -121,18 +123,22 @@ ActivateInteractors( )
   {
     for( int j = 0; j < 3; ++j )
     {
-      if(
-        this->m_Windows[ i ] != NULL &&
-        this->m_Windows[ j ] != NULL &&
-        i != j
-        )
-        this->m_Styles[ i ]->
-          AssociateInteractor( this->m_Windows[ j ]->GetInteractor( ) );
+      /* TODO
+         if(
+         this->m_Windows[ i ] != NULL &&
+         this->m_Windows[ j ] != NULL &&
+         i != j
+         )
+         this->m_Styles[ i ]->
+         AssociateInteractor( this->m_Windows[ j ]->GetInteractor( ) );
+      */
 
     } // rof
-    if( this->m_Windows[ 3 ] != NULL )
-      this->m_Styles[ i ]->
-        AssociateInteractor( this->m_Windows[ 3 ]->GetInteractor( ) );
+    /* TODO
+       if( this->m_Windows[ 3 ] != NULL )
+       this->m_Styles[ i ]->
+       AssociateInteractor( this->m_Windows[ 3 ]->GetInteractor( ) );
+    */
 
   } // rof
 
index cbec46ff5c0b243861a9d9b0632007219e3a0c52..7d33f3f0698dd6e0b483beb7ba852705075d541e 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <cpExtensions/cpExtensions_Export.h>
 #include <cpExtensions/Visualization/MPRActors.h>
-#include <cpExtensions/Visualization/ImageInteractorStyle.h>
 
 #include <vtkObject.h>
 #include <vtkRenderer.h>
@@ -20,8 +19,7 @@ namespace cpExtensions
     {
     public:
       typedef MPRObjects Self;
-      typedef cpExtensions::Visualization::MPRActors            TMPRActors;
-      typedef cpExtensions::Visualization::ImageInteractorStyle TStyle;
+      typedef cpExtensions::Visualization::MPRActors TMPRActors;
 
     public:
       vtkTypeMacro( MPRObjects, vtkObject );
@@ -70,7 +68,6 @@ namespace cpExtensions
       // Internal pipelines
       vtkSmartPointer< TMPRActors >  m_MPRActors;
       vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
-      vtkSmartPointer< TStyle >      m_Styles[ 3 ];
     };
 
   } // ecapseman
index 8ebd4e4ed9c87c2ddfd0976c984c69a3c00cd6ac..1b2c8dbe7fec338ca546678635fb88f3db7d6ae9 100644 (file)
@@ -5,32 +5,29 @@
 #include <cpPlugins/Interface/ProcessObject.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_Define_ProcessObject( O, S )                  \
-  class cpPlugins_Interface_EXPORT O                            \
-    : public S                                                  \
-  {                                                             \
-  public:                                                       \
-    typedef O                               Self;               \
-    typedef S                               Superclass;         \
-    typedef itk::SmartPointer< Self >       Pointer;            \
-    typedef itk::SmartPointer< const Self > ConstPointer;       \
-  public:                                                       \
-    itkTypeMacro( O, S );                                       \
-  protected:                                                    \
-    O( );                                                       \
-    virtual ~O( );                                              \
-  private:                                                      \
-    O( const Self& );                                           \
-    Self& operator=( const Self& );                             \
+#define cpPlugins_Define_ProcessObject( O, S )                          \
+  class cpPlugins_Interface_EXPORT O                                    \
+    : public S                                                          \
+  {                                                                     \
+  public:                                                               \
+    typedef O                               Self;                       \
+    typedef S                               Superclass;                 \
+    typedef itk::SmartPointer< Self >       Pointer;                    \
+    typedef itk::SmartPointer< const Self > ConstPointer;               \
+  public:                                                               \
+    itkTypeMacro( O, S );                                               \
+    cpPlugins_Id_Macro( cpPlugins::Interface::O, "ProcessObject" );     \
+  protected:                                                            \
+    O( );                                                               \
+    virtual ~O( );                                                      \
+  private:                                                              \
+    O( const Self& );                                                   \
+    Self& operator=( const Self& );                                     \
   }
 
 // -------------------------------------------------------------------------
 #define cpPlugins_Code_ProcessObject( O )               \
-  cpPlugins::Interface::O::O( ) : Superclass( )         \
-  {                                                     \
-    this->m_ClassName = "cpPlugins::Interface::#O";     \
-    this->m_ClassCategory = "#O";                       \
-  }                                                     \
+  cpPlugins::Interface::O::O( ) : Superclass( ) { }     \
   cpPlugins::Interface::O::~O( ) { }
 
 // -------------------------------------------------------------------------
index 536ea811fdeb90c8b124a199f71bdb908a1981d2..580434548740a34c758e10bb702be2e0705363ba 100644 (file)
@@ -70,8 +70,6 @@ DataObject( )
     m_VTKObject( NULL ),
     m_Source( NULL )
 {
-  this->m_ClassName = "cpPlugins::Interface::DataObject";
-  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
index 3347b64d1ad4312784056b01bb1b838a5239f10e..841f3a2514366b9af2d01bf5e943fd2145904795 100644 (file)
@@ -26,6 +26,9 @@ namespace cpPlugins
 
     public:
       itkTypeMacro( DataObject, Object );
+      cpPlugins_Id_Macro(
+        cpPlugins::Interface::DataObject, "BasicObject"
+        );
 
     public:
       Object* GetSource( );
index ad7b3ad19f02a8e053d01cba32e41bcd08387893..48b90740a68b7a0e6753c344ed32ee2528ac44b9 100644 (file)
@@ -14,8 +14,6 @@ cpPlugins::Interface::Image::
 Image( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::Interface::Image";
-  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
index 5d0d55b6807497ed2ad9b0a2893b885287d0b6ee..1aeee5cc18a7b6945951fcbf7d692d1748318b70 100644 (file)
@@ -27,6 +27,9 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( Image, DataObject );
+      cpPlugins_Id_Macro(
+        cpPlugins::Interface::Image, "DataObject"
+        );
 
     public:
       template< class I >
index 0dc2f9aab5ab3872b59cdbf5247d5b614a6c18eb..2866967ae73376e7a4a508aa911ab5a1274e3f0b 100644 (file)
@@ -65,8 +65,6 @@ Mesh( )
     m_Mapper( NULL ),
     m_Actor( NULL )
 {
-  this->m_ClassName = "cpPlugins::Interface::Mesh";
-  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
index 20c56fb2aaaa45e5c6fcc881560bbd76c67dd550..0eb76ed4cbe8cfc96dc99057e7bbb462df63b56d 100644 (file)
@@ -26,6 +26,9 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( Mesh, DataObject );
+      cpPlugins_Id_Macro(
+        cpPlugins::Interface::Mesh, "DataObject"
+        );
 
     public:
       template< class M >
index 5b0ebd6de87f9e79dd152d6465e3d1043ab06187..c4a0bfba7bcb84e499728c58bf1b9046f754964c 100644 (file)
@@ -54,8 +54,8 @@ public:                                                         \
 // -------------------------------------------------------------------------
 #define cpPlugins_Id_Macro( name, category )                            \
   public:                                                               \
-  static std::string GetClassName( ) { return( #name ); }               \
-  static std::string GetClassCategory( ) { return( category ); }
+  virtual std::string GetClassName( ) { return( #name ); }              \
+  virtual std::string GetClassCategory( ) { return( category ); }
 
 namespace cpPlugins
 {
index bc5f7f21aae6efc78678ff9aa2cd7957e03e7d2a..b2b9337d1ea8ccb07ee17bc1a392d7fc12070d9b 100644 (file)
@@ -107,7 +107,7 @@ ExecConfigurationDialog( QWidget* parent )
   Parameters parameters = this->m_DefaultParameters;
   r = cpPlugins::Interface::ParametersQtDialog(
     parameters,
-    this->m_ClassName + std::string( " basic configuration" ),
+    this->GetClassName( ) + std::string( " basic configuration" ),
     parent
     );
   if( r )
@@ -125,8 +125,6 @@ ProcessObject( )
     m_ITKObject( NULL ),
     m_VTKObject( NULL )
 {
-  this->m_ClassName = "cpPlugins::Interface::ProcessObject";
-  this->m_ClassCategory = "BasicObject";
 }
 
 // -------------------------------------------------------------------------
index 2a9fc916e17045d4be9fffc5e177332056ade156..b84ad3ed6dd956fd02b9895f39b66931859e8a71 100644 (file)
@@ -35,6 +35,9 @@ namespace cpPlugins
 
     public:
       itkTypeMacro( ProcessObject, Object );
+      cpPlugins_Id_Macro(
+        cpPlugins::Interface::ProcessObject, "BaseObject"
+        );
 
     public:
       virtual const Parameters& GetDefaultParameters( ) const;
index 1a257a68ef346a0f46962f676c5537b7c2fccf5f..10704aac29d1681c8abf57d9bd31b68d396ff5dd 100644 (file)
@@ -8,8 +8,6 @@ cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 BinaryThresholdImageFilter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BasicFilters::BinaryThresholdImageFilter";
-  this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
index 4658f9d23f094dd43bf8174d33e2ce650088bbc0..7bfa56c9812c27d23e5cf61d4b6ac18caeff8c2d 100644 (file)
@@ -25,6 +25,10 @@ namespace cpPlugins
         BinaryThresholdImageFilter,
         cpPluginsInterfaceImageToImageFilter
         );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::BinaryThresholdImageFilter,
+        "ImageToImageFilter"
+        );
 
     protected:
       BinaryThresholdImageFilter( );
index c6ac99f17294d97d590d1cb96054a25b0576e8c2..e0c80b40a7df160cf1741129105f833961058485 100644 (file)
@@ -13,9 +13,6 @@ cpPlugins::BasicFilters::Cutter::
 Cutter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BasicFilters::Cutter";
-  this->m_ClassCategory = "MeshToMeshFilter";
-
   this->SetNumberOfInputs( 2 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
index 52438a723b4fe7ee750984889ceeb16eee58a937..8374bbcb69b1516d87a2f7d5dd8b16e32b4513a7 100644 (file)
@@ -22,6 +22,10 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( Cutter, cpPluginsInterfaceMeshToMeshFilter );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::Cutter,
+        "MeshToMeshFilter"
+        );
 
     protected:
       Cutter( );
index 378c5e2f0d176c3fe4e449be0ae0078645a1257b..88b3152d1ee997153445763ead1cebe47f964e61 100644 (file)
@@ -8,8 +8,6 @@ cpPlugins::BasicFilters::ExtractSliceImageFilter::
 ExtractSliceImageFilter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BasicFilters::ExtractSliceImageFilter";
-  this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
index a18e9924c1df2982515213e2fa352920e4cb4a40..39414ebbf77817ab130d895bef76e89f1ccb320c 100644 (file)
@@ -24,6 +24,10 @@ namespace cpPlugins
       itkTypeMacro(
         ExtractSliceImageFilter, cpPluginsInterfaceImageToImageFilter
         );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::ExtractSliceImageFilter,
+        "ImageToImageFilter"
+        );
 
     protected:
       ExtractSliceImageFilter( );
index cca186c79f44bc03ebeefc8733a4d247f2203bd5..92538607d9b5b98cf2ab446b298bc5157f4e3bca 100644 (file)
@@ -11,9 +11,6 @@ cpPlugins::BasicFilters::MarchingCubes::
 MarchingCubes( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BasicFilters::MarchingCubes";
-  this->m_ClassCategory = "ImageToMeshFilter";
-
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
index 3f9c22d6022f5cf57f5f14bb3012d26ca081b28a..2e664e5a3631fc869d8c61a1d2da91e29bc9c57b 100644 (file)
@@ -22,6 +22,9 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( MarchingCubes, cpPluginsInterfaceImageToMeshFilter );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::MarchingCubes, "ImageToMeshFilter"
+        );
 
     protected:
       MarchingCubes( );
index df145b871727f5af048b248a6dff02e86d3f2477..083c6b92f83799799f174e2b1a249aaa8b1499fd 100644 (file)
@@ -8,8 +8,6 @@ cpPlugins::BasicFilters::MedianImageFilter::
 MedianImageFilter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BasicFilters::MedianImageFilter";
-  this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
index ea2bb61031b92b58f0b081d15e6ba56e078f2856..1e491e79a989dff88a1cf2b9bcccffb6fe427cb5 100644 (file)
@@ -25,6 +25,10 @@ namespace cpPlugins
         MedianImageFilter,
         cpPluginsInterfaceImageToImageFilter
         );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::MedianImageFilter,
+        "ImageToImageFilter"
+        );
 
     protected:
       MedianImageFilter( );
index de924a67b9da78b90c68a2de89ef1984a8cf2a84..59f98f5778f5b614b7880225a05ec4a7d70031c2 100644 (file)
@@ -8,8 +8,6 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 OtsuThresholdImageFilter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BasicFilters::OtsuThresholdImageFilter";
-  this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
index b717062f980f76e0b3326c4e658e362f2728fb16..5f216dd01fb98747fe27bd4a10bee457a00b133e 100644 (file)
@@ -25,6 +25,10 @@ namespace cpPlugins
         OtsuThresholdImageFilter,
         cpPluginsInterfaceImageToImageFilter
         );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::OtsuThresholdImageFilter,
+        "ImageToImageFilter"
+        );
 
     protected:
       OtsuThresholdImageFilter( );
index 38cec311f0dde0506660f91708a626f2c6635e5a..5282f602b4f44f439e55216dc88dd27286d5cc52 100644 (file)
@@ -13,8 +13,6 @@ RGBImageToOtherChannelsFilter( )
 {
   typedef cpPlugins::Interface::Parameters TParameters;
 
-  this->m_ClassName = "cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter";
-  this->m_ClassCategory = "ImageToImageFilter";
   this->SetNumberOfInputs( 1 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
index bb559c8d5753eeb898cd429bf7e8e1149f3e8c54..4a42a5dc4041c347117f61fdc325f58688ad6204 100644 (file)
@@ -25,6 +25,10 @@ namespace cpPlugins
         RGBImageToOtherChannelsFilter,
         cpPluginsInterfaceImageToImageFilter
         );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter,
+        "ImageToImageFilter"
+        );
 
     protected:
       RGBImageToOtherChannelsFilter( );
index 61a330e1c218598331578ed6c28d85fd7281b6ae..8ba50cc7459a0a0aaccf21a01a3c817f8f73fa80 100644 (file)
@@ -10,9 +10,6 @@ cpPlugins::BasicFilters::SphereMeshSource::
 SphereMeshSource( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BasicFilters::SphereMeshSource";
-  this->m_ClassCategory = "MeshSource";
-
   this->SetNumberOfInputs( 0 );
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
index 6ea0aaebcd44aa7f832b479a5fb5dbfd8f995eb2..5789134e7fbb5a3c9e4316a3694d9b1256bad1f7 100644 (file)
@@ -22,6 +22,9 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( SphereMeshSource, cpPluginsInterfaceMeshSource );
+      cpPlugins_Id_Macro(
+        cpPlugins::BasicFilters::SphereMeshSource, "MeshSource"
+        );
 
     protected:
       SphereMeshSource( );
index fec094476ad212fc25a3b08bf0c4eca793dc745c..64bec97ee509f757048622affe663c5896f4d9f4 100644 (file)
@@ -47,9 +47,6 @@ cpPlugins::IO::ImageReader::
 ImageReader( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::IO::ImageReader";
-  this->m_ClassCategory = "ImageReader";
-
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
 
index aeee9fa5007c2cb187181303a9d74d270f4bdc41..97937621cee4d7700e0d7b54dbea60fe954f08ce 100644 (file)
@@ -33,6 +33,9 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( ImageReader, cpPluginsInterfaceImageSource );
+      cpPlugins_Id_Macro(
+        cpPlugins::IO::ImageReader, "ImageReader"
+        );
 
     public:
       virtual bool ExecConfigurationDialog( QWidget* parent );
index ba9417324d4f394d4e8c552a0ef6bef94bd7f105..c2b9b8a9795f461d8547968c7d76d63320249d36 100644 (file)
@@ -8,8 +8,6 @@ cpPlugins::IO::ImageWriter::
 ImageWriter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::IO::ImageWriter";
-  this->m_ClassCategory = "ImageWriter";
   this->SetNumberOfInputs( 1 );
 
   using namespace cpPlugins::Interface;
index 9c3b0ceebaadfb50c4093acdd5af8838fd3cb1b9..2d72067f71ba231dcdf2f3b79eca37473a7ad2cc 100644 (file)
@@ -22,6 +22,9 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( ImageWriter, cpPluginsInterfaceImageSink );
+      cpPlugins_Id_Macro(
+        cpPlugins::IO::ImageWriter, "ImageWriter"
+        );
 
     protected:
       ImageWriter( );
index 2585a734eb73e16b4be5c45489a61737ccab9483..fe61d707532d52b9b91f5ab724f6330d39ac026a 100644 (file)
@@ -48,9 +48,6 @@ cpPlugins::IO::MeshReader::
 MeshReader( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::IO::MeshReader";
-  this->m_ClassCategory = "MeshReader";
-
   this->SetNumberOfOutputs( 1 );
   this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
 
index 5f721d203c47935ac9344333e6719fc0b9a013d7..7544a243436aa5a3953d75b8e96e2a16b887e5be 100644 (file)
@@ -24,6 +24,9 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( MeshReader, cpPluginsInterfaceMeshSource );
+      cpPlugins_Id_Macro(
+        cpPlugins::IO::MeshReader, "MeshReader"
+        );
 
     public:
       virtual bool ExecConfigurationDialog( QWidget* parent );
index ee8b6668d904bb2402036b89bf80d06406df4baa..805ca0ee04b9ef0264bbeb197232654865ba6c13 100644 (file)
@@ -10,8 +10,6 @@ cpPlugins::IO::MeshWriter::
 MeshWriter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::IO::MeshWriter";
-  this->m_ClassCategory = "MeshWriter";
   this->SetNumberOfInputs( 1 );
 
   using namespace cpPlugins::Interface;
index db13601e8739362b78e76a392f2a053804f78d69..9def1356b31c11b7f2ae7ad3f08093a45d485489 100644 (file)
@@ -24,6 +24,9 @@ namespace cpPlugins
     public:
       itkNewMacro( Self );
       itkTypeMacro( MeshWriter, cpPluginsInterfaceMeshSink );
+      cpPlugins_Id_Macro(
+        cpPlugins::IO::MeshWriter, "MeshWriter"
+        );
 
     protected:
       MeshWriter( );