#include "bbUtilitiesLoadPoint.h" #include "bbUtilitiesPackage.h" namespace bbUtilities { BBTK_ADD_BLACK_BOX_TO_PACKAGE(Utilities,LoadPoint) //BBTK_USER_BLACK_BOX_IMPLEMENTATION(LoadAxis,bbtk::AtomicBlackBox); BBTK_BLACK_BOX_IMPLEMENTATION(LoadPoint,bbtk::AtomicBlackBox); void LoadPoint::Process() { std::string filename = bbGetInputFileNamePoint(), line = ""; vtkImageData* img = bbGetInputImage(); double *spc; spc = img->GetSpacing(); std::cout<<"Spacing: " << spc[0]<<" "<< spc[1] << " " << spc[2]< pointout; pointout.push_back(0); pointout.push_back(0); pointout.push_back(0); std::ifstream file; file.open( filename.c_str() ); if(file.is_open()) { int i=0; bool exit=false; while(!file.eof()&&!exit) { std::getline(file,line); //OJO LOS TEORICOS ESTAN SEPARADOS POR ; int pos=line.find(" "); int pos2=line.find_last_of(" "); int size=line.size(); std::string xs=line.substr(0,pos); std::string ys=line.substr(pos+1,pos2); std::string zs=line.substr(pos2+1,size); double x0=atof(xs.c_str()); double y0=atof(ys.c_str()); double z0=atof(zs.c_str()); if(x0 > 0 && y0 > 0 && z0 > 00){ pointout[0]= x0/spc[0]; pointout[1]= y0/spc[1]; pointout[2]= z0/spc[2]; exit = true; } } } bbSetOutputOutPoint(pointout); } void LoadPoint::bbUserSetDefaultValues() { } void LoadPoint::bbUserInitializeProcessing() { } void LoadPoint::bbUserFinalizeProcessing() { } } // EO namespace bbUtilities