From 755e53bc4442c6486fafda0e51395f87624ee2b2 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 7 Nov 2013 15:23:50 +0100 Subject: [PATCH] 2164 creaVtk Feature New Normal new outputs for the vtkPlaneWidget (center and normal) --- bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx | 2 ++ bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h | 9 +++++ lib/creaVtk/creaVtkPlaneWidget.cpp | 33 +++++++++++++++++-- lib/creaVtk/creaVtkPlaneWidget.h | 2 ++ 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx index 0234624..071fd02 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx @@ -48,6 +48,8 @@ void PlaneWidget::Process() _boxcreavtkplanewidget.SetRenderer( bbGetInputRenderer() ); _boxcreavtkplanewidget.Process(); bbSetOutputOut( _boxcreavtkplanewidget.GetPlaneSource()->GetOutput() ); + bbSetOutputCenter( _boxcreavtkplanewidget.GetCenter() ); + bbSetOutputCenter( _boxcreavtkplanewidget.GetNormal() ); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h index 0117074..08b6413 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h @@ -41,6 +41,8 @@ class bbcreaVtk_EXPORT PlaneWidget BBTK_DECLARE_INPUT(Resolution,int); BBTK_DECLARE_INPUT(Renderer,vtkRenderer*); BBTK_DECLARE_OUTPUT(Out,vtkDataSet*); + BBTK_DECLARE_OUTPUT(Center,std::vector); + BBTK_DECLARE_OUTPUT(Normal,std::vector); BBTK_PROCESS(Process); void Process(); @@ -56,13 +58,20 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneWidget,bbtk::AtomicBlackBox); BBTK_NAME("PlaneWidget"); BBTK_AUTHOR("ED at Info-Dev Creatis"); BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(PlaneWidget,Active,"Active widget (false default)",bool,""); BBTK_INPUT(PlaneWidget,In,"Reference Image",vtkImageData*,""); BBTK_INPUT(PlaneWidget,Resolution,"Resolution (60 default)",int,""); BBTK_INPUT(PlaneWidget,Renderer,"vtkRenderer",vtkRenderer*,""); + BBTK_OUTPUT(PlaneWidget,Out,"Dynamic plane result from vtkPlaneSource",vtkDataSet*,""); + BBTK_OUTPUT(PlaneWidget,Center,"Center of the plane",std::vector,""); + BBTK_OUTPUT(PlaneWidget,Normal,"Normal of the plane",std::vector,""); + BBTK_END_DESCRIBE_BLACK_BOX(PlaneWidget); + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== diff --git a/lib/creaVtk/creaVtkPlaneWidget.cpp b/lib/creaVtk/creaVtkPlaneWidget.cpp index f770d77..0cb5eea 100644 --- a/lib/creaVtk/creaVtkPlaneWidget.cpp +++ b/lib/creaVtk/creaVtkPlaneWidget.cpp @@ -113,10 +113,36 @@ int creaVtkPlaneWidget::GetResolution() return _resolution; } + + +//------------------------------------------------------------------------ +std::vector creaVtkPlaneWidget::GetCenter() +{ + std::vector vecCenter; + double point[3]; + _vPlaneWidget->GetCenter(point); + vecCenter.push_back(point[0]); + vecCenter.push_back(point[1]); + vecCenter.push_back(point[2]); + return vecCenter; +} + +//------------------------------------------------------------------------ +std::vector creaVtkPlaneWidget::GetNormal() +{ + std::vector vecNormal; + double point[3]; + _vPlaneWidget->GetNormal(point); + vecNormal.push_back(point[0]); + vecNormal.push_back(point[1]); + vecNormal.push_back(point[2]); + return vecNormal; +} + + //------------------------------------------------------------------------ void creaVtkPlaneWidget::Process() { -printf("EED creaVtkPlaneWidget::Process Start\n"); if ((GetActive()==true) && (GetRenderer()!=NULL)) { _vPlaneWidget->SetInput( GetImage() ); @@ -137,14 +163,15 @@ printf("EED creaVtkPlaneWidget::Process Start\n"); _vPlaneWidget->AddObserver( vtkCommand::StartInteractionEvent , creavtkcallbackplanewidget ); _vPlaneWidget->AddObserver( vtkCommand::EnableEvent , creavtkcallbackplanewidget ); } -printf("EED creaVtkPlaneWidget::Process up\n"); UpdatePlane(); } else { _vPlaneWidget->Off(); } -printf("EED creaVtkPlaneWidget::Process End\n"); } + + + //------------------------------------------------------------------------ void creaVtkPlaneWidget::UpdatePlane() { diff --git a/lib/creaVtk/creaVtkPlaneWidget.h b/lib/creaVtk/creaVtkPlaneWidget.h index 8adb38e..b0ef2fd 100644 --- a/lib/creaVtk/creaVtkPlaneWidget.h +++ b/lib/creaVtk/creaVtkPlaneWidget.h @@ -78,6 +78,8 @@ public : vtkPlaneSource* GetPlaneSource(); void SetResolution(int resolution); int GetResolution(); + std::vector GetCenter(); + std::vector GetNormal(); void Process(); void UpdatePlane(); -- 2.47.1