]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx
#3252 creaMaracasVisu Bug New Normal - manual paint filter fill bug setimages
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualPaint_Model.cxx
index 03207355c8ab00f6a3a75bddc35378f26b4a766d..856a509587e02650d95d5e00199a78336d7c5807 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
 {
 
@@ -13,7 +17,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_Model,bbtk::AtomicBlackBox);
 //===== 
 
 
-/*
 void ManualPaint_Model::Process()
 {
 
@@ -49,7 +52,6 @@ void ManualPaint_Model::Process()
                {
                        manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
                } // if Points
-
                if ( bbGetInputByLstPointsX().size()!=0 )
                {
                        int i,size = bbGetInputByLstPointsX().size();
@@ -58,122 +60,23 @@ void ManualPaint_Model::Process()
                                manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
                        } // for
                }// if ByLstPointsX
-               
-               if (bbGetInputByImagePoints()!=NULL)
+               if ((bbGetInputByImagePoints()!=NULL) && (bbGetInputImage2()!=NULL) )
                {
-                       int i,ii=0;
-//                     int i,j,k;
 //                     int ia,ja,ka;
 //                     int ii,jj,kk;
                        int ext[6];
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                        bbGetInputByImagePoints()->GetWholeExtent(ext);
+#else
+                       bbGetInputByImagePoints()->GetExtent(ext);
+#endif
                        int dimX=ext[1]-ext[0]+1;
                        int dimY=ext[3]-ext[2]+1;
                        int dimZ=ext[5]-ext[4]+1;
-//                     char *pByImagePoints = bbGetInputByImagePoints->GetScalarComponent(i,j,k,0);
-//                     int sizeData;
+                       DEF_POINTER_IMAGE_VTK_CREA(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints());
+                       DEF_POINTER_IMAGE_VTK_CREA(vI2,sSI2,pI2,sTI2,bbGetInputImage2());
 //#pragma omp parallel for
-                       for (i=0;i<dimX;i++) 
-                       {
-                               int j,k;
-                               ii++;
-                               if (ii%10==0)
-                               {
-                                       printf("ManualPaint_Model %d%\n", (int)(ii*100.0/dimX) );
-                               }
-                               for (j=0;j<dimY;j++) 
-                               {
-                                       for (k=0;k<dimZ;k++) 
-                                       {
-                                               if ( bbGetInputByImagePoints()->GetScalarComponentAsDouble(i,j,k, 0)>0)
-                                               {
-                                                       if (bbGetInputImage2()->GetScalarComponentAsDouble(i,j,k, 0)==0)
-                                                       {
-                                                               manualpaintmodel->PaintImage(i,j,k);
-                                                       } // bbGetInputImage2           
-                                               } // GetScalarComponentAsDouble                                         
-                                       }// for k
-                               }// for j
-                       }// for i
-                       printf("ManualPaint_Model %d%\n", 100 );
-               } // if ByImagePoints
-        } else {
-               printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
-       } // if 
-
-       if (bbGetInputImage2()!=NULL)
-       { 
-               bbSetOutputOut( bbGetInputImage2() );
-       } else if (bbGetInputImage()!=NULL) { 
-               bbSetOutputOut( bbGetInputImage() );
-       } else { 
-               bbSetOutputOut( NULL );
-       } 
-}
-*/
-
-
-
-void ManualPaint_Model::Process()
-{
-
-// THE MAIN PROCESSING METHOD BODY
-//   Here we simply set the input 'In' value to the output 'Out'
-//   And print out the output value
-// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
-//    void bbSet{Input|Output}NAME(const TYPE&)
-//    const TYPE& bbGet{Input|Output}NAME() const 
-//    Where :
-//    * NAME is the name of the input/output
-//      (the one provided in the attribute 'name' of the tag 'input')
-//    * TYPE is the C++ type of the input/output
-//      (the one provided in the attribute 'type' of the tag 'input')
-//    bbSetOutputOut( bbGetInputIn() );
-//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
-       if (bbGetInputImage()!=NULL)
-       {  
-               manualpaintmodel->SetActive( bbGetInputActive() );
-               manualpaintmodel->SetTool( bbGetInputTool() );
-               manualpaintmodel->Set2D3D( bbGetInput2D3D() );
-               manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
-               manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
-               manualpaintmodel->SetDirection( bbGetInputDirection() );
-               manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
-               manualpaintmodel->SetBrushForm( bbGetInputBrushForm() );
-               manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() );
-               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();
-                       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;
-
-                       DEFINEPOINTERIMAGE_MANUALPAINT(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints());
-                       DEFINEPOINTERIMAGE_MANUALPAINT(vI2,sSI2,pI2,sTI2,bbGetInputImage2());
-
-//#pragma omp parallel for
-
                        int i,j,k;
                        for (k=0;k<dimZ;k++) 
                        {
@@ -185,10 +88,10 @@ void ManualPaint_Model::Process()
                                {
                                        for (i=0;i<dimX;i++) 
                                        {
-                                               GETVALUE_MANUALPAINT(vBIP,pBIP,sTBIP)
+                                               GETVALUE_VTK_CREA(vBIP,pBIP,sTBIP)
                                                if (vBIP>0)
                                                {
-                                                       GETVALUE_MANUALPAINT(vI2,pI2,sTI2)
+                                                       GETVALUE_VTK_CREA(vI2,pI2,sTI2)
                                                        if (vI2==0)
                                                        {
                                                                manualpaintmodel->PaintImage(i,j,k);
@@ -199,12 +102,11 @@ void ManualPaint_Model::Process()
                                        }// 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 
+               printf("EED Warning: ByImagePoints or Image2 not set.  Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
+       } // if ((bbGetInputByImagePoints()!=NULL) && (bbGetInputImage2()!=NULL) )
 
        if (bbGetInputImage2()!=NULL)
        { 
@@ -225,30 +127,26 @@ void ManualPaint_Model::bbUserSetDefaultValues()
 //    Here we initialize the input 'In' to 0
 
        bbSetInputActive(true);
-       bbSetInputTool(1);  // Paint
-       bbSetInput2D3D(1);  // 3D
+       bbSetInputTool(1);              // Paint
+       bbSetInput2D3D(1);              // 3D
        bbSetInputImage(NULL);
        bbSetInputImage2(NULL);
        bbSetInputGrayLevel(100);
-       bbSetInputDirection(2); // XY
+       bbSetInputDirection(2);         // XY
        bbSetInputBrushSize(3);
-       bbSetInputBrushForm(1); // sphere
+       bbSetInputBrushForm(1);         // sphere
        bbSetInputToleranceFill(50);
        bbSetInputDistanceFill(25);
-
        std::vector<int> point;
        point.push_back(0);
        point.push_back(0);
        point.push_back(0);
        bbSetInputPoint(point);
-
        std::vector<double> range;
        range.push_back(0);
        range.push_back(200);
        bbSetInputRange(range);
-
        bbSetInputByImagePoints(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)