#include "bbUtilitiesSegmentationLower.h" #include "bbUtilitiesPackage.h" namespace bbUtilities { BBTK_ADD_BLACK_BOX_TO_PACKAGE(Utilities,SegmentationLower) BBTK_BLACK_BOX_IMPLEMENTATION(SegmentationLower,bbtk::AtomicBlackBox); void SegmentationLower::Process() { vtkImageData *imagedata = bbGetInputIn(); std::vector position = bbGetInputPositionXYZ(); if(imagedata != NULL){ /*imagedata->UpdateInformation(); imagedata->SetUpdateExtent(imagedata->GetWholeExtent()); imagedata->Update();*/ if(thresh2==NULL){ init(); } thresh2->SetInput(imagedata); thresh2->ThresholdByUpper(bbGetInputThresholdMin()); thresh2->UpdateWholeExtent(); thresh2->Update(); //cast2->UpdateWholeExtent(); cast2->Update(); connect2->RemoveAllSeeds(); int x = position[0], y = position[1] , z = position[2]; connect2->AddSeed(x, y, z ); connect2->Update(); cast4->Update(); bbSetOutputOut(cast4->GetOutput() ); thresh2->Delete(); cast2->Delete(); connect2->Delete(); std::cout<<"Image Filtered!!! segmentation lower"<SetInValue(255); thresh2->SetOutputScalarTypeToUnsignedShort(); thresh2->SetOutValue(0.0); thresh2->ReplaceInOn(); thresh2->ReplaceOutOn(); cast2 = vtkImageCast::New(); cast2->SetInput(thresh2->GetOutput()); cast2->SetOutputScalarTypeToUnsignedChar(); //cast2->SetOutputScalarTypeToUnsignedShort(); connect2 = vtkImageSeedConnectivity::New(); connect2->SetInput(cast2->GetOutput()); connect2->SetInputConnectValue(255); connect2->SetOutputConnectedValue(255); connect2->SetOutputUnconnectedValue(0); cast4 = vtkImageCast::New(); cast4->SetInput(connect2->GetOutput()); cast4->SetOutputScalarTypeToUnsignedShort(); } void SegmentationLower::bbUserSetDefaultValues() { std::vector position; position.push_back(0); position.push_back(0); position.push_back(0); bbSetInputIn(NULL); bbSetInputThresholdMin(0); bbSetInputPositionXYZ(position); bbSetOutputOut(NULL); } void SegmentationLower::bbUserInitializeProcessing() { init(); } void SegmentationLower::bbUserFinalizeProcessing() { } } // EO namespace bbUtilities