]> Creatis software - bbtk.git/commitdiff
#3273 BBTK Bug New Normal - Bug MaskPoint Box
authorEduardo DAVILA <davila@localhost.localdomain>
Mon, 8 Jul 2019 07:48:09 +0000 (09:48 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Mon, 8 Jul 2019 07:48:09 +0000 (09:48 +0200)
packages/vtk/src/bbvtkMaskPoint.cxx
packages/vtk/src/bbvtkMaskPoint.h
packages/vtk/src/bbvtkPolyDataToActor.cxx
packages/vtk/src/bbvtkSurfaceTexture.cxx
packages/vtk/src/bbvtkSurfaceTexture.h
packages/wx/src/bbwxSlider.cxx

index 58a2c739344f021adec9f3ad0871f92716aa2f94..061aa3d96dda3ed9a9d87a04d60b38d34350ddae 100644 (file)
@@ -26,19 +26,24 @@ void MaskPoint::Process()
 //    * TYPE is the C++ type of the input/output
 //      (the one provided in the attribute 'type' of the tag 'input')
 
-//EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5) 
-       maskpoints->SetInput( bbGetInputIn() );  
-#endif
-#if (VTK_MAJOR_VERSION >= 6) 
-       maskpoints->SetInputData( bbGetInputIn() );  
-#endif
 
-       maskpoints->SetOnRatio( bbGetInputRatio() );
-       maskpoints->RandomModeOn();     
-       maskpoints->SetMaximumNumberOfPoints(5000);     
-       maskpoints->Update();
-       bbSetOutputOut( maskpoints->GetOutput() );
+       if (bbGetInputActive()==true)
+       {
+       //EED 2017-01-01 Migration VTK7
+       #if (VTK_MAJOR_VERSION <= 5) 
+                       maskpoints->SetInput( bbGetInputIn() );  
+       #endif
+       #if (VTK_MAJOR_VERSION >= 6) 
+                       maskpoints->SetInputData( bbGetInputIn() );  
+       #endif
+
+               maskpoints->SetOnRatio( bbGetInputRatio() );
+               maskpoints->RandomModeOff();    
+       //      maskpoints->RandomModeOn();     
+       //      maskpoints->SetMaximumNumberOfPoints(5000);     
+               maskpoints->Update();
+               bbSetOutputOut( maskpoints->GetOutput() );
+       } // if Active
 }
 //===== 
 // 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)
@@ -48,6 +53,7 @@ void MaskPoint::bbUserSetDefaultValues()
 
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
+   bbSetInputActive( true );
    bbSetInputIn(NULL);
    bbSetOutputOut(NULL);
   
index 28c9a2c55ea06ac916d2f4b78247300f0cd32664..a9732d55ead96619666069a3a113d25a66a81480 100644 (file)
@@ -23,6 +23,7 @@ class bbvtk_EXPORT MaskPoint
 //===== 
 // 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)
 //===== 
+  BBTK_DECLARE_INPUT(Active,bool);
   BBTK_DECLARE_INPUT(In,vtkImageData*);
   BBTK_DECLARE_INPUT(Ratio,int);
   BBTK_DECLARE_OUTPUT(Out,vtkPolyData*);
@@ -38,13 +39,17 @@ class bbvtk_EXPORT MaskPoint
 };
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(MaskPoint,bbtk::AtomicBlackBox);
-BBTK_NAME("MaskPoint");
-BBTK_AUTHOR("ED at InfoDev Creatis");
-BBTK_DESCRIPTION("vtkMaskPoint. See Vectors/Tensors Examples");
-BBTK_CATEGORY("empty");
+  BBTK_NAME("MaskPoint");
+  BBTK_AUTHOR("ED at InfoDev Creatis");
+  BBTK_DESCRIPTION("vtkMaskPoint. See Vectors/Tensors Examples");
+  BBTK_CATEGORY("empty");
+
+  BBTK_INPUT(MaskPoint,Active,"(default true)  true/false",bool,"");
   BBTK_INPUT(MaskPoint,In,"vtkImageData",vtkImageData*,"");
   BBTK_INPUT(MaskPoint,Ratio,"Ratio",int,"");
+
   BBTK_OUTPUT(MaskPoint,Out,"vtkPolyData",vtkPolyData*,"");
+
 BBTK_END_DESCRIBE_BLACK_BOX(MaskPoint);
 //===== 
 // 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 569bcb25b0832dad19bc1e3dc9f4a38ab9cd4687..a0c875812132921a89eb7b11362a1b5e5f07ffce 100644 (file)
@@ -126,6 +126,12 @@ bbGetInputRenderer()->GetRenderWindow()->SetMultiSamples(0);
 bbGetInputRenderer()->GetRenderWindow()->SetAlphaBitPlanes(1);
 
 
+               if (bbGetInputRenderer()==NULL)
+               {
+                       printf("EED Warnning! PolyDataToActor::DoProcess  missing Renderer.\n");
+               }
+
+
                if (bbGetInputActive()==true)
                {
 
index 76b0b6d953f49286a4ac0530ef2917d1352640bc..0016c6eeb502c29ce1a2985119e8a679e8087418 100644 (file)
@@ -34,14 +34,13 @@ void SurfaceTexture::Process()
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
 
-       int i;
-       double spc[3];
-       double range[2];
-       int ext[6];
+       int     i;
+       double  spc[3];
+       double  range[2];
+       int     ext[6];
        bbGetInputImage()->GetSpacing(spc);
        bbGetInputImage()->GetScalarRange(range);
 
-
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        bbGetInputImage()->GetWholeExtent(ext);
@@ -144,12 +143,13 @@ void SurfaceTexture::Process()
                  colorLookupTable->SetTableValue(10,1  ,0.5,0.5,1);
                  colorLookupTable->SetTableValue(11,0.5,0.5,1  ,1);
 
-               } // type 2
+               } // type 3
 
 
+               
 
+       }  // firsttime
 
-       }
 
        bbGetInputMesh()->GetPointData()->SetScalars(colors);
 
@@ -158,6 +158,14 @@ void SurfaceTexture::Process()
                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++)
@@ -193,7 +201,7 @@ void SurfaceTexture::Process()
                } else {
                        gl=0;
                }
-               colorLookupTable->GetColor(gl, dcolor);
+               generalLookupTable->GetColor(gl, dcolor);
                colors->SetTuple3(i,255*dcolor[0],255*dcolor[1],255*dcolor[2]);         
        } // for i
        bbGetInputMesh()->Modified();   
@@ -217,7 +225,7 @@ void SurfaceTexture::bbUserSetDefaultValues()
        firsttime                               = true;
        colors                                  = NULL;
        colorLookupTable                = NULL;
-       colorLookupTableWL      = NULL;
+       colorLookupTableWL              = 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)
index 2ad306296c4d0c773080140cfaa3492bd2d39d09..c8108c0dd3ec8a8a21df7932044a42147021aa19 100644 (file)
@@ -29,15 +29,17 @@ class bbvtk_EXPORT SurfaceTexture
        BBTK_DECLARE_INPUT(ColorType,int);
        BBTK_DECLARE_INPUT(ColorLevel,double);
        BBTK_DECLARE_INPUT(ColorWindow,double);
+       BBTK_DECLARE_INPUT(ExternalLookupTable,vtkScalarsToColors*);
        BBTK_DECLARE_INPUT(Transform,vtkLinearTransform*);
 //  BBTK_DECLARE_OUTPUT(Out,double);
   BBTK_PROCESS(Process);
   void Process();
 
 
-       bool                            firsttime;
+       bool                                            firsttime;
        vtkUnsignedCharArray            *colors;
-       vtkLookupTable                  *colorLookupTable;
+       vtkScalarsToColors                      *generalLookupTable;
+       vtkLookupTable                          *colorLookupTable;
        vtkWindowLevelLookupTable       *colorLookupTableWL;
 
 //===== 
@@ -52,9 +54,10 @@ BBTK_DESCRIPTION("Surface texture");
 BBTK_CATEGORY("");
        BBTK_INPUT(SurfaceTexture,Mesh,"Mesh topology",vtkPolyData*,"");
        BBTK_INPUT(SurfaceTexture,Image,"Image Reference",vtkImageData*,"");
-       BBTK_INPUT(SurfaceTexture,ColorType,"Color Type (default 0) 0 Colors(JET), 1 ColorWindowLevel",int,"");
+       BBTK_INPUT(SurfaceTexture,ColorType,"Color Type (default 0) 0 Colors(JET-simple), 1 ColorWindowLevel, 2 Random Color, 3 Eleven colors",int,"");
        BBTK_INPUT(SurfaceTexture,ColorLevel,"Color Level (default 500)",double,"");
        BBTK_INPUT(SurfaceTexture,ColorWindow,"ColorWindow (default 500)",double,"");
+       BBTK_INPUT(SurfaceTexture,ExternalLookupTable,"External vtkScalarsToColors ",vtkScalarsToColors*,"");
        BBTK_INPUT(SurfaceTexture,Transform,"vtk Linear Transform (default NULL)",vtkLinearTransform*,"");
 //  BBTK_OUTPUT(SurfaceTexture,Out,"First output",double,"");
 
index e467c5f688a0551532d96428758b1f3d408e84cc..0db2b07fbcd3c436a0872a7a56efa418840d34fb 100644 (file)
@@ -464,12 +464,9 @@ namespace bbwx
 //--------------------------------------------------------------------------
   void Slider::CreateWidget(wxWindow* parent)
   {
-
     int orientation=0;
     if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
     if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)    { orientation=1; }
-    
-    
     //    std::cout << "bbGetWxParent = "<<bbGetWxParent()<<std::endl;
     SliderWidget *w =  new SliderWidget(this, 
                                        parent, //bbGetWxParent(),
@@ -483,8 +480,7 @@ namespace bbwx
                                        bbGetInputReactiveOnTrack()
                                        ); 
     //    std::cout << "w = "<<w<<std::endl;
-    // w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
-         
+    // w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );       
     bbSetOutputWidget( w );
   }