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)
4 #include "bbcreaMaracasVisuReadCreaContourFile.h"
5 #include "bbcreaMaracasVisuPackage.h"
6 namespace bbcreaMaracasVisu
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ReadCreaContourFile)
10 BBTK_BLACK_BOX_IMPLEMENTATION(ReadCreaContourFile,bbtk::AtomicBlackBox);
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)
14 void ReadCreaContourFile::Process()
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
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')
29 // bbSetOutputOut( bbGetInputIn() );
30 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
32 if (bbGetInputFileNameRoi().compare("")==0)
34 printf("EED Warnning! ReadCreaContourFile::Process FileNameRoi EMPTY\n");
37 FILE *ff= fopen(bbGetInputFileNameRoi().c_str(),"r");
40 printf("EED Warnning! ReadCreaContourFile::Process Wrong file %s\n", bbGetInputFileNameRoi().c_str() );
42 fscanf(ff,"%s",tmp); // --CreaContour--
43 std::string tmpStr(tmp);
44 if (tmpStr.compare("--CreaContour--")==0 )
46 int iContour,iControlPoint;
51 int NumberOfControlPoints;
54 std::vector<double> LstX;
55 std::vector<double> LstY;
56 std::vector<double> LstZ;
57 std::vector<int> LstIndexs;
59 fscanf(ff,"%s",tmp); // version
60 fscanf(ff,"%s",tmp); //
61 fscanf(ff,"%s",tmp); // ImageDimensions
62 fscanf(ff,"%d",&dimX); //
63 fscanf(ff,"%d",&dimY); //
64 fscanf(ff,"%d",&dimZ); //
65 fscanf(ff,"%s",tmp); // ImageSpacing
66 fscanf(ff,"%s",tmp); //
67 fscanf(ff,"%s",tmp); //
68 fscanf(ff,"%s",tmp); //
69 fscanf(ff,"%s",tmp); // NumberOfContours
70 fscanf(ff,"%d",&NumberOfContours); //
71 for (iContour=0 ; iContour<NumberOfContours ; iContour++)
73 fscanf(ff,"%s",tmp); // Instant
74 fscanf(ff,"%s",tmp); //
75 fscanf(ff,"%s",tmp); zz=atof(tmp); // zz
76 fscanf(ff,"%s",tmp); //
77 fscanf(ff,"%s",tmp); //
78 fscanf(ff,"%s",tmp); //
79 fscanf(ff,"%s",tmp); //
80 fscanf(ff,"%s",tmp); // TypeModel
81 fscanf(ff,"%d",&TypeModel); //
84 fscanf(ff,"%s",tmp); // NumberOfControlPoints
85 fscanf(ff,"%d",&NumberOfControlPoints); //
86 LstIndexs.push_back( NumberOfControlPoints );
87 for (iControlPoint=0 ; iControlPoint<NumberOfControlPoints ; iControlPoint++)
89 fscanf(ff,"%s",tmp); x=atof(tmp); // x
90 fscanf(ff,"%s",tmp); y=atof(tmp); // y
91 fscanf(ff,"%s",tmp); z=atof(tmp); // z
92 if (bbGetInputFromDirection()==0) // XY
98 if (bbGetInputFromDirection()==1) // YZ
103 } // if FromDirection
104 if (bbGetInputFromDirection()==2) // XZ
108 LstZ.push_back( (y*(-1)) + (dimY-1) );
109 } // if FromDirection
112 fscanf(ff,"%s",tmp); // TypeView
113 fscanf(ff,"%s",tmp); //
115 } // for i NumberOfContours
117 bbSetOutputLstX( LstX );
118 bbSetOutputLstY( LstY );
119 bbSetOutputLstZ( LstZ );
120 bbSetOutputLstIndexs( LstIndexs );
123 printf("EED Warnning! ReadCreaContourFile::Process %s is not a creaContour .roi file\n",bbGetInputFileNameRoi() );
124 } // if --CreaContour--
130 // 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)
132 void ReadCreaContourFile::bbUserSetDefaultValues()
135 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
136 // Here we initialize the input 'In' to 0
137 bbSetInputFileNameRoi("");
138 bbSetInputFromDirection(0);
142 // 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)
144 void ReadCreaContourFile::bbUserInitializeProcessing()
147 // THE INITIALIZATION METHOD BODY :
149 // but this is where you should allocate the internal/output pointers
155 // 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)
157 void ReadCreaContourFile::bbUserFinalizeProcessing()
160 // THE FINALIZATION METHOD BODY :
162 // but this is where you should desallocate the internal/output pointers
167 // EO namespace bbcreaMaracasVisu