+//=====
+// 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)
+//=====
+#include "bbcreaMaracasVisuReadCreaContourFile.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ReadCreaContourFile)
+BBTK_BLACK_BOX_IMPLEMENTATION(ReadCreaContourFile,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void ReadCreaContourFile::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ if (bbGetInputFileNameRoi().compare("")==0)
+ {
+ printf("EED Warnning! ReadCreaContourFile::Process FileNameRoi EMPTY\n");
+ } else {
+ char tmp[255];
+ FILE *ff= fopen(bbGetInputFileNameRoi().c_str(),"r");
+ if (ff==NULL)
+ {
+ printf("EED Warnning! ReadCreaContourFile::Process Wrong file %s\n", bbGetInputFileNameRoi().c_str() );
+ } else {
+ fscanf(ff,"%s",tmp); // --CreaContour--
+ std::string tmpStr(tmp);
+ if (tmpStr.compare("--CreaContour--")==0 )
+ {
+ int iContour,iControlPoint;
+ int dimX, dimY,dimZ;
+ int NumberOfContours;
+ double x,y,z,zz;
+ int TypeModel;
+ int NumberOfControlPoints;
+
+
+ std::vector<double> LstX;
+ std::vector<double> LstY;
+ std::vector<double> LstZ;
+ std::vector<int> LstIndexs;
+
+ fscanf(ff,"%s",tmp); // version
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); // ImageDimensions
+ fscanf(ff,"%d",&dimX); //
+ fscanf(ff,"%d",&dimY); //
+ fscanf(ff,"%d",&dimZ); //
+ fscanf(ff,"%s",tmp); // ImageSpacing
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); // NumberOfContours
+ fscanf(ff,"%d",&NumberOfContours); //
+ for (iContour=0 ; iContour<NumberOfContours ; iContour++)
+ {
+ fscanf(ff,"%s",tmp); // Instant
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); zz=atof(tmp); // zz
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); // TypeModel
+ fscanf(ff,"%d",&TypeModel); //
+ if (TypeModel==1)
+ {
+ fscanf(ff,"%s",tmp); // NumberOfControlPoints
+ fscanf(ff,"%d",&NumberOfControlPoints); //
+ LstIndexs.push_back( NumberOfControlPoints );
+ for (iControlPoint=0 ; iControlPoint<NumberOfControlPoints ; iControlPoint++)
+ {
+ fscanf(ff,"%s",tmp); x=atof(tmp); // x
+ fscanf(ff,"%s",tmp); y=atof(tmp); // y
+ fscanf(ff,"%s",tmp); z=atof(tmp); // z
+ if (bbGetInputFromDirection()==0) // XY
+ {
+ LstX.push_back(x);
+ LstY.push_back(y);
+ LstZ.push_back(zz);
+ } // if FromDirection
+ if (bbGetInputFromDirection()==1) // YZ
+ {
+ LstX.push_back(zz);
+ LstY.push_back(x);
+ LstZ.push_back(y);
+ } // if FromDirection
+ if (bbGetInputFromDirection()==2) // XZ
+ {
+ LstX.push_back(x);
+ LstY.push_back(zz);
+ LstZ.push_back( (y*(-1)) + (dimY-1) );
+ } // if FromDirection
+ } // iControlPoint
+ } // TypeModel
+ fscanf(ff,"%s",tmp); // TypeView
+ fscanf(ff,"%s",tmp); //
+
+ } // for i NumberOfContours
+ fclose(ff);
+ bbSetOutputLstX( LstX );
+ bbSetOutputLstY( LstY );
+ bbSetOutputLstZ( LstZ );
+ bbSetOutputLstIndexs( LstIndexs );
+
+ } else {
+ printf("EED Warnning! ReadCreaContourFile::Process %s is not a creaContour .roi file\n",bbGetInputFileNameRoi() );
+ } // if --CreaContour--
+ } // if ff
+ } // if FileNameRoi
+
+}
+//=====
+// 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)
+//=====
+void ReadCreaContourFile::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputFileNameRoi("");
+ bbSetInputFromDirection(0);
+
+}
+//=====
+// 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)
+//=====
+void ReadCreaContourFile::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void ReadCreaContourFile::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+