]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuReadAxisTree3D.cxx
2f42c2cefed359beb40c10c1a9e271e9320c5df5
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuReadAxisTree3D.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 //===== 
27 // Don't edit this file. This file is generated from xml description.. 
28 //===== 
29 #include "bbcreaMaracasVisuReadAxisTree3D.h"
30 #include "bbcreaMaracasVisuPackage.h"
31
32
33 #include<vector>
34
35
36
37 namespace bbcreaMaracasVisu
38 {
39
40 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ReadAxisTree3D)
41 BBTK_BLACK_BOX_IMPLEMENTATION(ReadAxisTree3D,bbtk::AtomicBlackBox);
42 //===== 
43 // Don't edit this file. This file is generated from xml description.. 
44 //===== 
45 void ReadAxisTree3D::Process()
46 {
47
48 // THE MAIN PROCESSING METHOD BODY
49 //   Here we simply set the input 'In' value to the output 'Out'
50 //   And print out the output value
51 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
52 //    void bbSet{Input|Output}NAME(const TYPE&)
53 //    const TYPE& bbGet{Input|Output}NAME() const 
54 //    Where :
55 //    * NAME is the name of the input/output
56 //      (the one provided in the attribute 'name' of the tag 'input')
57 //    * TYPE is the C++ type of the input/output
58 //      (the one provided in the attribute 'type' of the tag 'input')
59
60         printf("EED ReadAxisTree3D::Process start \n");
61         
62         std::vector< std::vector<std::string> * > tlst;
63         
64         int i;
65         for( i=0 ;  i<bbGetInputDimension() ; i++)
66         {
67                 tlst.push_back( new std::vector<std::string> );
68         }       
69         
70         int numberOfLines = 0;
71         char tmpValue[50];
72         std::vector<std::string> *vecData;
73         FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
74         if (ff1!=NULL)
75         {
76                 while (!feof(ff1))
77                 {
78                         for( i=0 ;  i<bbGetInputDimension() ; i++)
79                         {
80                                 fscanf(ff1,"%s",tmpValue);
81                                 vecData=tlst[i];
82                                 vecData->push_back( tmpValue );
83                         }       
84                         numberOfLines++;                        
85                 }       
86
87                 std::cout<<"18-04-2012 RaC ReadAxisTree3D::Process Erase last element in vectors."<<std::endl;
88                 // TOFIX If it is not erased, the last element in every vector is a copy of the last column value
89                 for( i=0 ;  i<bbGetInputDimension() ; i++)
90                 {
91                         vecData=tlst[i];
92                         vecData->pop_back();
93                 }
94                 /* vecData=tlst[0];
95                 std::cout<<"RaC last element 1:"<<vecData->at(numberOfLines-2)<<std::endl;
96                 std::cout<<"RaC last element 1:"<<vecData->at(numberOfLines-1)<<std::endl;
97                 vecData=tlst[1];
98                 std::cout<<"RaC last element 2:"<<vecData->at(numberOfLines-2)<<std::endl;
99                 std::cout<<"RaC last element 2:"<<vecData->at(numberOfLines-1)<<std::endl;
100                 vecData=tlst[2];
101                 std::cout<<"RaC last element 3:"<<vecData->at(numberOfLines-2)<<std::endl;
102                 std::cout<<"RaC last element 3:"<<vecData->at(numberOfLines-1)<<std::endl; */
103                 fclose(ff1);
104         } else {   // else ff1
105                 printf("bbcreaMaracasVisuReadAxisTree3D::Process  ...Error... reading file InputFileName_Points>%s", bbGetInputFileName().c_str() );
106         } //ff1 
107
108
109         i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); }
110         i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); }
111         i=3; if (i<=bbGetInputDimension()) { bbSetOutputlstData3( *(tlst[i-1]) ); }
112         i=4; if (i<=bbGetInputDimension()) { bbSetOutputlstData4( *(tlst[i-1]) ); }
113         i=5; if (i<=bbGetInputDimension()) { bbSetOutputlstData5( *(tlst[i-1]) ); }
114         i=6; if (i<=bbGetInputDimension()) { bbSetOutputlstData6( *(tlst[i-1]) ); }
115         i=7; if (i<=bbGetInputDimension()) { bbSetOutputlstData7( *(tlst[i-1]) ); }
116         i=8; if (i<=bbGetInputDimension()) { bbSetOutputlstData8( *(tlst[i-1]) ); }
117         i=9; if (i<=bbGetInputDimension()) { bbSetOutputlstData9( *(tlst[i-1]) ); }
118
119         printf("EED ReadAxisTree3D::Process end \n");
120         
121 }
122         
123         
124 //===== 
125 // Don't edit this file. This file is generated from xml description.. 
126 //===== 
127 void ReadAxisTree3D::bbUserSetDefaultValues()
128 {
129
130 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
131 //    Here we initialize the input 'In' to 0
132         
133         bbSetInputDimension(1); 
134         bbSetInputFileName(""); 
135   
136 }
137 //===== 
138 // Don't edit this file. This file is generated from xml description.. 
139 //===== 
140 void ReadAxisTree3D::bbUserInitializeProcessing()
141 {
142
143 //  THE INITIALIZATION METHOD BODY :
144 //    Here does nothing 
145 //    but this is where you should allocate the internal/output pointers 
146 //    if any 
147
148   
149 }
150 //===== 
151 // Don't edit this file. This file is generated from xml description.. 
152 //===== 
153 void ReadAxisTree3D::bbUserFinalizeProcessing()
154 {
155
156 //  THE FINALIZATION METHOD BODY :
157 //    Here does nothing 
158 //    but this is where you should desallocate the internal/output pointers 
159 //    if any
160   
161 }
162 }
163 // EO namespace bbcreaMaracasVisu
164
165