]> Creatis software - creaVtk.git/commitdiff
Clean code
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 19 Nov 2024 22:58:38 +0000 (23:58 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 19 Nov 2024 22:58:38 +0000 (23:58 +0100)
bbtk_creaVtk_PKG/src/bbcreaVtkImageMaskDice.cxx

index 2cc87fc7004bfad3b138656aa7d97cf63fbb96d9..8d90757eef69f0bf0526f017292cb2725c5700ba 100644 (file)
@@ -33,8 +33,9 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ImageMaskDice,bbtk::AtomicBlackBox);
         LstTitles.push_back( "vol1");   LstValues.push_back( std::to_string(TP+FP) );      \
         LstTitles.push_back( "vol2");   LstValues.push_back( std::to_string(TP+FN) );      \
         if ((TP==0) && (FP==0) && (FN==0)) {                                               \
-            LstTitles.push_back( "_dice"); LstValues.push_back( "---" );                   \
+            LstTitles.push_back( "_dice"); LstValues.push_back( "-1" );                    \
         }else {                                                                            \
+            double tmp;                                                                    \
             tmp = 2 * (double)TP / (2 * (double)TP + (double)FP +  (double)FN );           \
             LstTitles.push_back( "dice"); LstValues.push_back( std::to_string(tmp) );      \
         }
@@ -54,7 +55,8 @@ void ImageMaskDice::Process()
 //      (the one provided in the attribute 'type' of the tag 'input')
 
     printf("EED ImageMaskDice::Process Start .. \n");
-    
+    long int tpAll=0        ,fpAll=0        ,fnAll=0        ;
+
     if ( (bbGetInputIn1()!=NULL) && (bbGetInputIn2()!=NULL) )
     {
         int     ext[6];
@@ -72,7 +74,6 @@ void ImageMaskDice::Process()
              (dimY1==dimY2) &&
              (dimZ1==dimZ2) )
         {
-            long int tpAll=0        ,fpAll=0        ,fnAll=0        ;
             DEF_POINTER_IMAGE_VTK_CREA(vMA,ssMA,pMA,stMA,bbGetInputIn1())
             DEF_POINTER_IMAGE_VTK_CREA(vMM,ssMM,pMM,stMM,bbGetInputIn2())
             long int i,size=dimX1*dimY1*dimZ1;
@@ -82,12 +83,9 @@ void ImageMaskDice::Process()
                 GETVALUE2_VTK_CREA(vMM,pMM,stMM,i)
                 ACUMULATE(vMA, vMM, tpAll, fpAll, fnAll)
             } // for
-            double tmp;
-            std::vector<std::string> LstTitles;
-            std::vector<std::string> LstValues;
-            INSERTINVECTOR(tpAll,fpAll,fnAll)
-            bbSetOutputLstTitles(LstTitles);
-            bbSetOutputLstValues(LstValues);
+//            INSERTINVECTOR(tpAll,fpAll,fnAll)
+//            bbSetOutputLstTitles(LstTitles);
+//            bbSetOutputLstValues(LstValues);
         } else {
             printf ("EED Warning...  creaSDRAVisu VolumeMassDice::Process  Size of images are not the same. \n");
         } // if dimXYZ I MA MM
@@ -96,6 +94,13 @@ void ImageMaskDice::Process()
     }// if
     printf("EED ImageMaskDice::Process .. End \n");
 
+    std::vector<std::string> LstTitles;
+    std::vector<std::string> LstValues;
+    INSERTINVECTOR(tpAll,fpAll,fnAll)
+    bbSetOutputLstTitles(LstTitles);
+    bbSetOutputLstValues(LstValues);
+
+    
 }
 
 //=====