From 7972cb1b826dfeae18ed20fc33897c366a72e4c1 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Thu, 29 Oct 2015 14:13:47 -0500 Subject: [PATCH] ... --- .../Interaction/ImageInteractorStyle.h | 39 +++++++++++++++++++ lib/cpPlugins/Interface/BaseMPRWidget.cxx | 19 +++++---- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/lib/cpExtensions/Interaction/ImageInteractorStyle.h b/lib/cpExtensions/Interaction/ImageInteractorStyle.h index 7664c13..99c0c1f 100644 --- a/lib/cpExtensions/Interaction/ImageInteractorStyle.h +++ b/lib/cpExtensions/Interaction/ImageInteractorStyle.h @@ -6,7 +6,11 @@ #include #include +#include #include +#include +#include +#include // 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( ); diff --git a/lib/cpPlugins/Interface/BaseMPRWidget.cxx b/lib/cpPlugins/Interface/BaseMPRWidget.cxx index 88e3b89..2dde30b 100644 --- a/lib/cpPlugins/Interface/BaseMPRWidget.cxx +++ b/lib/cpPlugins/Interface/BaseMPRWidget.cxx @@ -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 ); } // ------------------------------------------------------------------------- -- 2.47.1