]> Creatis software - creaVtk.git/commitdiff
2164 creaVtk Feature New Normal new outputs for the vtkPlaneWidget (center and normal)
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 7 Nov 2013 14:23:50 +0000 (15:23 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 7 Nov 2013 14:23:50 +0000 (15:23 +0100)
bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h
lib/creaVtk/creaVtkPlaneWidget.cpp
lib/creaVtk/creaVtkPlaneWidget.h

index 02346246ffdb896c345c8070088a97de28e55b1f..071fd0284450f943fb44c04e640dfdb8b2e4e0d2 100644 (file)
@@ -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)
index 0117074198725a8192d8308a56dcbbc65f8e8780..08b6413f819c1ceab072fda17eee37ed1f7a8e6e 100644 (file)
@@ -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<double>);
+  BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
   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<double>,"");
+  BBTK_OUTPUT(PlaneWidget,Normal,"Normal of the plane",std::vector<double>,"");
+
 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)
 //===== 
index f770d77d865f83d2f2fdcee6bf774dccc32b942e..0cb5eea303d3985e2d2e5ec43c587b0de07d91b0 100644 (file)
@@ -113,10 +113,36 @@ int creaVtkPlaneWidget::GetResolution()
        return _resolution;
 }
 
+
+
+//------------------------------------------------------------------------
+std::vector<double> creaVtkPlaneWidget::GetCenter()
+{
+       std::vector<double> 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<double> creaVtkPlaneWidget::GetNormal()
+{
+       std::vector<double> 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()
 {
index 8adb38e27a88c6e05c9812190e8f564aaaa76b3b..b0ef2fd2120379c4aa63eaa4c8690ed977695787 100644 (file)
@@ -78,6 +78,8 @@ public :
   vtkPlaneSource* GetPlaneSource();
   void                   SetResolution(int resolution);
   int            GetResolution();
+  std::vector<double> GetCenter();
+  std::vector<double> GetNormal();
 
   void                   Process();
   void                   UpdatePlane();