]> Creatis software - creaVtk.git/commitdiff
#3458 box HausdorffDistancePointSetFilter
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 23 Apr 2021 05:17:31 +0000 (07:17 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 23 Apr 2021 05:17:31 +0000 (07:17 +0200)
bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg
bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs
bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h
bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h

index 36384e6735d2466aec6cf1526e547cb89e0ef395..b0ee2f29dee5a40dadfa6e81c31699746d65e72e 100644 (file)
@@ -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
index f8ebf9fca68964a176a7c985d02652afa7f56a1c..12aadc4be7503b669d2e8854ad071573a0df2da0 100644 (file)
@@ -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
index b89a7012c2af1401a5311033c3e700a2551bb0d7..0c4df25a11f6d93ee9f82264e5dd7cbdb0ad0983 100644 (file)
@@ -4,7 +4,6 @@
 #include "bbcreaVtkScalarBarActor.h"
 #include "bbcreaVtkPackage.h"
 
-#include <vtkScalarBarActor.h>
 
 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)
index 4a54397d6227c3be0955ff866fe0c6f762bbc933..b72d79751904f1f2dd40efe50372bd09913c7b3c 100644 (file)
@@ -10,6 +10,7 @@
 #include <vtkRenderer.h>
 #include <vtkScalarsToColors.h>
 #include <vtkTextProperty.h>
+#include <vtkScalarBarActor.h>
 
 namespace bbcreaVtk
 {
@@ -26,11 +27,13 @@ class bbcreaVtk_EXPORT ScalarBarActor
   BBTK_DECLARE_INPUT(DisplayPosition,std::vector<double>);
   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<double>,"");
-  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);
 //===== 
index c8ec324d11e1a0a3bc7e9f25c065cd039431948c..ba2a9eafe204b8fa1053bbfcbe39c61de0100a1d 100644 (file)
@@ -250,19 +250,22 @@ void ScalarsToColors::Process()
                        int iLookTable;
                        for (iLookTable = 0; iLookTable<NumberOfColorsHalf; iLookTable++)
                        {
-                               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]);
+                               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;i<iMax;i++)
                                {
@@ -297,6 +300,7 @@ void ScalarsToColors::Process()
                        // Transparency
                        if (bbGetInputType()==1) 
                        {
+                               // First Element
                                double rgba[4];
                                colorLookupTable->GetTableValue(0,rgba);
                                rgba[3]=0;
index ca1f5e3b003a86885f1581af30761819b92bb8da..a0652ae639695081245c1eef99ffb02b097d5b63 100644 (file)
@@ -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<double>,"");
   BBTK_OUTPUT(ScalarsToColors,Color,"Color",std::vector<double>,"");