]> Creatis software - bbtk.git/commitdiff
#3301 BBTK Bug New Normal - SurfaceTexture
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Mon, 16 Sep 2019 13:21:23 +0000 (15:21 +0200)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Mon, 16 Sep 2019 13:21:23 +0000 (15:21 +0200)
kernel/src/bbtkBlackBox.cxx
packages/vtk/src/bbvtkPolyDataToActor.cxx
packages/vtk/src/bbvtkProbeFilter.cxx
packages/vtk/src/bbvtkSurfaceTexture.cxx

index 6fb1fb83a9c749dfce3cc545269c3f0773ad71bf..dbab39b7cb736c860741938d46adec180e771bb6 100644 (file)
@@ -55,8 +55,8 @@
 
 namespace bbtk
 {
-  static bool bbmgSomeBoxExecuting = false;
-  static bool bbmgFreezeExecution = false;
+  static bool bbmgSomeBoxExecuting     = false;
+  static bool bbmgFreezeExecution      = false;
   static std::set<BlackBox::WeakPointer> bbmgExecutionList;
 
   //=========================================================================
@@ -93,14 +93,10 @@ namespace bbtk
        if (!pack.expired()) 
          {
            Package::ReleaseBlackBoxDescriptor(pack,desc);
-         }
-       else 
-         {
+         }     else {
            bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor package expired (was not held by a package and the box was the last instance)"<<std::endl);
          }
-      }
-    else
-      {
+      } else {
        bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor expired : nothing to do (was not held by a package or the box is a complex black box prototype)"<<std::endl);
       }
     bbtkDebugMessage("object",2,"<## BlackBox::Deleter(\""<<name<<"\")"<<std::endl);
@@ -707,19 +703,18 @@ namespace bbtk
   //=========================================================================
   void BlackBox::bbRecursiveExecute( Connection::Pointer caller )
   {
-
     bbtkBlackBoxDebugMessage("process",3,
                        "=> BlackBox::bbRecursiveExecute("
                        <<(caller?caller->GetFullName():"0")<<")"
                        <<std::endl);
 
     // If already executing : return
-    if (bbGetExecuting()) 
-      {
-       bbtkBlackBoxDebugMessage("process",3,
+       if (bbGetExecuting()) 
+       {
+               bbtkBlackBoxDebugMessage("process",3,
                         " -> already executing : abort"<<std::endl);
-       return; 
-      }
+               return; 
+       }
     
     // If not initialized do it
     bbInitializeProcessing();
@@ -755,7 +750,9 @@ namespace bbtk
                           ( (bbBoxProcessModeIsManual()==true)&&(bbLetRecursiveExecuteManualMode==true) ) 
                         )
                        {
+//printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
                                this->bbProcess();              
+//printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
                    } // Manual analysis
                  
 //EED ups                      if ((bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false))
@@ -766,9 +763,7 @@ namespace bbtk
                  
                  // Update the I/O statuses
                  bbComputePostProcessStatus();
-      }
-    else 
-      {
+      }  else  {
        // Test output status...
        OutputConnectorMapType::iterator o;
        for ( o = bbGetOutputConnectorMap().begin(); 
@@ -780,11 +775,11 @@ namespace bbtk
                            <<"all inputs are Up-to-date but output '"
                            <<o->first<<"' is Out-of-date ???");
              }
-         }
+         } // for
        
         bbtkBlackBoxDebugMessage("process",3," -> Up-to-date : nothing to do"
                         <<std::endl);
-      }
+      } // if
 
     // Shows the window if the black box has one
     this->bbShowWindow(); 
@@ -797,7 +792,6 @@ namespace bbtk
     bbSetExecuting(false);
     bbGlobalSetSomeBoxExecuting(wasExecuting);
 
-
     return;
   }
   //=========================================================================
index 18a442c7464e8ee87e0878792674b6660bd3f623..2aad2ec130eb57e7ee73ab1be1e5634a342df18a 100644 (file)
@@ -108,9 +108,6 @@ namespace bbvtk
 
 void PolyDataToActor::DoProcess()
 {
-
-printf("EED PolyDataToActor::DoProcess Start\n");
-
 printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
 printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
 printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
@@ -202,9 +199,6 @@ printf("EED WARNNING!  PolyDataToActor::DoProcess  which is the default values o
                           bbGetInputRenderer()->RemoveActor( vtkactor );
                         }  // actorAdded
                } // Active
-
-printf("EED PolyDataToActor::DoProcess End\n");
-
 }
 
 
index 6dc66a9a49e6e98ea8742e51b14f1cb5099d8915..d75378b2b960c165f38753cad40ed3243f9379f5 100644 (file)
@@ -13,7 +13,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ProbeFilter,bbtk::AtomicBlackBox);
 //===== 
 void ProbeFilter::Process()
 {
-
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -25,20 +24,22 @@ void ProbeFilter::Process()
 //      (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')
+       if ( (bbGetInputSource()==NULL) || (bbGetInputInput()==NULL)  )
+       {
+                bbSetOutputOut( NULL ); 
+       } else {
+       //EED 2017-01-01 Migration VTK7
 
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
-      _probefilter->SetSource( bbGetInputSource() ); 
-      _probefilter->SetInput( bbGetInputInput() ); 
-#else
-      _probefilter->SetSourceData( bbGetInputSource() ); 
-      _probefilter->SetInputData( bbGetInputInput() ); 
-#endif
-
-      _probefilter->Update();
-      bbSetOutputOut( _probefilter->GetOutput() );
-
+       #if VTK_MAJOR_VERSION <= 5
+                 _probefilter->SetSource( bbGetInputSource() ); 
+                 _probefilter->SetInput( bbGetInputInput() ); 
+       #else
+                 _probefilter->SetSourceData( bbGetInputSource() ); 
+                 _probefilter->SetInputData( bbGetInputInput() ); 
+       #endif
+                 _probefilter->Update();
+                 bbSetOutputOut( _probefilter->GetOutput() );
+       } // if source input
 }
 //===== 
 // 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)
index c6d9bbf50401c270884b3591906920aad15ecd9f..0fe8f31492db37b5f9a9cdbdad900098ef8b1452 100644 (file)
@@ -17,8 +17,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(SurfaceTexture,bbtk::AtomicBlackBox);
 //===== 
 void SurfaceTexture::Process()
 {
-printf("EED SurfaceTexture:Process() Start\n");
-
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -34,39 +32,30 @@ printf("EED SurfaceTexture:Process() Start\n");
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
-
-
        int     i;
        double  spc[3];
        double  range[2];
        int     ext[6];
-
        if ((bbGetInputImage()!=NULL) && (bbGetInputMesh()!=NULL))
        {
-
-
                bbGetInputImage()->GetSpacing(spc);
                bbGetInputImage()->GetScalarRange(range);
-
        //EED 2017-01-01 Migration VTK7
        #if VTK_MAJOR_VERSION <= 5
                bbGetInputImage()->GetWholeExtent(ext);
        #else
                bbGetInputImage()->GetExtent(ext);
        #endif
-
                int maxX = ext[1]-ext[0]+1;
                int maxY = ext[3]-ext[2]+1;
                int maxZ = ext[5]-ext[4]+1;
-               
                if (firsttime==true)
                {
                        firsttime=false;
                        // Generate the colors for each point based on the color map
                        colors = vtkUnsignedCharArray::New(); 
                        colors->SetNumberOfComponents(3);
-                       colors->SetName("Colors");
-                       
+                       colors->SetName("Colors");      
                        // Create the color map
                        if (bbGetInputColorType()==1)
                        {
@@ -84,7 +73,6 @@ printf("EED SurfaceTexture:Process() Start\n");
                        {
                          colorLookupTable->GetTableValue(      iLookTable, rgba1);
                          colorLookupTable->GetTableValue(256-1-iLookTable, rgba2);
-
                          colorLookupTable->SetTableValue(256-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
                          colorLookupTable->SetTableValue(      iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
                        } // for iLookTable
@@ -109,7 +97,6 @@ printf("EED SurfaceTexture:Process() Start\n");
                                   1.0);
                }
        */
-
                                double rgba1[4];
                                double rgba2[4];
                                int i,j;
@@ -123,10 +110,7 @@ printf("EED SurfaceTexture:Process() Start\n");
                                  colorLookupTable->SetTableValue(j, rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
                                  colorLookupTable->SetTableValue(i, rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
                                } // for iLookTable
-
                        } // type 2
-
-
                        if (bbGetInputColorType()==3)
                        {
                                int tableSize=13;
@@ -134,7 +118,6 @@ printf("EED SurfaceTexture:Process() Start\n");
                                colorLookupTable->SetNumberOfTableValues(tableSize); 
                                colorLookupTable->SetTableRange(6,range[1]);
                                colorLookupTable->Build();
-
                          colorLookupTable->SetTableValue(0, 1  ,1      ,1      ,1);
                          colorLookupTable->SetTableValue(1, 1  ,0      ,0      ,1);
                          colorLookupTable->SetTableValue(2, 0  ,1      ,0      ,1);
@@ -142,49 +125,34 @@ printf("EED SurfaceTexture:Process() Start\n");
                          colorLookupTable->SetTableValue(4, 0  ,1      ,1      ,1);
                          colorLookupTable->SetTableValue(5, 1  ,1      ,0      ,1);
                          colorLookupTable->SetTableValue(6, 1  ,0      ,1      ,1);
-
                          colorLookupTable->SetTableValue(7, 0.5,1      ,1      ,1);
                          colorLookupTable->SetTableValue(8, 1  ,0.5,1  ,1);
                          colorLookupTable->SetTableValue(9, 1  ,1      ,0.5,1);
-
                          colorLookupTable->SetTableValue(10,1  ,0.5,0.5,1);
                          colorLookupTable->SetTableValue(11,0.5,0.5,1  ,1);
-
                        } // type 3
-
-
-                       
-
                }  // firsttime
-
-
                bbGetInputMesh()->GetPointData()->SetScalars(colors);
-
                if (bbGetInputColorType()==1)
                {
                        colorLookupTableWL->SetLevel( bbGetInputColorLevel() );
                        colorLookupTableWL->SetWindow( bbGetInputColorWindow() );
                }       
-
-
                if (bbGetInputExternalLookupTable()!=NULL) 
                {
                        generalLookupTable = bbGetInputExternalLookupTable();
                } else {
                        generalLookupTable = colorLookupTable;
                }
-                       
                int missingpoints = bbGetInputMesh()->GetNumberOfPoints() - colors->GetDataSize()/colors->GetNumberOfComponents();
                for(i = 0; i < missingpoints; i++)
                {
                        colors->InsertNextTuple3(0,0,0);
                }       
-
                if (bbGetInputTransform()!=NULL)
                {
                        bbGetInputTransform()->Update();
                }
-               
                double gl; 
                double p1[3];
                double p2[3];
@@ -200,8 +168,7 @@ printf("EED SurfaceTexture:Process() Start\n");
                        }
                        p2[0] = p2[0]/spc[0];
                        p2[1] = p2[1]/spc[1];
-                       p2[2] = p2[2]/spc[2];   
-                       
+                       p2[2] = p2[2]/spc[2];                           
                        if ( (p2[0]>=0) && (p2[0]<maxX) && (p2[1]>=0) && (p2[1]<maxY) &&(p2[2]>=0) && (p2[2]<maxZ)  )
                        {
                           gl =  bbGetInputImage()->GetScalarComponentAsDouble(round(p2[0]), round(p2[1]), round(p2[2]),0);
@@ -212,12 +179,9 @@ printf("EED SurfaceTexture:Process() Start\n");
                        colors->SetTuple3(i,255*dcolor[0],255*dcolor[1],255*dcolor[2]);         
                } // for i
                bbGetInputMesh()->Modified();   
-
        } // if Image && Mesh
-printf("EED SurfaceTexture:Process() End\n");
-
-
 }
+
 //===== 
 // 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)
 //=====