From 865feaf46cad760a6ff45748ef71154b883f950b Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 23 Apr 2021 07:17:31 +0200 Subject: [PATCH] #3458 box HausdorffDistancePointSetFilter --- ...exampleHausdorffDistancePointSetFilter.bbg | 87 ++++++++++++++----- ...exampleHausdorffDistancePointSetFilter.bbs | 30 ++++++- .../src/bbcreaVtkScalarBarActor.cxx | 20 +++-- .../src/bbcreaVtkScalarBarActor.h | 6 +- .../src/bbcreaVtkScalarsToColors.cxx | 20 +++-- .../src/bbcreaVtkScalarsToColors.h | 2 +- 6 files changed, 120 insertions(+), 45 deletions(-) diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg index 36384e6..b0ee2f2 100644 --- a/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg @@ -9,7 +9,7 @@ DESCRIPTION:Description ?? AUTHOR:Author ?? COMPLEXBOX:FALSE COMPLEXINPUTS:0 -BOXES:33 +BOXES:35 BOX creaMaracasVisu:ViewerNV:Box02 ISEXEC:FALSE @@ -21,8 +21,8 @@ FIN_BOX BOX vtk:LoadHola:Box03 ISEXEC:FALSE -216.974054:75.134614:-900.000000 -252.524054:65.134614:-900.000000 +157.002336:46.757753:-900.000000 +192.552336:36.757753:-900.000000 FIN_BOX BOX creaVtk:OutputWindow:Box06 @@ -57,8 +57,8 @@ FIN_BOX BOX creaVtk:HausdorffDistancePointSetFilter:Box13 ISEXEC:FALSE --9.508939:-63.462997:-900.000000 -46.366061:-73.462997:-900.000000 +-4.243130:-64.340632:-900.000000 +51.631870:-74.340632:-900.000000 FIN_BOX BOX vtk:PolyDataToActor:Box14 @@ -105,8 +105,8 @@ FIN_BOX BOX creaVtk:ScalarsToColors:Box19 ISEXEC:FALSE -102.571781:-16.610848:-900.000000 -144.096781:-26.610848:-900.000000 +92.332707:-30.067916:-900.000000 +133.857707:-40.067916:-900.000000 PORT Type:"100" FIN_BOX @@ -123,8 +123,8 @@ FIN_BOX BOX creaVtk:ScalarBarActor:Box23 ISEXEC:FALSE -99.560071:-63.366569:-900.000000 -140.385071:-73.366569:-900.000000 +-98.492869:-129.189186:-900.000000 +-57.667869:-139.189186:-900.000000 PORT DisplayPosition:"5 30" PORT @@ -165,8 +165,8 @@ FIN_BOX BOX wx:Slider:Box29 ISEXEC:FALSE --151.415727:-7.475713:-900.000000 --100.015727:-17.475713:-900.000000 +-151.123182:7.444080:-900.000000 +-99.723182:-2.555920:-900.000000 PORT In:"0" PORT @@ -181,8 +181,8 @@ FIN_BOX BOX std:Div:Box30 ISEXEC:FALSE --123.396427:-30.569471:-900.000000 --94.071427:-40.569471:-900.000000 +-126.614422:-18.282583:-900.000000 +-97.289422:-28.282583:-900.000000 PORT In2:"100" FIN_BOX @@ -197,8 +197,8 @@ FIN_BOX BOX wx:CheckBox:Box32 ISEXEC:FALSE --102.705134:-51.486540:-900.000000 --66.380134:-61.486540:-900.000000 +-69.062463:-23.402224:-900.000000 +-32.737463:-33.402224:-900.000000 PORT In:"true" PORT @@ -231,8 +231,8 @@ FIN_BOX BOX creaVtk:ScalarsToColors:Box36 ISEXEC:FALSE -166.160980:-15.333726:-900.000000 -207.685980:-25.333726:-900.000000 +154.166636:-25.865345:-900.000000 +195.691636:-35.865345:-900.000000 PORT Type:"100" FIN_BOX @@ -296,7 +296,19 @@ ISEXEC:FALSE -232.606583:-249.953591:-900.000000 -195.831583:-259.953591:-900.000000 FIN_BOX -CONNECTIONS:51 +BOX +std:MultipleInputs:Box47 +ISEXEC:FALSE +-166.604357:-58.947810:-900.000000 +-126.904357:-68.947810:-900.000000 +FIN_BOX +BOX +std:MultipleInputs:Box48 +ISEXEC:FALSE +-83.122100:-53.867603:-900.000000 +-43.422100:-63.867603:-900.000000 +FIN_BOX +CONNECTIONS:60 CONNECTION Box03:Out:Box02:In NumberOfControlPoints:0 @@ -334,9 +346,6 @@ CONNECTION Box19:LookupTable:Box23:LookupTable NumberOfControlPoints:0 CONNECTION -Box17:BoxChange:Box23:BoxExecute -NumberOfControlPoints:0 -CONNECTION Box17:BoxChange:Box14:BoxExecute NumberOfControlPoints:0 CONNECTION @@ -412,9 +421,6 @@ CONNECTION Box02:Renderer1:Box37:Renderer NumberOfControlPoints:0 CONNECTION -Box29:BoxChange:Box37:BoxExecute -NumberOfControlPoints:0 -CONNECTION Box03:Out:Box38:In NumberOfControlPoints:0 CONNECTION @@ -450,4 +456,37 @@ NumberOfControlPoints:0 CONNECTION Box46:Widget:Box40:Widget1 NumberOfControlPoints:0 +CONNECTION +Box27:Out:Box23:Active +NumberOfControlPoints:0 +CONNECTION +Box47:BoxChange:Box23:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box17:BoxChange:Box47:In2 +NumberOfControlPoints:0 +CONNECTION +Box27:BoxChange:Box47:In4 +NumberOfControlPoints:0 +CONNECTION +Box32:BoxChange:Box48:In2 +NumberOfControlPoints:0 +CONNECTION +Box29:BoxChange:Box48:In4 +NumberOfControlPoints:0 +CONNECTION +Box48:BoxChange:Box37:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box32:Out:Box37:Active +NumberOfControlPoints:0 +CONNECTION +Box27:BoxChange:Box15:In2 +NumberOfControlPoints:0 +CONNECTION +Box37:BoxChange:Box15:In3 +NumberOfControlPoints:0 +CONNECTION +Box23:BoxChange:Box15:In1 +NumberOfControlPoints:0 APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs index f8ebf9f..12aadc4 100644 --- a/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs @@ -128,6 +128,10 @@ new wx:OutputText Box45 new wx:OutputText Box46 +new std:MultipleInputs Box47 + +new std:MultipleInputs Box48 + connect Box03.Out Box02.In @@ -153,8 +157,6 @@ connect Box02.Renderer1 Box23.Renderer connect Box19.LookupTable Box23.LookupTable -connect Box17.BoxChange Box23.BoxExecute - connect Box17.BoxChange Box14.BoxExecute connect Box14.BoxChange Box15.In5 @@ -205,8 +207,6 @@ connect Box36.LookupTable Box37.LookupTable connect Box02.Renderer1 Box37.Renderer -connect Box29.BoxChange Box37.BoxExecute - connect Box03.Out Box38.In connect Box03.Out Box39.In @@ -231,6 +231,28 @@ connect Box43.Widget Box40.Widget2 connect Box46.Widget Box40.Widget1 +connect Box27.Out Box23.Active + +connect Box47.BoxChange Box23.BoxExecute + +connect Box17.BoxChange Box47.In2 + +connect Box27.BoxChange Box47.In4 + +connect Box32.BoxChange Box48.In2 + +connect Box29.BoxChange Box48.In4 + +connect Box48.BoxChange Box37.BoxExecute + +connect Box32.Out Box37.Active + +connect Box27.BoxChange Box15.In2 + +connect Box37.BoxChange Box15.In3 + +connect Box23.BoxChange Box15.In1 + # Complex input ports diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx index b89a701..0c4df25 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx @@ -4,7 +4,6 @@ #include "bbcreaVtkScalarBarActor.h" #include "bbcreaVtkPackage.h" -#include namespace bbcreaVtk { @@ -37,22 +36,26 @@ void ScalarBarActor::Process() if (firsttime==true) { firsttime=false; - vtkScalarBarActor* scalarbarActor = vtkScalarBarActor::New(); + scalarbarActor = vtkScalarBarActor::New(); scalarbarActor->SetLookupTable( bbGetInputLookupTable() ); scalarbarActor->SetTitle( bbGetInputTitle().c_str() ); - scalarbarActor->SetNumberOfLabels(4); + scalarbarActor->SetNumberOfLabels(5); if (bbGetInputDisplayPosition().size()==2) { scalarbarActor->SetDisplayPosition( bbGetInputDisplayPosition()[0] , bbGetInputDisplayPosition()[1] ); - } + } //if int fontsize = scalarbarActor->GetLabelTextProperty()->GetFontSize(); scalarbarActor->GetLabelTextProperty()->SetFontSize(fontsize/2); if (bbGetInputRenderer()!=NULL) { bbGetInputRenderer()->AddActor2D( scalarbarActor ); - } + } // if } // firsttime + if (scalarbarActor!=NULL) + { + scalarbarActor->SetVisibility( bbGetInputActive() ); + } // if scalarbarActor NULL } @@ -66,8 +69,11 @@ void ScalarBarActor::bbUserSetDefaultValues() // Here we initialize the input 'In' to 0 bbSetInputLookupTable(NULL); bbSetInputRenderer(NULL); - firsttime=true; - + bbSetInputTitle("Value"); + bbSetInputActive(true); + firsttime = true; + scalarbarActor = 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/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h index 4a54397..b72d797 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h @@ -10,6 +10,7 @@ #include #include #include +#include namespace bbcreaVtk { @@ -26,11 +27,13 @@ class bbcreaVtk_EXPORT ScalarBarActor BBTK_DECLARE_INPUT(DisplayPosition,std::vector); BBTK_DECLARE_INPUT(Title,std::string); BBTK_DECLARE_INPUT(Renderer,vtkRenderer*); + BBTK_DECLARE_INPUT(Active,bool); // BBTK_DECLARE_OUTPUT(Out,double); BBTK_PROCESS(Process); void Process(); bool firsttime; + vtkScalarBarActor *scalarbarActor; //===== // 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) @@ -44,8 +47,9 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ScalarBarActor,bbtk::AtomicBlackBox); BBTK_CATEGORY("empty"); BBTK_INPUT(ScalarBarActor,LookupTable,"LookupTable",vtkScalarsToColors*,""); BBTK_INPUT(ScalarBarActor,DisplayPosition,"(default EMPTY) [x,y] ",std::vector,""); - BBTK_INPUT(ScalarBarActor,Title,"Title ",std::string,""); + BBTK_INPUT(ScalarBarActor,Title,"('Value' default) Title",std::string,""); BBTK_INPUT(ScalarBarActor,Renderer,"Renderer",vtkRenderer*,""); + BBTK_INPUT(ScalarBarActor,Active,"(true default) Active true/false",bool,""); // BBTK_OUTPUT(ScalarBarActor,Out,"First output",double,""); BBTK_END_DESCRIBE_BLACK_BOX(ScalarBarActor); //===== diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx index c8ec324..ba2a9ea 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx @@ -250,19 +250,22 @@ void ScalarsToColors::Process() int iLookTable; for (iLookTable = 0; iLookTableGetTableValue( iLookTable, rgba1); - colorLookupTable->GetTableValue(NumberOfColors-1-iLookTable, rgba2); - colorLookupTable->SetTableValue(NumberOfColors-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]); - colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]); + colorLookupTable->GetTableValue( iLookTable, rgba1 ); + colorLookupTable->GetTableValue(NumberOfColors-1-iLookTable, rgba2 ); + colorLookupTable->SetTableValue(NumberOfColors-1-iLookTable, rgba1[0],rgba1[1],rgba1[2],rgba1[3] ); + colorLookupTable->SetTableValue( iLookTable, rgba2[0],rgba2[1],rgba2[2],rgba2[3] ); } // for iLookTable - double rgba[4]; - colorLookupTable->GetTableValue(0,rgba); - rgba[3]=0; - colorLookupTable->SetTableValue(0,rgba); // Transparency if (bbGetInputType()==0) { + // First Element + double rgba[4]; + colorLookupTable->GetTableValue(0,rgba); + rgba[3]=0; + colorLookupTable->SetTableValue(0,rgba); + + // Middle range int i,iMax=(NumberOfColors/16)*4; for (i=0;iGetTableValue(0,rgba); rgba[3]=0; diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h index ca1f5e3..a0652ae 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h @@ -46,7 +46,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ScalarsToColors,bbtk::AtomicBlackBox); BBTK_AUTHOR("Info-Dev"); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); - BBTK_INPUT(ScalarsToColors,Type,"(0 default) 0=JET; 100=As 0 without transparace; 1=RangeTable; 101=As 1 without transparace; 2=DirectionColorRGB; 3=ComponentColorRGB[0-255]",int,""); + BBTK_INPUT(ScalarsToColors,Type,"(0 default) 0=JET(transparent for first element and middle range); 100=As 0 without transparace; 1=RangeTable (transparent for first element); 101=As 1 without transparace; 2=DirectionColorRGB; 3=ComponentColorRGB[0-255]",int,""); BBTK_INPUT(ScalarsToColors,ScalarValue,"Scalar value -> Color OUT",double,""); BBTK_INPUT(ScalarsToColors,Range,"Min Max range",std::vector,""); BBTK_OUTPUT(ScalarsToColors,Color,"Color",std::vector,""); -- 2.47.1