]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuReadAxisTree3D.cxx
Changes in ReadAxisTree and AxeVolume.
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuReadAxisTree3D.cxx
1 //===== 
2 // Don't edit this file. This file is generated from xml description.. 
3 //===== 
4 #include "bbcreaMaracasVisuReadAxisTree3D.h"
5 #include "bbcreaMaracasVisuPackage.h"
6
7
8 #include<vector>
9
10
11
12 namespace bbcreaMaracasVisu
13 {
14
15 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ReadAxisTree3D)
16 BBTK_BLACK_BOX_IMPLEMENTATION(ReadAxisTree3D,bbtk::AtomicBlackBox);
17 //===== 
18 // Don't edit this file. This file is generated from xml description.. 
19 //===== 
20 void ReadAxisTree3D::Process()
21 {
22
23 // THE MAIN PROCESSING METHOD BODY
24 //   Here we simply set the input 'In' value to the output 'Out'
25 //   And print out the output value
26 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
27 //    void bbSet{Input|Output}NAME(const TYPE&)
28 //    const TYPE& bbGet{Input|Output}NAME() const 
29 //    Where :
30 //    * NAME is the name of the input/output
31 //      (the one provided in the attribute 'name' of the tag 'input')
32 //    * TYPE is the C++ type of the input/output
33 //      (the one provided in the attribute 'type' of the tag 'input')
34
35         printf("EED ReadAxisTree3D::Process start \n");
36         
37         std::vector< std::vector<std::string> * > tlst;
38         
39         int i;
40         for( i=0 ;  i<bbGetInputDimension() ; i++)
41         {
42                 tlst.push_back( new std::vector<std::string> );
43         }       
44         
45         int numberOfLines = 0;
46         char tmpValue[50];
47         std::vector<std::string> *vecData;
48         FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
49         if (ff1!=NULL)
50         {
51                 while (!feof(ff1))
52                 {
53                         for( i=0 ;  i<bbGetInputDimension() ; i++)
54                         {
55                                 fscanf(ff1,"%s",tmpValue);
56                                 vecData=tlst[i];
57                                 vecData->push_back( tmpValue );
58                         }       
59                         numberOfLines++;                        
60                 }       
61
62                 std::cout<<"18-04-2012 RaC ReadAxisTree3D::Process Erase last element in vectors."<<std::endl;
63                 // TOFIX If it is not erased, the last element in every vector is a copy of the last column value
64                 for( i=0 ;  i<bbGetInputDimension() ; i++)
65                 {
66                         vecData=tlst[i];
67                         vecData->pop_back();
68                 }
69                 /* vecData=tlst[0];
70                 std::cout<<"RaC last element 1:"<<vecData->at(numberOfLines-2)<<std::endl;
71                 std::cout<<"RaC last element 1:"<<vecData->at(numberOfLines-1)<<std::endl;
72                 vecData=tlst[1];
73                 std::cout<<"RaC last element 2:"<<vecData->at(numberOfLines-2)<<std::endl;
74                 std::cout<<"RaC last element 2:"<<vecData->at(numberOfLines-1)<<std::endl;
75                 vecData=tlst[2];
76                 std::cout<<"RaC last element 3:"<<vecData->at(numberOfLines-2)<<std::endl;
77                 std::cout<<"RaC last element 3:"<<vecData->at(numberOfLines-1)<<std::endl; */
78                 fclose(ff1);
79         } else {   // else ff1
80                 printf("bbcreaMaracasVisuReadAxisTree3D::Process  ...Error... reading file InputFileName_Points>%s", bbGetInputFileName().c_str() );
81         } //ff1 
82
83
84         i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); }
85         i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); }
86         i=3; if (i<=bbGetInputDimension()) { bbSetOutputlstData3( *(tlst[i-1]) ); }
87         i=4; if (i<=bbGetInputDimension()) { bbSetOutputlstData4( *(tlst[i-1]) ); }
88         i=5; if (i<=bbGetInputDimension()) { bbSetOutputlstData5( *(tlst[i-1]) ); }
89         i=6; if (i<=bbGetInputDimension()) { bbSetOutputlstData6( *(tlst[i-1]) ); }
90         i=7; if (i<=bbGetInputDimension()) { bbSetOutputlstData7( *(tlst[i-1]) ); }
91         i=8; if (i<=bbGetInputDimension()) { bbSetOutputlstData8( *(tlst[i-1]) ); }
92         i=9; if (i<=bbGetInputDimension()) { bbSetOutputlstData9( *(tlst[i-1]) ); }
93
94         printf("EED ReadAxisTree3D::Process end \n");
95         
96 }
97         
98         
99 //===== 
100 // Don't edit this file. This file is generated from xml description.. 
101 //===== 
102 void ReadAxisTree3D::bbUserSetDefaultValues()
103 {
104
105 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
106 //    Here we initialize the input 'In' to 0
107         
108         bbSetInputDimension(1); 
109         bbSetInputFileName(""); 
110   
111 }
112 //===== 
113 // Don't edit this file. This file is generated from xml description.. 
114 //===== 
115 void ReadAxisTree3D::bbUserInitializeProcessing()
116 {
117
118 //  THE INITIALIZATION METHOD BODY :
119 //    Here does nothing 
120 //    but this is where you should allocate the internal/output pointers 
121 //    if any 
122
123   
124 }
125 //===== 
126 // Don't edit this file. This file is generated from xml description.. 
127 //===== 
128 void ReadAxisTree3D::bbUserFinalizeProcessing()
129 {
130
131 //  THE FINALIZATION METHOD BODY :
132 //    Here does nothing 
133 //    but this is where you should desallocate the internal/output pointers 
134 //    if any
135   
136 }
137 }
138 // EO namespace bbcreaMaracasVisu
139
140