]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx
#2976 creaMaracasVisu Feature New Normal - ManualContourModel_Box
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualPaint_Model.cxx
index 87c4312f5cdca38e73722cf864e3788c0f15df20..e36413448e29d70fe33e61093d2f50958584bbcd 100644 (file)
@@ -33,26 +33,73 @@ void ManualPaint_Model::Process()
                manualpaintmodel->SetActive( bbGetInputActive() );
                manualpaintmodel->SetTool( bbGetInputTool() );
                manualpaintmodel->Set2D3D( bbGetInput2D3D() );
-               manualpaintmodel->SetImage( bbGetInputImage() );
+               manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
                manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
                manualpaintmodel->SetDirection( bbGetInputDirection() );
                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 i,j,k;
+//                     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;
+                       for (i=0;i<dimX;i++) 
+                       {
+                               if (i%20==0)
+                               {
+                                       printf("ManualPaint_Model %d%\n", (int)(i*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 
-//     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)
@@ -67,6 +114,7 @@ void ManualPaint_Model::bbUserSetDefaultValues()
        bbSetInputTool(1);  // Paint
        bbSetInput2D3D(1);  // 3D
        bbSetInputImage(NULL);
+       bbSetInputImage2(NULL);
        bbSetInputGrayLevel(100);
        bbSetInputDirection(2); // XY
        bbSetInputBrushSize(3);
@@ -84,6 +132,8 @@ void ManualPaint_Model::bbUserSetDefaultValues()
        range.push_back(0);
        range.push_back(200);
        bbSetInputRange(range);
+
+       bbSetInputByImagePoints(NULL);
   
 }
 //=====