]> Creatis software - creaVtk.git/commitdiff
#3498 Connectivity Filter Threshold
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 29 Dec 2022 14:38:27 +0000 (15:38 +0100)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 29 Dec 2022 14:38:27 +0000 (15:38 +0100)
bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.h

index a7ddb49608e71098de98f90c15ea79e3b94cbb09..25b85a633fb7aafeb8f6aa8c2dc494428a2b8492 100644 (file)
@@ -74,7 +74,13 @@ void ImageThresholdConnectivity::Process()
         } // for i
         filter->SetSeedPoints( points );
         filter->SetInputData( bbGetInputIn() );
-        filter->ThresholdBetween(10, 100);
+        if (bbGetInputThreshold().size()==2)
+        {
+            filter->ThresholdBetween( bbGetInputThreshold()[0] , bbGetInputThreshold()[1] );
+        } else {
+            filter->ThresholdBetween( 0, 100 );
+        }// if Thershold size
+        
     //    filter->SetNeighborhoodRadius (4, 4, 4 );
         filter->SetInValue(255);
         filter->SetOutValue(0);
@@ -85,7 +91,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)
@@ -125,6 +133,69 @@ 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
 
 
index ec9bcfad544381158d35f945741b89f6a68b17b3..fc45bf2f0dc0f64dbda558ce1de4fd112716a9ed 100644 (file)
@@ -27,11 +27,18 @@ class bbcreaVtk_EXPORT ImageThresholdConnectivity
   BBTK_DECLARE_INPUT(LstX,std::vector<int>);
   BBTK_DECLARE_INPUT(LstY,std::vector<int>);
   BBTK_DECLARE_INPUT(LstZ,std::vector<int>);
+  BBTK_DECLARE_INPUT(Threshold,std::vector<double>);
   BBTK_DECLARE_INPUT(MaskValue,std::vector<double>);
   BBTK_DECLARE_INPUT(Border,int);
   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
   BBTK_PROCESS(Process);
   void Process();
+    
+    
+    virutal void bbSetStatusAndPropagate(BlackBoxInputConnector* c, IOStatus s);
+
+
+    
 //===== 
 // 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)
 //===== 
@@ -49,6 +56,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageThresholdConnectivity,bbtk::AtomicBlackBox);
   BBTK_INPUT(ImageThresholdConnectivity,LstY,"LstY seeds in voxels",std::vector<int>,"");
   BBTK_INPUT(ImageThresholdConnectivity,LstZ,"LstZ seeds in voxels",std::vector<int>,"");
   BBTK_INPUT(ImageThresholdConnectivity,MaskValue,"( default [O 255] )    [Out In] values of the output mask",std::vector<double>,"");
+  BBTK_INPUT(ImageThresholdConnectivity,Threshold,"( default [O 100] )    [down upper] threshold to be segmented",std::vector<double>,"");
   BBTK_INPUT(ImageThresholdConnectivity,Border,"(default 10)Border of the min and max positions",int,"");
 
   BBTK_OUTPUT(ImageThresholdConnectivity,Out,"Output image",vtkImageData*,"");