]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkMarchingCubes2.cxx
e2d3b8e47e2cf2307f31c882d4af68920a5b68a4
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkMarchingCubes2.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 "bbcreaVtkMarchingCubes2.h"
5 #include "bbcreaVtkPackage.h"
6 namespace bbcreaVtk
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MarchingCubes2)
10 BBTK_BLACK_BOX_IMPLEMENTATION(MarchingCubes2,bbtk::AtomicBlackBox);
11 //===== 
12 // 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)
13 //===== 
14 void MarchingCubes2::Process()
15 {
16
17 // THE MAIN PROCESSING METHOD BODY
18 //   Here we simply set the input 'In' value to the output 'Out'
19 //   And print out the output value
20 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
21 //    void bbSet{Input|Output}NAME(const TYPE&)
22 //    const TYPE& bbGet{Input|Output}NAME() const 
23 //    Where :
24 //    * NAME is the name of the input/output
25 //      (the one provided in the attribute 'name' of the tag 'input')
26 //    * TYPE is the C++ type of the input/output
27 //      (the one provided in the attribute 'type' of the tag 'input')
28 //    bbSetOutputOut( bbGetInputIn() );
29 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
30   
31     if ( (bbGetInputActive()==true) && (bbGetInputIn()!=NULL) )
32     {
33         if (marchingcubes==NULL) { marchingcubes=vtkMarchingCubes::New(); }
34         marchingcubes->SetInputData( bbGetInputIn() );
35         marchingcubes->SetValue(0, bbGetInputValue() );
36
37         if(bbGetInputComputeNormalsOn())
38         {
39             marchingcubes->ComputeNormalsOn();
40         }else {
41             marchingcubes->ComputeNormalsOff();
42         }// if Normals
43         
44         if(bbGetInputComputeScalarsOn())
45         {
46             marchingcubes->ComputeScalarsOn();
47         }else{
48             marchingcubes->ComputeScalarsOff();
49         }// if Scalars
50         
51         marchingcubes->Update();
52         bbSetOutputOut( marchingcubes->GetOutput() );
53     } else {
54         bbSetOutputOut(NULL);
55     } // Active
56
57     
58     
59 }
60 //===== 
61 // 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)
62 //===== 
63 void MarchingCubes2::bbUserSetDefaultValues()
64 {
65
66 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
67 //    Here we initialize the input 'In' to 0
68     marchingcubes=NULL;
69     bbSetInputActive(true);
70     bbSetInputIn(NULL);
71     bbSetInputValue( 400 );
72     bbSetInputComputeNormalsOn(true);
73     bbSetInputComputeScalarsOn(true);
74     bbSetOutputOut(NULL);
75 }
76 //===== 
77 // 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)
78 //===== 
79 void MarchingCubes2::bbUserInitializeProcessing()
80 {
81
82 //  THE INITIALIZATION METHOD BODY :
83 //    Here does nothing 
84 //    but this is where you should allocate the internal/output pointers 
85 //    if any 
86
87   
88 }
89 //===== 
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)
91 //===== 
92 void MarchingCubes2::bbUserFinalizeProcessing()
93 {
94
95 //  THE FINALIZATION METHOD BODY :
96 //    Here does nothing 
97 //    but this is where you should desallocate the internal/output pointers 
98 //    if any
99   
100 }
101 }
102 // EO namespace bbcreaVtk
103
104