From 7974fa8edc4d5d963f0b0a559ea5b414dba786b4 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Tue, 19 Nov 2024 23:58:38 +0100 Subject: [PATCH] Clean code --- .../src/bbcreaVtkImageMaskDice.cxx | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageMaskDice.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageMaskDice.cxx index 2cc87fc..8d90757 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageMaskDice.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageMaskDice.cxx @@ -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 LstTitles; - std::vector 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 LstTitles; + std::vector LstValues; + INSERTINVECTOR(tpAll,fpAll,fnAll) + bbSetOutputLstTitles(LstTitles); + bbSetOutputLstValues(LstValues); + + } //===== -- 2.47.1