]> Creatis software - creaVtk.git/commitdiff
#3399 creaVtk Feature New Normal - box ApplayMask new Input BackroundToAnalice
authorEduardo DAVILA <davila@localhost.localdomain>
Mon, 20 Apr 2020 08:47:27 +0000 (10:47 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Mon, 20 Apr 2020 08:47:27 +0000 (10:47 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.h

index 74a7ce55d491baea85bcc891cab86fbd9d05cc62..52c1ed2d2ac50373316af68e4a7085a0eeaad67f 100644 (file)
@@ -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);
index 687426a4827856233be4820d906cba7c702be009..ead804f8ba01f5da997521bb4fa19b31e73c33c1 100644 (file)
@@ -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,"");