#include "bbUtilitiesImageThreshold.h" #include "bbUtilitiesPackage.h" namespace bbUtilities { BBTK_ADD_BLACK_BOX_TO_PACKAGE(Utilities,ImageThreshold) BBTK_BLACK_BOX_IMPLEMENTATION(ImageThreshold,bbtk::AtomicBlackBox); void ImageThreshold::Process() { vtkImageData* image= bbGetInputIn(); double upper=bbGetInputUpper(); double lower = bbGetInputLower(); if(image !=NULL) { /* if (filter!=NULL) { filter->Delete(); filter=NULL; } */ //filter = vtkImageThreshold::New(); filter->SetInput(image); filter->ThresholdBetween(lower,upper); filter->SetInValue(255.0); filter->SetOutValue(0.0); filter->ReplaceInOn(); filter->ReplaceOutOn(); filter->Update(); bbSetOutputOut( filter->GetOutput()); } } void ImageThreshold::bbUserSetDefaultValues() { bbSetInputIn(NULL); bbSetInputUpper(1904.0); bbSetInputLower(1174.0); bbSetOutputOut(NULL); filter = NULL; } void ImageThreshold::bbUserInitializeProcessing() { filter = vtkImageThreshold::New(); } void ImageThreshold::bbUserFinalizeProcessing() { } } // EO namespace bbUtilities