]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx
#3513 CleanMeshWithPatch
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkImageThresholdConnectivity.cxx
index 25b85a633fb7aafeb8f6aa8c2dc494428a2b8492..a368cc5cc94f1f99f78329f7684b4ad52b104377 100644 (file)
@@ -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();
@@ -76,7 +77,12 @@ void ImageThresholdConnectivity::Process()
         filter->SetInputData( bbGetInputIn() );
         if (bbGetInputThreshold().size()==2)
         {
-            filter->ThresholdBetween( bbGetInputThreshold()[0] , bbGetInputThreshold()[1] );
+                       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
@@ -102,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<double> maskValue;
     maskValue.push_back(0);
     maskValue.push_back(255);
     bbSetInputMaskValue(maskValue);
-
 }
 
 //===== 
@@ -133,69 +139,6 @@ void ImageThresholdConnectivity::bbUserFinalizeProcessing()
 //    if any
 }
 
-
-//=========================================================================
-void ImageThresholdConnectivity::bbSetStatusAndPropagate(BlackBoxInputConnector* c, IOStatus s)
-{
-  bbtkBlackBoxDebugMessage("change",5,
-               "=> BlackBox::bbSetStatusAndPropagate(input,"
-               <<GetIOStatusString(s)<<")"
-               <<std::endl);
-
-  if (s==UPTODATE) bbtkError("bbSetStatusAndPropagate with status UPTODATE!");
-  c->SetStatus(s);
-
-  // Flash reaction
-  /*
-  if (bbGetBoxProcessModeValue() == Flash)
-    {
-  this->bbExecute();
-    }
-  */
-
-
-  OutputConnectorMapType::const_iterator o;
-  for ( o = bbGetOutputConnectorMap().begin();
-    o != bbGetOutputConnectorMap().end(); ++o )
-    {
-
-
-  if (o->first=="BoxChange")
-  {
-      o->second->SetStatus(UPTODATE);
-  }
-
-
-
-//EED 24/08/2015
-// EED CASPITAS 2
-  if (o->second->GetStatus()==UPTODATE)
-//    if ((o->second->GetStatus()==UPTODATE) || (o->second->GetStatus()==OUTOFDATE))
-//    if ((o->second->GetStatus()==UPTODATE) || (o->second->GetStatus()==MODIFIED))
-    {
-      o->second->SetStatus(OUTOFDATE);
-      o->second->SignalChange(GetThisPointer<BlackBox>(),o->first);
-    } // if
-  } // for
-  
-
-  if (  ( bbBoxProcessModeIsReactive()
-     || (c==bbGetInputConnectorMap().find("BoxExecute")->second))
-     && (bbCanReact() ) )
-    {
-  bbtkBlackBoxDebugMessage("change",2,
-           "-> Execution triggered by Reactive mode or BoxExecute input change"<<std::endl);
-      bbGlobalAddToExecutionList( GetThisPointer<BlackBox>() );
-    } // if
-  bbtkBlackBoxDebugMessage("change",5,
-               "<= BlackBox::bbSetStatusAndPropagate(input)"
-               <<std::endl);
-}
-//=========================================================================
-
-
-
-
 }// EO namespace bbcreaVtk