From 484e89eb49fd85ad27c8e6d81fa550d8895e799b Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 20 Apr 2020 10:47:27 +0200 Subject: [PATCH] #3399 creaVtk Feature New Normal - box ApplayMask new Input BackroundToAnalice --- bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx | 41 +++++++++++---------- bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.h | 6 ++- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx index 74a7ce5..52c1ed2 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx @@ -34,17 +34,20 @@ void ApplyMask::Process() if ((bbGetInputImage()!=NULL) && (bbGetInputMask()!=NULL)) { - int extImage[6]; - int extMask[6]; - vtkImageData *resultImage=NULL; + int extImage[6]; + int extMask[6]; + vtkImageData *resultImage=NULL; bbGetInputImage()->GetExtent( extImage ); bbGetInputImage()->GetExtent( extMask ); - int dimXImage = extImage[1]-extImage[0]+1; - int dimYImage = extImage[3]-extImage[2]+1; - int dimZImage = extImage[5]-extImage[4]+1; - int dimXMask = extMask[1]-extMask[0]+1; - int dimYMask = extMask[3]-extMask[2]+1; - int dimZMask = extMask[5]-extMask[4]+1; + int dimXImage = extImage[1]-extImage[0]+1; + int dimYImage = extImage[3]-extImage[2]+1; + int dimZImage = extImage[5]-extImage[4]+1; + int dimXMask = extMask[1]-extMask[0]+1; + int dimYMask = extMask[3]-extMask[2]+1; + int dimZMask = extMask[5]-extMask[4]+1; + + double background = bbGetInputBackground(); + double bgToAnalice = bbGetInputBackgroundToAnalice(); if (bbGetInputType()==0) { @@ -92,38 +95,37 @@ void ApplyMask::Process() if (bbGetInputType()==0) //Applay mask to new Image { GETVALUE2_VTK_CREA(vI,pI,stI,i); - if (vM!=0) + if (vM!=bgToAnalice) { vO = vI; } else { - vO = bbGetInputBackground(); - } + vO = background; + } // if vM SETVALUE2_VTK_CREA(vO,pO,stO,i); } // if Type==0 if (bbGetInputType()==1) //Modifiy the Input image with the Label value in Mask place { - if (vM!=0) + if (vM!=bgToAnalice) { vO = bbGetInputLabel(); SETVALUE2_VTK_CREA(vO,pO,stO,i); } - } // if Type==0 + } // if Type==1 if (bbGetInputType()==2) //Modifiy the Input image with the Mask value { - if (vM!=0) + if (vM!=bgToAnalice) { vO = vM; SETVALUE2_VTK_CREA(vO,pO,stO,i); } - } // if Type==0 + } // if Type==2 } // for } //if dim - bbSetOutputOut( resultImage ); + bbSetOutputOut( resultImage ); } // if Image && Mask - } //===== // 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) @@ -135,7 +137,8 @@ void ApplyMask::bbUserSetDefaultValues() // Here we initialize the input 'In' to 0 bbSetInputImage(NULL); bbSetInputMask(NULL); - bbSetInputBackground(0); + bbSetInputBackground(0); // output image Type 0 + bbSetInputBackgroundToAnalice(0); bbSetInputLabel(255); bbSetInputType(0); bbSetOutputOut(NULL); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.h b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.h index 687426a..ead804f 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.h @@ -21,6 +21,7 @@ class bbcreaVtk_EXPORT ApplyMask // 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) //===== BBTK_DECLARE_INPUT(Background,double); + BBTK_DECLARE_INPUT(BackgroundToAnalice,double); BBTK_DECLARE_INPUT(Label,double); BBTK_DECLARE_INPUT(Image,vtkImageData*); BBTK_DECLARE_INPUT(Mask,vtkImageData*); @@ -38,8 +39,9 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ApplyMask,bbtk::AtomicBlackBox); BBTK_AUTHOR("InfoDev"); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); - BBTK_INPUT(ApplyMask,Background,"Background value",double,""); - BBTK_INPUT(ApplyMask,Label,"(double 255) Label value (type 1,2)",double,""); + BBTK_INPUT(ApplyMask,Background,"(default 0) type 0: Background value in output image type 1: Nothing type 2: Nothing",double,""); + BBTK_INPUT(ApplyMask,BackgroundToAnalice,"(default 0) Background to check in the mask ",double,""); + BBTK_INPUT(ApplyMask,Label,"(double 255) type 0: Nothing type 1: valueOut in the mask type 2: Nothing ",double,""); BBTK_INPUT(ApplyMask,Image,"Input image",vtkImageData*,""); BBTK_INPUT(ApplyMask,Mask,"Input mask",vtkImageData*,""); BBTK_INPUT(ApplyMask,Type,"(default 0) 0:Create new image 1:Modify the Image input with Label value at the mask place 2: Modify the Image input with the value of the mask",int,""); -- 2.47.1