#include "bbcreaVtkImageConnectivityFilter.h"
#include "bbcreaVtkPackage.h"
+#include <vtkPolyData.h>
+#include <vtkPoints.h>
+#include <vtkPointData.h>
+
namespace bbcreaVtk
{
// (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();
{
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<double> lstX = bbGetInputLstX();
+ std::vector<double> lstY = bbGetInputLstY();
+ std::vector<double> 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; i<size; i++)
+ {
+ p[0] = lstX[i];
+ p[1] = lstY[i];
+ p[2] = lstZ[i];
+ points->InsertNextPoint(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)
bbSetInputIn(NULL);
// bbSetInputScalarRange();
imgConnfilter=NULL;
-
+ bbSetInputExtractionMode(0);
+
}
//=====
// 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)