From 72429247853aa18590e76228b2b030551323ceca Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Tue, 20 Dec 2022 15:07:13 +0100 Subject: [PATCH] #3497 MultipleOperations box average option in creaVtk --- .../src/bbcreaVtkMultipleOperations.cxx | 29 +++++++++++++------ .../src/bbcreaVtkMultipleOperations.h | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.cxx index fe7b4fa..b5b02b8 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.cxx @@ -47,7 +47,7 @@ void MultipleOperations::Process() resultImage->AllocateScalars( bbGetInputInLst()[0]->GetScalarType(),1 ); long int index,size=dimXImage*dimYImage*dimZImage; DEF_POINTER_IMAGE_VTK_CREA(vOut,ssOut,pOut,stOut,resultImage ) - if (bbGetInputType()==20) + if ((bbGetInputType()==20) || (bbGetInputType()==21) ) { long int k1omp=(double)(size-1)*0.0; @@ -59,24 +59,35 @@ long int k6omp=(double)(size-1)*1.0; printf("EED MultipleOperations::Process (with openmp)\n"); #pragma omp parallel for - for (index=0;indexGetScalarPointer() ); GETVALUE2_VTK_CREA(vIn,pIn,stIn,index) if (iLst!=0) { - acumDiff = acumDiff+abs(vIn-vInBack); - } - vInBack=vIn; + if (bbGetInputType()==20) + { + acumDiff = acumDiff+abs(vIn-vInBack); + vInBack=vIn; + } // if 20 + if (bbGetInputType()==21) + { + acumDiff = acumDiff+vIn; + } // if 20 + } } // for iLst acumDiff = acumDiff/sizeLst; SETVALUE2_VTK_CREA(acumDiff,pOut,stOut,index) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.h b/bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.h index 7eccc8c..9693c1a 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMultipleOperations.h @@ -37,7 +37,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(MultipleOperations,bbtk::AtomicBlackBox); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); BBTK_INPUT(MultipleOperations,InLst,"List input images ",std::vector,""); - BBTK_INPUT(MultipleOperations,Type,"(default 0) 0, 20 average-difference ",int,""); + BBTK_INPUT(MultipleOperations,Type,"(default 0) 0:Nothing, 20:Average-difference 21:Average",int,""); BBTK_OUTPUT(MultipleOperations,Out,"Output image",vtkImageData*,""); BBTK_END_DESCRIBE_BLACK_BOX(MultipleOperations); //===== -- 2.47.1