]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 29 Oct 2015 19:13:47 +0000 (14:13 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 29 Oct 2015 19:13:47 +0000 (14:13 -0500)
lib/cpExtensions/Interaction/ImageInteractorStyle.h
lib/cpPlugins/Interface/BaseMPRWidget.cxx

index 7664c137ff1b943d36e6659830276d7b1a66fd2f..99c0c1f9ff96610b778b94801cd876597aab4118 100644 (file)
@@ -6,7 +6,11 @@
 #include <vector>
 
 #include <vtkSmartPointer.h>
+#include <vtkImageActorPointPlacer.h>
 #include <vtkPropPicker.h>
+#include <vtkPointHandleRepresentation3D.h>
+#include <vtkSeedRepresentation.h>
+#include <cpExtensions/Interaction/SeedWidget.h>
 
 // Forward definitions
 class vtkImageActor;
@@ -37,6 +41,41 @@ namespace cpExtensions
       typedef Superclass::TEnterCommand            TEnterCommand;
       typedef Superclass::TLeaveCommand            TLeaveCommand;
 
+      // Widgets
+      struct TSeedWidget
+      {
+        vtkSmartPointer< vtkImageActorPointPlacer >       Placer;
+        vtkSmartPointer< vtkPointHandleRepresentation3D > Handle;
+        vtkSmartPointer< vtkSeedRepresentation >  Representation;
+        vtkSmartPointer< TSeedWidget >                    Widget;
+
+        TSeedWidget( vtkRenderWindowInteractor* interactor, vtkImageActor* actor )
+          {
+            this->Placer = vtkSmartPointer< vtkImageActorPointPlacer >::New( );
+            this->Handle = vtkSmartPointer< vtkPointHandleRepresentation3D >::New( );
+            this->Representation = vtkSmartPointer< vtkSeedRepresentation >::New( );
+            this->Widget = vtkSmartPointer< TSeedWidget >::New( );
+
+            this->Placer->SetImageActor( actor );
+            this->Handle->GetProperty( )->SetColor( 1, 0, 0 );
+            this->Handle->SetPointPlacer( this->Placer );
+            this->Representation->SetHandleRepresentation( this->Handle );
+            this->Widget->SetRepresentation( this->Representation );
+            this->Widget->SetInteractor( interactor );
+          }
+
+        void On( )
+          {
+            this->Widget->On( );
+          }
+
+        void Off( )
+          {
+            this->Widget->Off( );
+          }
+#error ACA VOY
+      };
+
     public:
       static Self* New( );
 
index 88e3b894ecb483567e2a5bfe7fb1f07dafdaaee3..2dde30b59e5f12e62a48d3ad5725cb8c281a8249 100644 (file)
@@ -84,13 +84,18 @@ ShowImage(
   const double& r, const double& g, const double& b
   )
 {
-  std::cout
-    << "BaseMPRWidget: "
-    << image << " "
-    << name << " "
-    << parent << " "
-    << r << " " << g << " " << b << std::endl;
-  return( false );
+  // Update tree view
+  QTreeWidgetItem* new_item = this->_UpdateItem( name, parent );
+  if( new_item == NULL )
+    return( false );
+
+  // Associate new data
+  this->m_Images[ name ] = image;
+  this->m_Tree[ name ] = parent;
+
+  // Show image and return
+  this->m_MPRObjects->AddImage( image );
+  return( true );
 }
 
 // -------------------------------------------------------------------------