]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx
#3171 creaMaracasVisu Feature New Normal - creaVTK_MACROS
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualPaint_Model.cxx
index de2b946de5bd4480bbc78899f08d27a8cc25a37e..e31a64df99e6ab1b6b8a3e7b486148c8d1a3c0eb 100644 (file)
@@ -1,8 +1,12 @@
 //===== 
 // 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)
 //===== 
+
+#include "creaVtk_MACROS.h"
 #include "bbcreaMaracasVisuManualPaint_Model.h"
 #include "bbcreaMaracasVisuPackage.h"
+
+
 namespace bbcreaMaracasVisu
 {
 
@@ -11,6 +15,8 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_Model,bbtk::AtomicBlackBox);
 //===== 
 // 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)
 //===== 
+
+
 void ManualPaint_Model::Process()
 {
 
@@ -39,20 +45,78 @@ void ManualPaint_Model::Process()
                manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
                manualpaintmodel->SetBrushForm( bbGetInputBrushForm() );
                manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() );
-               manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );
+               manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );          
                manualpaintmodel->SetRangeMin( bbGetInputRange()[0] );
                manualpaintmodel->SetRangeMax( bbGetInputRange()[1] );
-               manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
+               if (bbGetInputPoint().size()==3)
+               {
+                       manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
+               } // if Points
+
+               if ( bbGetInputByLstPointsX().size()!=0 )
+               {
+                       int i,size = bbGetInputByLstPointsX().size();
+                       for (i=0;i<size;i++)
+                       {
+                               manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
+                       } // for
+               }// if ByLstPointsX
+               
+               if (bbGetInputByImagePoints()!=NULL)
+               {
+//                     int ia,ja,ka;
+//                     int ii,jj,kk;
+                       int ext[6];
+                       bbGetInputByImagePoints()->GetWholeExtent(ext);
+                       int dimX=ext[1]-ext[0]+1;
+                       int dimY=ext[3]-ext[2]+1;
+                       int dimZ=ext[5]-ext[4]+1;
+
+                       DEF_POINTER_IMAGE_VTK_CREA(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints());
+                       DEF_POINTER_IMAGE_VTK_CREA(vI2,sSI2,pI2,sTI2,bbGetInputImage2());
+
+//#pragma omp parallel for
+
+                       int i,j,k;
+                       for (k=0;k<dimZ;k++) 
+                       {
+                               if (k%50==0)
+                               {
+                                       printf("ManualPaint_Model %d%\n", (int)(k*100.0/dimZ) );
+                               }
+                               for (j=0;j<dimY;j++) 
+                               {
+                                       for (i=0;i<dimX;i++) 
+                                       {
+                                               GETVALUE_VTK_CREA(vBIP,pBIP,sTBIP)
+                                               if (vBIP>0)
+                                               {
+                                                       GETVALUE_VTK_CREA(vI2,pI2,sTI2)
+                                                       if (vI2==0)
+                                                       {
+                                                               manualpaintmodel->PaintImage(i,j,k);
+                                                       } // vI2                
+                                               } // vBIP 
+                                               pBIP = pBIP + sSBIP;                            
+                                               pI2  = pI2  + sSI2;                             
+                                       }// for i
+                               }// for j
+                       }// for k
+
+                       printf("ManualPaint_Model %d%\n", 100 );
+               } // if ByImagePoints
         } else {
                printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
        } // if 
-//     manualpaintmodel-> GetScalarRange(double * range);
-//     manualpaintmodel-> SetUndoImage(); //DFCH
-//     manualpaintmodel-> Undo(); //DFCH
-//     manualpaintmodel-> Redo(); //DFCH
-
-
 
+       if (bbGetInputImage2()!=NULL)
+       { 
+               bbSetOutputOut( bbGetInputImage2() );
+       } else if (bbGetInputImage()!=NULL) { 
+               bbSetOutputOut( bbGetInputImage() );
+       } else { 
+               bbSetOutputOut( NULL );
+       } 
 }
 //===== 
 // 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)
@@ -85,6 +149,8 @@ void ManualPaint_Model::bbUserSetDefaultValues()
        range.push_back(0);
        range.push_back(200);
        bbSetInputRange(range);
+
+       bbSetInputByImagePoints(NULL);
   
 }
 //=====