#include "bbUtilitiesGreyLevel.h" #include "bbUtilitiesPackage.h" namespace bbUtilities { BBTK_ADD_BLACK_BOX_TO_PACKAGE(Utilities,GreyLevel) //BBTK_USER_BLACK_BOX_IMPLEMENTATION(GreyLevel,bbtk::AtomicBlackBox); BBTK_BLACK_BOX_IMPLEMENTATION(GreyLevel,bbtk::AtomicBlackBox); void GreyLevel::Process() { std::string dir = bbGetInputDSDirectoy(); std::string fileName = bbGetInputFileNameManualPoints(); std::string imageFile = "image", tempimg="", temppath = "", vessel = "vessel", tempvessel =""; std::ofstream file1; temppath = dir + "\\"+"GreyLevel.csv"; file1.open( temppath.c_str() ); if(file1.is_open()){ file1 << "Dataset Number" << ";" << "Vessel Number" << ";" << "x coord" << ";" << "y coord" << ";" << "z coord" << ";" << "Greylevel"<< std::endl; for(int i = 0; i < 24; i++){ temppath = dir + "\\dataset"+getNumber(i); tempimg = temppath+"\\"+imageFile+getNumber(i)+".mhd"; mir->SetFileName(tempimg.c_str()); if(mir->CanReadFile(tempimg.c_str())){ mir->Update(); img = mir->GetOutput(); if(img!=NULL){ for(int j = 0; j < 4; j++){ tempvessel = temppath+"\\"+vessel; tempvessel+=j+48; tempvessel+="\\"+fileName; double x=-1, y=-1, z=-1; getPoint(tempvessel, &x, &y, &z); if(x != -1 && y != -1 && z != -1){ double spc[3]; img->GetSpacing(spc); x = x; y = y; z = z; unsigned short* greylevel = (unsigned short*)img->GetScalarPointer(x/spc[0], y/spc[1], z/spc[2]); file1 << "Dataset" << getNumber(i) << ";" << vessel < 5){ std::string xs=line.substr(0,pos); std::string ys=line.substr(pos+1,pos2); std::string zs=line.substr(pos2+1,size); *x=atof(xs.c_str()); *y=atof(ys.c_str()); *z=atof(zs.c_str()); cout<< *x <<" "<< *y <<" "<< *z < 0); if(num < 10){ result ="0"+result; } return result; } void GreyLevel::bbUserSetDefaultValues() { } void GreyLevel::bbUserInitializeProcessing() { mir = vtkMetaImageReader::New(); } void GreyLevel::bbUserFinalizeProcessing() { } } // EO namespace bbUtilities