From 360978002d02369e42cb4ab8008828613e3b8bf4 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 8 Jul 2019 09:48:09 +0200 Subject: [PATCH] #3273 BBTK Bug New Normal - Bug MaskPoint Box --- packages/vtk/src/bbvtkMaskPoint.cxx | 30 ++++++++++++++--------- packages/vtk/src/bbvtkMaskPoint.h | 13 +++++++--- packages/vtk/src/bbvtkPolyDataToActor.cxx | 6 +++++ packages/vtk/src/bbvtkSurfaceTexture.cxx | 26 +++++++++++++------- packages/vtk/src/bbvtkSurfaceTexture.h | 9 ++++--- packages/wx/src/bbwxSlider.cxx | 6 +---- 6 files changed, 57 insertions(+), 33 deletions(-) diff --git a/packages/vtk/src/bbvtkMaskPoint.cxx b/packages/vtk/src/bbvtkMaskPoint.cxx index 58a2c73..061aa3d 100644 --- a/packages/vtk/src/bbvtkMaskPoint.cxx +++ b/packages/vtk/src/bbvtkMaskPoint.cxx @@ -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); diff --git a/packages/vtk/src/bbvtkMaskPoint.h b/packages/vtk/src/bbvtkMaskPoint.h index 28c9a2c..a9732d5 100644 --- a/packages/vtk/src/bbvtkMaskPoint.h +++ b/packages/vtk/src/bbvtkMaskPoint.h @@ -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) diff --git a/packages/vtk/src/bbvtkPolyDataToActor.cxx b/packages/vtk/src/bbvtkPolyDataToActor.cxx index 569bcb2..a0c8758 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.cxx +++ b/packages/vtk/src/bbvtkPolyDataToActor.cxx @@ -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) { diff --git a/packages/vtk/src/bbvtkSurfaceTexture.cxx b/packages/vtk/src/bbvtkSurfaceTexture.cxx index 76b0b6d..0016c6e 100644 --- a/packages/vtk/src/bbvtkSurfaceTexture.cxx +++ b/packages/vtk/src/bbvtkSurfaceTexture.cxx @@ -34,14 +34,13 @@ void SurfaceTexture::Process() // std::cout << "Output value = " <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) diff --git a/packages/vtk/src/bbvtkSurfaceTexture.h b/packages/vtk/src/bbvtkSurfaceTexture.h index 2ad3062..c8108c0 100644 --- a/packages/vtk/src/bbvtkSurfaceTexture.h +++ b/packages/vtk/src/bbvtkSurfaceTexture.h @@ -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,""); diff --git a/packages/wx/src/bbwxSlider.cxx b/packages/wx/src/bbwxSlider.cxx index e467c5f..0db2b07 100644 --- a/packages/wx/src/bbwxSlider.cxx +++ b/packages/wx/src/bbwxSlider.cxx @@ -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 = "<