]> Creatis software - creaVtk.git/commitdiff
#3465 cutter box
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 7 Jul 2021 09:31:27 +0000 (11:31 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 7 Jul 2021 09:31:27 +0000 (11:31 +0200)
bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbg
bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbs
bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkCutter.h
bbtk_creaVtk_PKG/src/bbcreaVtkPlane.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkPlane.h [new file with mode: 0644]

index fd6b66d2ea4f987ac7649d6191cb9677328cfc6d..871409824d54792f4483dc010411b035c6d28aff 100644 (file)
@@ -13,14 +13,14 @@ BOXES:10
 BOX
 creaVtk:Cutter:Box00
 ISEXEC:FALSE
--226.539144:46.310533:-900.000000
--194.339144:36.310533:-900.000000
+-145.723171:32.668251:-900.000000
+-113.523171:22.668251:-900.000000
 FIN_BOX
 BOX
 vtk:SphereSource:Box01
 ISEXEC:FALSE
--177.440184:69.250364:-900.000000
--137.615184:59.250364:-900.000000
+-111.028659:69.110634:-900.000000
+-71.203659:59.110634:-900.000000
 PORT
 CenterX:"0"
 PORT
@@ -37,23 +37,21 @@ FIN_BOX
 BOX
 creaMaracasVisu:ViewerNV:Box02
 ISEXEC:FALSE
-31.452292:22.917500:-900.000000
-95.172292:12.917500:-900.000000
-FIN_BOX
-BOX
-vtk:LoadHola:Box03
-ISEXEC:FALSE
-67.171981:67.171981:-900.000000
-102.721981:57.171981:-900.000000
+-39.027712:25.464030:-900.000000
+24.692288:15.464030:-900.000000
+PORT
+nTypeView:"7"
 FIN_BOX
 BOX
 vtk:PolyDataToActor:Box04
 ISEXEC:FALSE
--147.306444:-1.305431:-900.000000
--102.066444:-11.305431:-900.000000
+-160.865702:-7.231106:-900.000000
+-115.625702:-17.231106:-900.000000
 PORT
 Colour:"1 0 0"
 PORT
+LineWidth:"2"
+PORT
 Opacity:"1"
 PORT
 Representation:"1"
@@ -61,22 +59,16 @@ FIN_BOX
 BOX
 wx:LayoutSplit:Box05
 ISEXEC:TRUE
--28.011797:-111.715695:-900.000000
-11.068203:-121.715695:-900.000000
+-85.277640:-110.429457:-900.000000
+-46.197640:-120.429457:-900.000000
 PORT
 Orientation:"H"
 FIN_BOX
 BOX
-wx:LayoutLine:Box07
-ISEXEC:FALSE
--135.789124:-72.766127:-900.000000
--78.229124:-82.766127:-900.000000
-FIN_BOX
-BOX
 vtk:PolyDataToActor:Box09
 ISEXEC:FALSE
--74.693411:-18.608435:-900.000000
--29.453411:-28.608435:-900.000000
+-118.071022:-28.000184:-900.000000
+-72.831022:-38.000184:-900.000000
 PORT
 Opacity:"0.2"
 PORT
@@ -85,24 +77,37 @@ FIN_BOX
 BOX
 vtk:UpdateRender:Box13
 ISEXEC:FALSE
--64.894456:-60.049950:-900.000000
--24.569456:-70.049950:-900.000000
+-86.780672:-58.548149:-900.000000
+-46.455672:-68.548149:-900.000000
 PORT
 Active:"true"
 FIN_BOX
 BOX
 wx:CommandButton:Box15
 ISEXEC:FALSE
--77.543946:52.017647:-900.000000
--34.768946:42.017647:-900.000000
+-191.766922:14.485134:-900.000000
+-148.991922:4.485134:-900.000000
 PORT
 Label:"Refresh"
 FIN_BOX
+BOX
+creaVtk:Plane:Box10
+ISEXEC:FALSE
+-159.787919:55.095091:-900.000000
+-128.062919:45.095091:-900.000000
+PORT
+Normal:"0 0 1"
+PORT
+Origin:"0 0 30"
+FIN_BOX
+BOX
+vtk:LoadHola:Box11
+ISEXEC:FALSE
+-22.628739:43.735282:-900.000000
+12.921261:33.735282:-900.000000
+FIN_BOX
 CONNECTIONS:13
 CONNECTION
-Box03:Out:Box02:In
-NumberOfControlPoints:0
-CONNECTION
 Box00:Out:Box04:In
 NumberOfControlPoints:0
 CONNECTION
@@ -112,9 +117,6 @@ CONNECTION
 Box02:Widget:Box05:Widget2
 NumberOfControlPoints:0
 CONNECTION
-Box07:Widget:Box05:Widget1
-NumberOfControlPoints:0
-CONNECTION
 Box02:Renderer1:Box09:Renderer
 NumberOfControlPoints:0
 CONNECTION
@@ -124,9 +126,6 @@ CONNECTION
 Box15:BoxChange:Box04:BoxExecute
 NumberOfControlPoints:0
 CONNECTION
-Box15:Widget:Box07:Widget2
-NumberOfControlPoints:0
-CONNECTION
 Box04:BoxChange:Box09:BoxExecute
 NumberOfControlPoints:0
 CONNECTION
@@ -138,4 +137,13 @@ NumberOfControlPoints:0
 CONNECTION
 Box01:Out:Box09:In
 NumberOfControlPoints:0
+CONNECTION
+Box15:Widget:Box05:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box10:Out:Box00:ImplicitFunction
+NumberOfControlPoints:0
+CONNECTION
+Box11:Out:Box02:In
+NumberOfControlPoints:0
 APP_END
index e69385aa3eaa70a0565d5e4a2fc2f86a79f7de4e..46261046c75feb8f03eccc863878a4a5b1144792 100644 (file)
@@ -28,19 +28,17 @@ new vtk:SphereSource Box01
   set Box01.ThetaResolution "15"
 
 new creaMaracasVisu:ViewerNV Box02
-
-new vtk:LoadHola Box03
+  set Box02.nTypeView "7"
 
 new vtk:PolyDataToActor Box04
   set Box04.Colour "1 0 0"
+  set Box04.LineWidth "2"
   set Box04.Opacity "1"
   set Box04.Representation "1"
 
 new wx:LayoutSplit Box05
   set Box05.Orientation "H"
 
-new wx:LayoutLine Box07
-
 new vtk:PolyDataToActor Box09
   set Box09.Opacity "0.2"
   set Box09.Representation "2"
@@ -51,8 +49,12 @@ new vtk:UpdateRender Box13
 new wx:CommandButton Box15
   set Box15.Label "Refresh"
 
+new creaVtk:Plane Box10
+  set Box10.Normal "0 0 1"
+  set Box10.Origin "0 0 30"
+
+new vtk:LoadHola Box11
 
-connect Box03.Out Box02.In
 
 connect Box00.Out Box04.In
 
@@ -60,16 +62,12 @@ connect Box02.Renderer1 Box04.Renderer
 
 connect Box02.Widget Box05.Widget2
 
-connect Box07.Widget Box05.Widget1
-
 connect Box02.Renderer1 Box09.Renderer
 
 connect Box02.Renderer1 Box13.Renderer
 
 connect Box15.BoxChange Box04.BoxExecute
 
-connect Box15.Widget Box07.Widget2
-
 connect Box04.BoxChange Box09.BoxExecute
 
 connect Box09.BoxChange Box13.BoxExecute
@@ -78,6 +76,12 @@ connect Box01.Out Box00.In
 
 connect Box01.Out Box09.In
 
+connect Box15.Widget Box05.Widget1
+
+connect Box10.Out Box00.ImplicitFunction
+
+connect Box11.Out Box02.In
+
 
 
 # Complex input ports
index 2b7c9aed7ef57599f5e19a0f21e8c8797862dd7a..d8d148c36dbf158998e04025a6083de5c36433bd 100644 (file)
@@ -5,8 +5,7 @@
 #include "bbcreaVtkPackage.h"
 #include "vtkCutter.h"
 #include "vtkStripper.h"
-#include "vtkPlane.h"
-#
+
 namespace bbcreaVtk
 {
 
@@ -43,27 +42,21 @@ void Cutter::Process()
     vtkPolyData        *poly;
        vtkStripper     *strips;
 
-       vtkPlane        *plane;
-       plane  = vtkPlane::New();
-       plane->SetOrigin(0,0,30);
-       plane->SetNormal(0,0,1);
-       
        cutter = vtkCutter::New();
        cutter->SetInputData( bbGetInputIn() );
-    cutter->SetCutFunction( plane );
+    cutter->SetCutFunction( bbGetInputImplicitFunction() );
     cutter->Update();
-       
+       
        strips = vtkStripper::New();
     strips->SetInputData( cutter->GetOutput() );
     strips->Update();
     poly = vtkPolyData::New();
     poly->SetPoints( strips->GetOutput()->GetPoints() );
     poly->SetPolys( strips->GetOutput()->GetLines() );
-       
+
+//  bbSetOutputOut( cutter->GetOutput() );
        bbSetOutputOut( poly );
-//     bbSetOutputOut( cutter->GetOutput() );
-       
-       
+               
 }
 //===== 
 // 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 ac8321630cc29ebd85e851e5ead956aef0d801a4..35614e043eeea19febfd0338a2cd8f7ce3008730 100644 (file)
@@ -8,6 +8,7 @@
 #include "bbtkAtomicBlackBox.h"
 #include "iostream"
 #include "vtkPolyData.h"
+#include "vtkImplicitFunction.h"
 
 namespace bbcreaVtk
 {
@@ -21,6 +22,7 @@ class bbcreaVtk_EXPORT Cutter
 // 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)
 //===== 
   BBTK_DECLARE_INPUT(In,vtkPolyData*);
+  BBTK_DECLARE_INPUT(ImplicitFunction,vtkImplicitFunction*);
   BBTK_DECLARE_OUTPUT(Out,vtkPolyData*);
   BBTK_PROCESS(Process);
   void Process();
@@ -36,6 +38,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(Cutter,bbtk::AtomicBlackBox);
   BBTK_CATEGORY("empty");
 
   BBTK_INPUT(Cutter,In,"vtkPolyData input",vtkPolyData*,"");
+  BBTK_INPUT(Cutter,ImplicitFunction,"vtkImpliciteFunction  ex.: vtkBox, vtkCone, vtkCylender, vtkPlane, vtkSphere(s), vtkQuadric, ETC.",vtkImplicitFunction*,"");
 
   BBTK_OUTPUT(Cutter,Out,"vtkPolyData output",vtkPolyData*,"");
   
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlane.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlane.cxx
new file mode 100644 (file)
index 0000000..53fabde
--- /dev/null
@@ -0,0 +1,90 @@
+//===== 
+// 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)
+//===== 
+#include "bbcreaVtkPlane.h"
+#include "bbcreaVtkPackage.h"
+
+#include "vtkPlane.h"
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Plane)
+BBTK_BLACK_BOX_IMPLEMENTATION(Plane,bbtk::AtomicBlackBox);
+//===== 
+// 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)
+//===== 
+void Plane::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+       vtkPlane        *plane = NULL;
+  
+    if ( (bbGetInputOrigin().size()==3) && (bbGetInputNormal().size()==3) ) 
+    {
+               plane  = vtkPlane::New();
+               plane->SetOrigin( bbGetInputOrigin()[0],bbGetInputOrigin()[1],bbGetInputOrigin()[2] );
+               plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] );
+    } 
+    
+       bbSetOutputOut( plane );        
+  
+}
+
+//===== 
+// 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)
+//===== 
+void Plane::bbUserSetDefaultValues()
+{
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   std::vector<double> origin;
+   std::vector<double> normal;
+   origin.push_back(0);
+   origin.push_back(0);
+   origin.push_back(0);
+   normal.push_back(0);
+   normal.push_back(0);
+   normal.push_back(1);
+   bbSetInputOrigin( origin ); 
+   bbSetInputNormal( normal ); 
+}
+
+//===== 
+// 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)
+//===== 
+void Plane::bbUserInitializeProcessing()
+{
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any  
+}
+
+//===== 
+// 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)
+//===== 
+void Plane::bbUserFinalizeProcessing()
+{
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any 
+}
+
+} // EO namespace bbcreaVtk
+
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlane.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPlane.h
new file mode 100644 (file)
index 0000000..a6a1e85
--- /dev/null
@@ -0,0 +1,52 @@
+//===== 
+// 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)
+//===== 
+#ifndef __bbcreaVtkPlane_h_INCLUDED__
+#define __bbcreaVtkPlane_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+#include "vtkImplicitFunction.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT Plane
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(Plane,bbtk::AtomicBlackBox);
+//===== 
+// 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)
+//===== 
+  BBTK_DECLARE_INPUT(Origin,std::vector<double>);
+  BBTK_DECLARE_INPUT(Normal,std::vector<double>);
+  BBTK_DECLARE_OUTPUT(Out,vtkImplicitFunction*);
+  BBTK_PROCESS(Process);
+  void Process();
+//===== 
+// 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)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(Plane,bbtk::AtomicBlackBox);
+  BBTK_NAME("Plane");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("Implicite Function of VTK");
+  BBTK_CATEGORY("empty");
+
+  BBTK_INPUT(Plane,Origin,"(default [0,0,0])  point  [x,y,z]",std::vector<double>,"");
+  BBTK_INPUT(Plane,Normal,"(default [0,0,1]) vector [x,y,z]",std::vector<double>,"");
+
+  BBTK_OUTPUT(Plane,Out,"vtkImplicitFuntion",vtkImplicitFunction*,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(Plane);
+//===== 
+// 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)
+//===== 
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkPlane_h_INCLUDED__
+