]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Fri, 30 Sep 2016 22:54:18 +0000 (17:54 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Fri, 30 Sep 2016 22:54:18 +0000 (17:54 -0500)
plugins/Widgets/SeedWidget.cxx
plugins/Widgets/SeedWidget.h

index 2b11821b4189fab71521836e7cb128a12bf9dab9..91d10a139204f3cc4181d4b4b06f20761a7cfd38 100644 (file)
@@ -11,6 +11,7 @@
 #include <vtkRenderWindow.h>
 #include <vtkRenderWindowInteractor.h>
 #include <cpExtensions/QT/SimpleMPRWidget.h>
+#include <cpExtensions/Interaction/SeedWidget.h>
 
 // -------------------------------------------------------------------------
 // This callback is responsible for changing update time
@@ -26,27 +27,35 @@ namespace cpPluginsWidgets
       { return( new SeedWidgetCallback ); }
     virtual void Execute( vtkObject* caller, unsigned long id, void* data )
       {
-        /* TODO
-          typedef cpPluginsWidgets::SeedWidget::TImageActor _TImageActor;
-          auto actor = dynamic_cast< _TImageActor* >( caller );
-        */
-        /* TODO
-           if( id == vtkCommand::InteractionEvent && actor != NULL )
-           {
-           int slice = actor->GetSliceNumber( );
-           if( this->Data->ActualWidgetId != slice )
-           {
-           this->Data->Widgets[ this->Data->ActualWidgetId ]->EnabledOff( );
-           this->Data->Widgets[ slice ]->EnabledOn( );
-           this->Data->ActualWidgetId = slice;
-           } // fi
-           }
-           else
-        */
-        //       id == vtkCommand::CursorChangedEvent ||
-        if( id == vtkCommand::PlacePointEvent )
+        if( id == vtkCommand::InteractionEvent )
         {
-          auto wdg = dynamic_cast< cpExtensions::Interaction::SeedWidget* >( caller );
+          std::cout << id << std::endl;
+          auto actor = dynamic_cast< SeedWidget::TImageActor* >( caller );
+          if( actor != NULL )
+          {
+            int slice = actor->GetSliceNumber( );
+
+            std::cout << slice << std::endl;
+
+          } // fi
+          /* TODO
+             typedef cpPluginsWidgets::SeedWidget::TImageActor _TImageActor;
+          */
+          /* TODO
+             if( this->Data->ActualWidgetId != slice )
+             {
+             this->Data->Widgets[ this->Data->ActualWidgetId ]->EnabledOff( );
+             this->Data->Widgets[ slice ]->EnabledOn( );
+             this->Data->ActualWidgetId = slice;
+             } // fi
+             }
+             else
+          */
+        }
+        else if( id == vtkCommand::PlacePointEvent )
+        {
+          // TODO: id == vtkCommand::CursorChangedEvent ||
+          auto wdg = dynamic_cast< SeedWidget::TWidget* >( caller );
           if( wdg != NULL )
           {
             auto rep =
@@ -320,14 +329,18 @@ _GD0_Image( vtkImageData* image )
             }
 
           } // elihw
+
         } // elihw
 
       } // fi
       if( all_props.size( ) == 1 )
       {
         this->m_Data[ *inIt ] =
-          new TWidgetData( this, *( all_props.begin( ) ), *inIt, this->m_Command );
-      }
+          new TWidgetData(
+            this, *( all_props.begin( ) ), *inIt, this->m_Command
+            );
+
+      } // fi
 
     } // rof
   }
@@ -348,13 +361,13 @@ TWidgetData(
   )
 {
   auto cb = dynamic_cast< SeedWidgetCallback* >( cmd );
-/*
-  auto cb = vtkSmartPointer< SeedWidgetCallback >::New( );
-  cb->Widget = seedWidget;
-  cb->Data = this;
-  this->Command = cb;
   actor->AddObserver( vtkCommand::InteractionEvent, cb );
-*/
+  /* TODO
+     auto cb = vtkSmartPointer< SeedWidgetCallback >::New( );
+     cb->Widget = seedWidget;
+     cb->Data = this;
+     this->Command = cb;
+  */
   /* TODO
      auto image = actor->GetImage( );
      int ori = actor->GetOrientation( );
@@ -366,7 +379,7 @@ TWidgetData(
   this->Placer = vtkSmartPointer< _TPlacer >::New( );
   this->Handle = vtkSmartPointer< vtkPointHandleRepresentation3D >::New( );
   this->Representation = vtkSmartPointer< vtkSeedRepresentation >::New( );
-  this->Widget = vtkSmartPointer< _TWidget >::New( );
+  this->Widget = vtkSmartPointer< TWidget >::New( );
 
   this->Placer->SetImageSlice( actor );
   this->Handle->GetProperty( )->SetColor( 1, 0, 0 );
@@ -410,7 +423,7 @@ TWidgetData(
      auto placer = vtkSmartPointer< _TPlacer >::New( );
      auto handle = vtkSmartPointer< vtkPointHandleRepresentation3D >::New( );
      auto rep = vtkSmartPointer< vtkSeedRepresentation >::New( );
-     auto wdg = vtkSmartPointer< _TWidget >::New( );
+     auto wdg = vtkSmartPointer< TWidget >::New( );
 
      placer->SetImageSlice( actor );
      handle->GetProperty( )->SetColor( 1, 0, 0 );
index 94101deed344b61986089c1fead42ca166c61c11..0f565969d7e7b93af06f64985d189d4a1cdadd0c 100644 (file)
@@ -4,7 +4,6 @@
 #include <plugins/cpPluginsWidgets_Export.h>
 #include <cpPlugins/BaseObjects/Widget.h>
 
-#include <cpExtensions/Interaction/SeedWidget.h>
 #include <cpExtensions/Interaction/ImageSlicePointPlacer.h>
 #include <cpExtensions/Visualization/WindowLevelImageActor.h>
 #include <vtkImageSlice.h>
 #include <vtkSmartPointer.h>
 #include <map>
 
+// -------------------------------------------------------------------------
+namespace cpExtensions { namespace Interaction { class SeedWidget; } }
+
+// -------------------------------------------------------------------------
 namespace cpPluginsWidgets
 {
   /**
@@ -23,6 +26,7 @@ namespace cpPluginsWidgets
     cpPluginsObject( SeedWidget, cpPlugins::BaseObjects::Widget, Widgets );
 
   public:
+    typedef cpExtensions::Interaction::SeedWidget              TWidget;
     typedef cpExtensions::Visualization::WindowLevelImageActor TImageActor;
 
   public:
@@ -50,10 +54,9 @@ namespace cpPluginsWidgets
 
     struct TWidgetData
     {
-      typedef cpExtensions::Interaction::SeedWidget            _TWidget;
       typedef cpExtensions::Interaction::ImageSlicePointPlacer _TPlacer;
 
-      vtkSmartPointer< _TWidget >                       Widget;
+      vtkSmartPointer< TWidget >                        Widget;
       vtkSmartPointer< _TPlacer >                       Placer;
       vtkSmartPointer< vtkPointHandleRepresentation3D > Handle;
       vtkSmartPointer< vtkSeedRepresentation >  Representation;