]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx
d8d148c36dbf158998e04025a6083de5c36433bd
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkCutter.cxx
1 //===== 
2 // 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)
3 //===== 
4 #include "bbcreaVtkCutter.h"
5 #include "bbcreaVtkPackage.h"
6 #include "vtkCutter.h"
7 #include "vtkStripper.h"
8
9 namespace bbcreaVtk
10 {
11
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Cutter)
13 BBTK_BLACK_BOX_IMPLEMENTATION(Cutter,bbtk::AtomicBlackBox);
14 //===== 
15 // 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)
16 //===== 
17 void Cutter::Process()
18 {
19
20 // THE MAIN PROCESSING METHOD BODY
21 //   Here we simply set the input 'In' value to the output 'Out'
22 //   And print out the output value
23 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
24 //    void bbSet{Input|Output}NAME(const TYPE&)
25 //    const TYPE& bbGet{Input|Output}NAME() const 
26 //    Where :
27 //    * NAME is the name of the input/output
28 //      (the one provided in the attribute 'name' of the tag 'input')
29 //    * TYPE is the C++ type of the input/output
30 //      (the one provided in the attribute 'type' of the tag 'input')
31 //    bbSetOutputOut( bbGetInputIn() );
32 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
33   
34   
35   
36   
37   
38   //  See example in:
39   //  https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/Cutter/
40   
41         vtkCutter       *cutter;
42     vtkPolyData *poly;
43         vtkStripper     *strips;
44
45         cutter = vtkCutter::New();
46         cutter->SetInputData( bbGetInputIn() );
47     cutter->SetCutFunction( bbGetInputImplicitFunction() );
48     cutter->Update();
49         
50         strips = vtkStripper::New();
51     strips->SetInputData( cutter->GetOutput() );
52     strips->Update();
53     poly = vtkPolyData::New();
54     poly->SetPoints( strips->GetOutput()->GetPoints() );
55     poly->SetPolys( strips->GetOutput()->GetLines() );
56
57 //  bbSetOutputOut( cutter->GetOutput() );
58         bbSetOutputOut( poly );
59                 
60 }
61 //===== 
62 // 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)
63 //===== 
64 void Cutter::bbUserSetDefaultValues()
65 {
66
67 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
68 //    Here we initialize the input 'In' to 0
69 //   bbSetInputIn(NULL);
70   
71 }
72 //===== 
73 // 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 //===== 
75 void Cutter::bbUserInitializeProcessing()
76 {
77
78 //  THE INITIALIZATION METHOD BODY :
79 //    Here does nothing 
80 //    but this is where you should allocate the internal/output pointers 
81 //    if any 
82
83   
84 }
85 //===== 
86 // 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)
87 //===== 
88 void Cutter::bbUserFinalizeProcessing()
89 {
90
91 //  THE FINALIZATION METHOD BODY :
92 //    Here does nothing 
93 //    but this is where you should desallocate the internal/output pointers 
94 //    if any
95   
96 }
97 }
98 // EO namespace bbcreaVtk
99
100