]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkImageExtractComponents.cxx
#3069 creaVtk Feature New Normal - new box bbcreaVtkImageExtractComponents
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkImageExtractComponents.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 "bbcreaVtkImageExtractComponents.h"
5 #include "bbcreaVtkPackage.h"
6 namespace bbcreaVtk
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageExtractComponents)
10 BBTK_BLACK_BOX_IMPLEMENTATION(ImageExtractComponents,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 ImageExtractComponents::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
29 //    bbSetOutputOut( bbGetInputIn() );
30 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
31   
32         bbSetOutputOut0( NULL ); 
33         bbSetOutputOut1( NULL ); 
34         bbSetOutputOut2( NULL ); 
35         bbSetOutputOut3( NULL ); 
36
37         if (bbGetInputComponent0()!=-1)
38         {
39                 IEC0->SetInput( bbGetInputIn() );
40                 IEC0->SetComponents( bbGetInputComponent0() );
41                 IEC0->Update();
42                 bbSetOutputOut0( IEC0->GetOutput() ); 
43         } 
44
45         if (bbGetInputComponent1()!=-1)
46         {
47                 IEC1->SetInput( bbGetInputIn() );
48                 IEC1->SetComponents( bbGetInputComponent1() );
49                 IEC1->Update();
50                 bbSetOutputOut1( IEC1->GetOutput() ); 
51         }
52
53         if (bbGetInputComponent2()!=-1)
54         {
55                 IEC2->SetInput( bbGetInputIn() );
56                 IEC2->SetComponents( bbGetInputComponent2() );
57                 IEC2->Update();
58                 bbSetOutputOut2( IEC2->GetOutput() ); 
59         }
60
61         if (bbGetInputComponent3()!=-1)
62         {
63                 IEC3->SetInput( bbGetInputIn() );
64                 IEC3->SetComponents( bbGetInputComponent2() );
65                 IEC3->Update();
66                 bbSetOutputOut3( IEC3->GetOutput() ); 
67         }
68
69
70 }
71 //===== 
72 // 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)
73 //===== 
74 void ImageExtractComponents::bbUserSetDefaultValues()
75 {
76
77 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
78 //    Here we initialize the input 'In' to 0
79    bbSetInputIn(NULL);
80    bbSetInputComponent0(-1);
81    bbSetInputComponent1(-1);
82    bbSetInputComponent2(-1);
83    bbSetInputComponent3(-1);
84
85 }
86 //===== 
87 // 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)
88 //===== 
89 void ImageExtractComponents::bbUserInitializeProcessing()
90 {
91
92 //  THE INITIALIZATION METHOD BODY :
93 //    Here does nothing 
94 //    but this is where you should allocate the internal/output pointers 
95 //    if any 
96
97         IEC0=vtkImageExtractComponents::New();  
98         IEC1=vtkImageExtractComponents::New();  
99         IEC2=vtkImageExtractComponents::New();  
100         IEC3=vtkImageExtractComponents::New();  
101 }
102 //===== 
103 // 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)
104 //===== 
105 void ImageExtractComponents::bbUserFinalizeProcessing()
106 {
107
108 //  THE FINALIZATION METHOD BODY :
109 //    Here does nothing 
110 //    but this is where you should desallocate the internal/output pointers 
111 //    if any
112
113         IEC0->Delete();  
114         IEC1->Delete();  
115         IEC2->Delete();  
116         IEC3->Delete();  
117
118 }
119
120
121 }
122 // EO namespace bbcreaVtk
123
124