]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx
#3265 creaMaracasVisu Bug New Normal - DrawAxisTree3D box
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualPaint_Model.cxx
index 5c513422088d8bcc769e309305fc8a33ead7763f..e97b39033a1cbc0bca71a1c5829bbbdd25e8c775 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()
 {
 
@@ -28,8 +34,10 @@ void ManualPaint_Model::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
 
+
        if (bbGetInputImage()!=NULL)
        {  
+
                manualpaintmodel->SetActive( bbGetInputActive() );
                manualpaintmodel->SetTool( bbGetInputTool() );
                manualpaintmodel->Set2D3D( bbGetInput2D3D() );
@@ -42,11 +50,14 @@ void ManualPaint_Model::Process()
                manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );          
                manualpaintmodel->SetRangeMin( bbGetInputRange()[0] );
                manualpaintmodel->SetRangeMax( bbGetInputRange()[1] );
+
                if (bbGetInputPoint().size()==3)
                {
                        manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
                } // if Points
 
+
+
                if ( bbGetInputByLstPointsX().size()!=0 )
                {
                        int i,size = bbGetInputByLstPointsX().size();
@@ -58,7 +69,6 @@ void ManualPaint_Model::Process()
                
                if (bbGetInputByImagePoints()!=NULL)
                {
-                       int i,j,k;
 //                     int ia,ja,ka;
 //                     int ii,jj,kk;
                        int ext[6];
@@ -72,31 +82,47 @@ void ManualPaint_Model::Process()
                        int dimX=ext[1]-ext[0]+1;
                        int dimY=ext[3]-ext[2]+1;
                        int dimZ=ext[5]-ext[4]+1;
-                       for (i=0;i<dimX;i++) 
+
+                       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 (i%20==0)
+                               if (k%50==0)
                                {
-                                       printf("ManualPaint_Model %d%\n", (int)(i*100.0/dimX) );
+                                       printf("ManualPaint_Model %d%\n", (int)(k*100.0/dimZ) );
                                }
                                for (j=0;j<dimY;j++) 
                                {
-                                       for (k=0;k<dimZ;k++) 
+                                       for (i=0;i<dimX;i++) 
                                        {
-                                               if ( bbGetInputByImagePoints()->GetScalarComponentAsDouble(i,j,k, 0)>0)
+                                               GETVALUE_VTK_CREA(vBIP,pBIP,sTBIP)
+                                               if (vBIP>0)
                                                {
-                                                       if (bbGetInputImage2()->GetScalarComponentAsDouble(i,j,k, 0)==0)
+                                                       GETVALUE_VTK_CREA(vI2,pI2,sTI2)
+                                                       if (vI2==0)
                                                        {
                                                                manualpaintmodel->PaintImage(i,j,k);
-                                                       } // bbGetInputImage2           
-                                               } // GetScalarComponentAsDouble                                         
-                                       }// for k
+                                                       } // vI2                
+                                               } // vBIP 
+                                               pBIP = pBIP + sSBIP;                            
+                                               pI2  = pI2  + sSI2;                             
+                                       }// for i
                                }// for j
-                       }// for i
+                       }// for k
+
                        printf("ManualPaint_Model %d%\n", 100 );
                } // if ByImagePoints
+
+
+
         } else {
                printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
-       } // if 
+       } // if bbGetInputImage()
+
 
        if (bbGetInputImage2()!=NULL)
        { 
@@ -106,6 +132,7 @@ void ManualPaint_Model::Process()
        } 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)