X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkImageConnectivityFilter.cxx;h=d9c051c9b297b9d94a06254097c35188d1355b7c;hb=fb686eb16e858157b1386ed49e482ca3ce15971a;hp=2f5c9e96745aa9fc6330f817bd3fa3b5d56ab20a;hpb=8b897e95b16fec9d4da9e687b750101f6f16e173;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.cxx index 2f5c9e9..d9c051c 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.cxx @@ -4,6 +4,10 @@ #include "bbcreaVtkImageConnectivityFilter.h" #include "bbcreaVtkPackage.h" +#include +#include +#include + namespace bbcreaVtk { @@ -26,12 +30,12 @@ void ImageConnectivityFilter::Process() // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') - - - if (bbGetInputIn()!=NULL){ + + if (bbGetInputIn()!=NULL) + { if (imgConnfilter) {imgConnfilter->Delete();} imgConnfilter=vtkImageConnectivityFilter::New(); - imgConnfilter->SetInputData( bbGetInputIn() ); + imgConnfilter->SetInputData( bbGetInputIn() ); if (bbGetInputExtractionMode()==0) // LargestRegion { imgConnfilter->SetExtractionModeToLargestRegion(); @@ -41,21 +45,47 @@ void ImageConnectivityFilter::Process() { printf("EED Warning!!!! ImageConnectivityFilter - AllRegions Not Implemented\n "); } // ExtractionMode - if (bbGetInputExtractionMode()==2) // SeededRegions + if (bbGetInputExtractionMode()==2) // SeedRegions { - printf("EED Warning!!!! ImageConnectivityFilter - SeededRegions Not Implemented\n "); + std::vector lstX = bbGetInputLstX(); + std::vector lstY = bbGetInputLstY(); + std::vector lstZ = bbGetInputLstZ(); + int size = lstX.size(); + if ( (lstX.size()>0) && (lstX.size()==lstY.size()) && (lstX.size()==lstZ.size()) ) + { + int i; + double p[3]; + vtkPoints *points = vtkPoints::New(); + for (i=0; iInsertNextPoint(p); + } // for i + vtkPolyData *seedData = vtkPolyData::New(); + seedData->SetPoints( points ); +// vtkUnsignedCharArray *seedScalars = vtkUnsignedCharArray::New(); +// seedScalars->InsertNextValue(100); +// seedData->GetPointData()->SetScalars(seedScalars); + seedData->GetPointData()->SetScalars(nullptr); + + imgConnfilter->SetExtractionModeToSeededRegions(); + imgConnfilter->SetSeedData( seedData ); +// imgConnfilter->SetSizeRange(0, 99); + } // if lst + } // ExtractionMode if (bbGetInputScalarRange().size()==2) { imgConnfilter->SetScalarRange( bbGetInputScalarRange()[0], bbGetInputScalarRange()[1] ); } // Range - imgConnfilter->Update(); + imgConnfilter->Update( ); bbSetOutputOut( imgConnfilter->GetOutput() ); } else { printf("EED Warning!!!! ImageConnectivityFilter - Input image not defined.\n "); }// In - } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)