X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkImageThresholdConnectivity.cxx;h=a368cc5cc94f1f99f78329f7684b4ad52b104377;hb=a5d8e12fee1dc324ad51ef4caf0a930618ea052e;hp=a7ddb49608e71098de98f90c15ea79e3b94cbb09;hpb=f42abb6e844c616090c52099c000ff4ed8062b25;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx index a7ddb49..a368cc5 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx @@ -46,7 +46,8 @@ void ImageThresholdConnectivity::Process() if ( (bbGetInputIn()!=NULL) && (lstX.size()>0) && (lstX.size()==lstY.size()) && (lstX.size()==lstZ.size()) ) { - vtkImageThresholdConnectivity *filter = vtkImageThresholdConnectivity::New(); + if (filter!=NULL) { filter->Delete(); } + filter = vtkImageThresholdConnectivity::New(); double spc[3]; bbGetInputIn()->GetSpacing(spc); int border = bbGetInputBorder(); @@ -74,7 +75,18 @@ void ImageThresholdConnectivity::Process() } // for i filter->SetSeedPoints( points ); filter->SetInputData( bbGetInputIn() ); - filter->ThresholdBetween(10, 100); + if (bbGetInputThreshold().size()==2) + { + if ( bbGetInputThreshold()[0] < bbGetInputThreshold()[1] ) + { + filter->ThresholdBetween( bbGetInputThreshold()[0] , bbGetInputThreshold()[1] ); + } else { + filter->ThresholdBetween( bbGetInputThreshold()[1] , bbGetInputThreshold()[0] ); + }// if Thershold min max + } else { + filter->ThresholdBetween( 0, 100 ); + }// if Thershold size + // filter->SetNeighborhoodRadius (4, 4, 4 ); filter->SetInValue(255); filter->SetOutValue(0); @@ -85,7 +97,9 @@ void ImageThresholdConnectivity::Process() filter->SetSliceRangeZ(minZ-border,maxZ+border); filter->Update(); bbSetOutputOut( filter->GetOutput() ); - } // if lst + } else { + bbSetOutputOut( NULL ); + }// if lst } //===== // 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) @@ -94,13 +108,13 @@ void ImageThresholdConnectivity::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 + filter=NULL; bbSetInputIn(NULL); bbSetInputBorder(10); std::vector maskValue; maskValue.push_back(0); maskValue.push_back(255); bbSetInputMaskValue(maskValue); - } //=====