]> Creatis software - creaVtk.git/commitdiff
#3474 PlaneWidget Box with representation:Wireframe and resolution
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 18 Nov 2021 13:41:45 +0000 (14:41 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 18 Nov 2021 13:41:45 +0000 (14:41 +0100)
bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h
lib/creaVtk/creaVtkPlaneWidget.cpp
lib/creaVtk/creaVtkPlaneWidget.h

index 91de0a69b588b68b6c2c4bf8d7f404a23116700a..41007234e9250e6e0d67f9e295301ca9187b7daf 100644 (file)
@@ -44,6 +44,8 @@ void PlaneWidget::Process()
 //    * TYPE is the C++ type of the input/output
 //      (the one provided in the attribute 'type' of the tag 'input')
 
+printf("EED void PlaneWidget::Process Start\n");
+
        if ((bbGetInputIn()==NULL) || (bbGetInputRenderer()==NULL))
        {
                bbSetOutputOut( NULL );
@@ -56,11 +58,17 @@ void PlaneWidget::Process()
                _boxcreavtkplanewidget.SetImage( bbGetInputIn() );
                _boxcreavtkplanewidget.SetResolution( bbGetInputResolution() );
                _boxcreavtkplanewidget.SetRenderer( bbGetInputRenderer() );
+               _boxcreavtkplanewidget.SetRepresentation( bbGetInputRepresentation() );
+printf("EED void PlaneWidget::Process 1\n");
                _boxcreavtkplanewidget.Process();
+printf("EED void PlaneWidget::Process 2\n");
+               
                bbSetOutputOut( _boxcreavtkplanewidget.GetPlaneSource()->GetOutput() );
                bbSetOutputCenter( _boxcreavtkplanewidget.GetCenter() );
                bbSetOutputNormal( _boxcreavtkplanewidget.GetNormal() );
        }
+printf("EED void PlaneWidget::Process End\n");
+       
 }
 //===== 
 // 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)
@@ -74,6 +82,7 @@ void PlaneWidget::bbUserSetDefaultValues()
    bbSetInputActive(false);
    bbSetInputIn(NULL);
    bbSetInputResolution(60);
+   bbSetInputRepresentation(1);
    bbSetInputRenderer(NULL);
    bbSetOutputOut(NULL);
    _boxcreavtkplanewidget.box = this;
@@ -103,7 +112,7 @@ void PlaneWidget::bbUserFinalizeProcessing()
 //    if any
   
 }
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 08b6413f819c1ceab072fda17eee37ed1f7a8e6e..02dcce08743fa91ffeda33a59d7d2798953f5d56 100644 (file)
@@ -40,6 +40,7 @@ class bbcreaVtk_EXPORT PlaneWidget
   BBTK_DECLARE_INPUT(In,vtkImageData*);
   BBTK_DECLARE_INPUT(Resolution,int);
   BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+  BBTK_DECLARE_INPUT(Representation,int);
   BBTK_DECLARE_OUTPUT(Out,vtkDataSet*);
   BBTK_DECLARE_OUTPUT(Center,std::vector<double>);
   BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
@@ -65,6 +66,7 @@ BBTK_CATEGORY("empty");
   BBTK_INPUT(PlaneWidget,In,"Reference Image",vtkImageData*,"");
   BBTK_INPUT(PlaneWidget,Resolution,"Resolution (60 default)",int,"");
   BBTK_INPUT(PlaneWidget,Renderer,"vtkRenderer",vtkRenderer*,"");
+  BBTK_INPUT(PlaneWidget,Representation,"(default 1) 0:OutLine 1:Wireframe 2:Surface",int,"");
 
   BBTK_OUTPUT(PlaneWidget,Out,"Dynamic plane result from vtkPlaneSource",vtkDataSet*,"");
   BBTK_OUTPUT(PlaneWidget,Center,"Center of the plane",std::vector<double>,"");
index 76af319eed93e38ad28984905625250d0e3d5413..609d425d34cfc8fe47cd95472cd2fdbc2a01a442 100644 (file)
@@ -48,7 +48,8 @@ void creaVtkCallbackPlaneWidget::Execute(vtkObject *caller, unsigned long, void*
 //------------------------------------------------------------------------
 creaVtkPlaneWidget::creaVtkPlaneWidget()
 {
-       _firsttime      = true;
+       _firsttime              = true;
+       _representation = 1;
        _vPlaneWidget   = vtkPlaneWidget::New();
        _vPlaneSource   = vtkPlaneSource::New();
 }
@@ -114,6 +115,19 @@ int creaVtkPlaneWidget::GetResolution()
 }
 
 
+//------------------------------------------------------------------------
+void creaVtkPlaneWidget::SetRepresentation(int representation)
+{
+       _representation = representation;
+}
+
+//------------------------------------------------------------------------
+int creaVtkPlaneWidget::GetRepresentation()
+{
+       return _representation;
+}
+
+
 
 //------------------------------------------------------------------------
 std::vector<double> creaVtkPlaneWidget::GetCenter()
@@ -152,13 +166,15 @@ void creaVtkPlaneWidget::Process()
 #else
        _vPlaneWidget->SetInputData( GetImage() );
 #endif
-
        _vPlaneWidget->SetInteractor( GetRenderer()->GetRenderWindow()->GetInteractor() );
        _vPlaneWidget->NormalToXAxisOn();
        _vPlaneWidget->NormalToZAxisOn();
-       _vPlaneWidget->SetResolution(10);
-       _vPlaneWidget->SetRepresentationToOutline();
+       _vPlaneWidget->SetResolution(_resolution);
+       if (_representation==0){ _vPlaneWidget->SetRepresentationToOutline();   }
+       if (_representation==1){ _vPlaneWidget->SetRepresentationToWireframe(); }
+       if (_representation==2){ _vPlaneWidget->SetRepresentationToSurface();   }
        _vPlaneWidget->SetPlaceFactor(1); //defini zoom initial
+       _vPlaneWidget->SetHandleSize(0.5); 
        _vPlaneWidget->On();
        if (_firsttime==true )  
        { 
index b0ef2fd2120379c4aa63eaa4c8690ed977695787..2e87e48d9c6c82a6fcd6d3b0010175ff0997b199 100644 (file)
@@ -78,6 +78,8 @@ public :
   vtkPlaneSource* GetPlaneSource();
   void                   SetResolution(int resolution);
   int            GetResolution();
+  void                   SetRepresentation(int represtation);
+  int            GetRepresentation();
   std::vector<double> GetCenter();
   std::vector<double> GetNormal();
 
@@ -101,6 +103,7 @@ private:
        vtkImageData    *_image;
        vtkRenderer     *_renderer;
        int             _resolution;
+       int             _representation;
 
        vtkPlaneWidget *_vPlaneWidget;
         vtkPlaneSource *_vPlaneSource;