#include "bbUtilitiesCatGreyLevels.h" #include "bbUtilitiesPackage.h" namespace bbUtilities { BBTK_ADD_BLACK_BOX_TO_PACKAGE(Utilities,CatGreyLevels) BBTK_BLACK_BOX_IMPLEMENTATION(CatGreyLevels,bbtk::AtomicBlackBox); void CatGreyLevels::Process() { int num = bbGetInputIn(); double a=-1; if(num == 0){ a = GREY; bbSetOutputOut( a ); }else if(num == 1){ a = GREY+STD; bbSetOutputOut( a ); }else if(num == 2){ a = GREY+2*STD; bbSetOutputOut( a ); }else if(num == 3){ a = GREY-STD; bbSetOutputOut( a ); }else if(num == 4){ a = GREY-2*STD; bbSetOutputOut( a ); }else{ vtkImageData* img = bbGetInputImage(); std::vector poi = bbGetInputPoint(); if(!poi.empty()&&img!=NULL){ int x = poi[0]; int y = poi[1]; int z = poi[2]; unsigned short* imgpoi = (unsigned short*)img->GetScalarPointer(x, y, z); int gl = *imgpoi; if(num == 5){ a = gl*0.8; bbSetOutputOut( a ); }else if(num == 6){ a = gl*0.4; bbSetOutputOut( a ); } }else{ std::cout<<"Image or point NULL"<