]> Creatis software - bbtk.git/commitdiff
Clean code
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Tue, 27 Jun 2023 13:48:28 +0000 (15:48 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Tue, 27 Jun 2023 13:48:28 +0000 (15:48 +0200)
packages/vtk/src/bbvtkBinaryOperations.cxx
packages/vtk/src/bbvtkBinaryOperations.h

index b308540427ea9438c6b4b90519094283a796468b..745b9c1ae80fc407f1b2bb132be4a5829e1372c6 100644 (file)
@@ -78,36 +78,48 @@ void BinaryOperations::Process()
         bbSetOutputOut(NULL);
         return;
        }
-       switch (bbGetInputOperation())
-       {
-               case 0:
-                               ope->SetOperationToAdd();
-               break;
-               case 1:
-                               ope->SetOperationToSubtract();
-
-               break;
-               case 2:
-                               ope->SetOperationToMultiply();
-               break;
-               case 3:
-                               ope->SetOperationToDivide();
-               break;
-               case 4:
-                               ope->SetOperationToMax();
-               break;
-               case 5:
-                               ope->SetOperationToMin();
-               break;
-               default:
-                       std::cout << "Invalid Operation" << std::endl;
-                       return;
-               break;
-       }
-       ope->Modified();
-       ope->Update();
-       vtkImageData* salida = ope->GetOutput();
-       bbSetOutputOut(salida);
+    
+    if ( (bbGetInputOperation()>=0) &&  (bbGetInputOperation()<=5) )
+    {
+        switch (bbGetInputOperation())
+        {
+            case 0:
+                ope->SetOperationToAdd();
+                break;
+            case 1:
+                ope->SetOperationToSubtract();
+                break;
+            case 2:
+                ope->SetOperationToMultiply();
+                break;
+            case 3:
+                ope->SetOperationToDivide();
+                break;
+            case 4:
+                ope->SetOperationToMax();
+                break;
+            case 5:
+                ope->SetOperationToMin();
+                break;
+            default:
+                std::cout << "Invalid Operation" << std::endl;
+                return;
+                break;
+        }
+        ope->Modified();
+        ope->Update();
+        bbSetOutputOut( ope->GetOutput() );
+    }  // if operation 0..5
+
+    if ( bbGetInputOperation()==6 )
+    {
+        bbSetOutputOut( bbGetInputIn1() );
+    }
+    if ( bbGetInputOperation()==7 )
+    {
+        bbSetOutputOut( bbGetInputIn2() );
+    }
+
 //     bbSignalOutputModification();
 }
 
index 41f29e4babc32eddd1a6e6d50600ee484ae432bb..49db6b15d79e308f211d7491167e1b094a2aeeac 100644 (file)
@@ -73,7 +73,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(BinaryOperations,bbtk::AtomicBlackBox);
   BBTK_CATEGORY("filter");
   BBTK_INPUT(BinaryOperations,In1,"first image to be operated",vtkImageData*,"NULL default");
   BBTK_INPUT(BinaryOperations,In2,"second image to be operated",vtkImageData*,"NULL default");
-  BBTK_INPUT(BinaryOperations,Operation,"0:Add (default) , 1:subtract, 2:multiply, 3:divide, 4=Max, 5=Min",int,"");
+  BBTK_INPUT(BinaryOperations,Operation,"0:Add (default) , 1:subtract, 2:multiply, 3:divide, 4=Max, 5=Min, 6=Replace with In1, 7=Replace with In2",int,"");
   BBTK_OUTPUT(BinaryOperations,Out,"",vtkImageData*,"");
 BBTK_END_DESCRIBE_BLACK_BOX(BinaryOperations);
 }