From: Eduardo DAVILA Date: Thu, 22 Apr 2021 15:47:03 +0000 (+0200) Subject: #3458 box HausdorffDistancePointSetFilter X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9cd91c842e8da723181e6cfa0bd237ecc9d41173;p=creaVtk.git #3458 box HausdorffDistancePointSetFilter --- diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg new file mode 100644 index 0000000..36384e6 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg @@ -0,0 +1,453 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/C11/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:33 +BOX +creaMaracasVisu:ViewerNV:Box02 +ISEXEC:FALSE +296.629210:12.955195:-900.000000 +360.349210:2.955195:-900.000000 +PORT +nTypeView:"6" +FIN_BOX +BOX +vtk:LoadHola:Box03 +ISEXEC:FALSE +216.974054:75.134614:-900.000000 +252.524054:65.134614:-900.000000 +FIN_BOX +BOX +creaVtk:OutputWindow:Box06 +ISEXEC:TRUE +1.434151:-390.631803:-900.000000 +42.034151:-400.631803:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box07 +ISEXEC:TRUE +84.617219:-387.180899:-900.000000 +123.697219:-397.180899:-900.000000 +PORT +Orientation:"H" +PORT +Proportion:"30" +FIN_BOX +BOX +wx:LayoutLine:Box08 +ISEXEC:FALSE +28.433535:-355.027567:-900.000000 +85.993535:-365.027567:-900.000000 +FIN_BOX +BOX +vtk:UpdateRender:Box10 +ISEXEC:FALSE +53.348954:-232.163398:-900.000000 +93.673954:-242.163398:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +creaVtk:HausdorffDistancePointSetFilter:Box13 +ISEXEC:FALSE +-9.508939:-63.462997:-900.000000 +46.366061:-73.462997:-900.000000 +FIN_BOX +BOX +vtk:PolyDataToActor:Box14 +ISEXEC:FALSE +-5.815841:-151.204618:-900.000000 +39.424159:-161.204618:-900.000000 +PORT +Colour:"1 0 1" +PORT +ScalarVisibility:"true" +PORT +ScalarVisibilityOn_NameColorArray:"Distance" +FIN_BOX +BOX +std:MultipleInputs:Box15 +ISEXEC:FALSE +-14.222548:-181.438246:-900.000000 +25.477452:-191.438246:-900.000000 +FIN_BOX +BOX +wx:Slider:Box17 +ISEXEC:FALSE +-268.774700:-17.240416:-900.000000 +-217.374700:-27.240416:-900.000000 +PORT +In:"0" +PORT +Label:"true" +PORT +Max:"100" +PORT +ReactiveOnTrack:"true" +PORT +Title:"Opacity" +FIN_BOX +BOX +std:Div:Box18 +ISEXEC:FALSE +-239.724516:-35.067991:-900.000000 +-210.399516:-45.067991:-900.000000 +PORT +In2:"100" +FIN_BOX +BOX +creaVtk:ScalarsToColors:Box19 +ISEXEC:FALSE +102.571781:-16.610848:-900.000000 +144.096781:-26.610848:-900.000000 +PORT +Type:"100" +FIN_BOX +BOX +wx:LayoutLine:Box21 +ISEXEC:FALSE +-244.045924:-76.548342:-900.000000 +-186.485924:-86.548342:-900.000000 +PORT +Orientation:"H" +PORT +WinTitle:"Surface A" +FIN_BOX +BOX +creaVtk:ScalarBarActor:Box23 +ISEXEC:FALSE +99.560071:-63.366569:-900.000000 +140.385071:-73.366569:-900.000000 +PORT +DisplayPosition:"5 30" +PORT +Title:"DistAtoB" +FIN_BOX +BOX +std:ConcatStrings:Box26 +ISEXEC:FALSE +40.116283:-131.073416:-900.000000 +79.841283:-141.073416:-900.000000 +PORT +In1:"0" +PORT +In2:" " +FIN_BOX +BOX +wx:CheckBox:Box27 +ISEXEC:FALSE +-230.713713:-50.042390:-900.000000 +-194.388713:-60.042390:-900.000000 +PORT +In:"true" +PORT +Title:"Hausdorff" +FIN_BOX +BOX +vtk:PolyDataToActor:Box28 +ISEXEC:FALSE +144.583506:-160.381381:-900.000000 +189.823506:-170.381381:-900.000000 +PORT +Colour:"1 1 0" +PORT +ScalarVisibility:"true" +PORT +ScalarVisibilityOn_NameColorArray:"Distance" +FIN_BOX +BOX +wx:Slider:Box29 +ISEXEC:FALSE +-151.415727:-7.475713:-900.000000 +-100.015727:-17.475713:-900.000000 +PORT +In:"0" +PORT +Label:"true" +PORT +Max:"100" +PORT +ReactiveOnTrack:"true" +PORT +Title:"Opacity" +FIN_BOX +BOX +std:Div:Box30 +ISEXEC:FALSE +-123.396427:-30.569471:-900.000000 +-94.071427:-40.569471:-900.000000 +PORT +In2:"100" +FIN_BOX +BOX +wx:LayoutLine:Box31 +ISEXEC:FALSE +-143.091108:-78.667405:-900.000000 +-85.531108:-88.667405:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:CheckBox:Box32 +ISEXEC:FALSE +-102.705134:-51.486540:-900.000000 +-66.380134:-61.486540:-900.000000 +PORT +In:"true" +PORT +Title:"Hausdorff" +FIN_BOX +BOX +wx:LayoutTab:Box33 +ISEXEC:FALSE +-242.607538:-103.970480:-900.000000 +-185.047538:-113.970480:-900.000000 +FIN_BOX +BOX +wx:LayoutTab:Box34 +ISEXEC:FALSE +-144.671933:-105.710866:-900.000000 +-87.111933:-115.710866:-900.000000 +PORT +WinTitle:"Surface B" +FIN_BOX +BOX +std:ConcatStrings:Box35 +ISEXEC:FALSE +184.752770:-123.184507:-900.000000 +224.477770:-133.184507:-900.000000 +PORT +In1:"0" +PORT +In2:" " +FIN_BOX +BOX +creaVtk:ScalarsToColors:Box36 +ISEXEC:FALSE +166.160980:-15.333726:-900.000000 +207.685980:-25.333726:-900.000000 +PORT +Type:"100" +FIN_BOX +BOX +creaVtk:ScalarBarActor:Box37 +ISEXEC:FALSE +172.652599:-65.711863:-900.000000 +213.477599:-75.711863:-900.000000 +PORT +Title:"DistBtoA" +FIN_BOX +BOX +vtk:MarchingCubes:Box38 +ISEXEC:FALSE +85.703833:23.290306:-900.000000 +127.503833:13.290306:-900.000000 +PORT +Value:"2000" +FIN_BOX +BOX +vtk:MarchingCubes:Box39 +ISEXEC:FALSE +138.163210:20.820758:-900.000000 +179.963210:10.820758:-900.000000 +PORT +Value:"1550" +FIN_BOX +BOX +wx:LayoutLine:Box40 +ISEXEC:FALSE +-168.946872:-272.505294:-900.000000 +-111.386872:-282.505294:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box43 +ISEXEC:FALSE +-192.398986:-249.561605:-900.000000 +-155.623986:-259.561605:-900.000000 +PORT +Title:"Retative Distance A to B" +FIN_BOX +BOX +wx:OutputText:Box44 +ISEXEC:FALSE +-150.058217:-249.000135:-900.000000 +-113.283217:-259.000135:-900.000000 +PORT +Title:"Retative Distance B to A" +FIN_BOX +BOX +wx:OutputText:Box45 +ISEXEC:FALSE +-105.995753:-246.824890:-900.000000 +-69.220753:-256.824890:-900.000000 +PORT +Title:"Hausdorff Distance" +FIN_BOX +BOX +wx:OutputText:Box46 +ISEXEC:FALSE +-232.606583:-249.953591:-900.000000 +-195.831583:-259.953591:-900.000000 +FIN_BOX +CONNECTIONS:51 +CONNECTION +Box03:Out:Box02:In +NumberOfControlPoints:0 +CONNECTION +Box02:Widget:Box07:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box08:Widget:Box07:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box10:Renderer +NumberOfControlPoints:0 +CONNECTION +Box15:BoxChange:Box10:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box17:Out:Box18:In1 +NumberOfControlPoints:0 +CONNECTION +Box18:Out:Box14:Opacity +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box14:Renderer +NumberOfControlPoints:0 +CONNECTION +Box19:LookupTable:Box14:ScalarVisibilityOn_LookupTable +NumberOfControlPoints:0 +CONNECTION +Box17:Widget:Box21:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box23:Renderer +NumberOfControlPoints:0 +CONNECTION +Box19:LookupTable:Box23:LookupTable +NumberOfControlPoints:0 +CONNECTION +Box17:BoxChange:Box23:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box17:BoxChange:Box14:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box14:BoxChange:Box15:In5 +NumberOfControlPoints:0 +CONNECTION +Box13:OutA:Box14:In +NumberOfControlPoints:0 +CONNECTION +Box26:Out:Box14:ScalarVisibilityOn_ScalarRange +NumberOfControlPoints:0 +CONNECTION +Box13:RelativeDistanceAtoB:Box26:In3 +NumberOfControlPoints:0 +CONNECTION +Box27:Out:Box14:ScalarVisibility +NumberOfControlPoints:0 +CONNECTION +Box27:Widget:Box21:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box29:Out:Box30:In1 +NumberOfControlPoints:0 +CONNECTION +Box29:Widget:Box31:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box32:Widget:Box31:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box21:Widget:Box33:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box33:Widget:Box08:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box31:Widget:Box34:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box34:Widget:Box08:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box30:Out:Box28:Opacity +NumberOfControlPoints:0 +CONNECTION +Box29:BoxChange:Box28:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box28:BoxChange:Box15:In7 +NumberOfControlPoints:0 +CONNECTION +Box13:RelativeDistanceBtoA:Box35:In3 +NumberOfControlPoints:0 +CONNECTION +Box35:Out:Box28:ScalarVisibilityOn_ScalarRange +NumberOfControlPoints:0 +CONNECTION +Box13:OutB:Box28:In +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box28:Renderer +NumberOfControlPoints:0 +CONNECTION +Box32:Out:Box28:ScalarVisibility +NumberOfControlPoints:0 +CONNECTION +Box36:LookupTable:Box28:ScalarVisibilityOn_LookupTable +NumberOfControlPoints:0 +CONNECTION +Box36:LookupTable:Box37:LookupTable +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box37:Renderer +NumberOfControlPoints:0 +CONNECTION +Box29:BoxChange:Box37:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box03:Out:Box38:In +NumberOfControlPoints:0 +CONNECTION +Box03:Out:Box39:In +NumberOfControlPoints:0 +CONNECTION +Box38:Out:Box13:InA +NumberOfControlPoints:0 +CONNECTION +Box39:Out:Box13:InB +NumberOfControlPoints:0 +CONNECTION +Box40:Widget:Box08:Widget7 +NumberOfControlPoints:0 +CONNECTION +Box44:Widget:Box40:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box13:HausdorffDistance:Box45:In +NumberOfControlPoints:0 +CONNECTION +Box13:RelativeDistanceAtoB:Box43:In +NumberOfControlPoints:0 +CONNECTION +Box13:RelativeDistanceBtoA:Box44:In +NumberOfControlPoints:0 +CONNECTION +Box45:Widget:Box40:Widget5 +NumberOfControlPoints:0 +CONNECTION +Box43:Widget:Box40:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box46:Widget:Box40:Widget1 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs new file mode 100644 index 0000000..f8ebf9f --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs @@ -0,0 +1,238 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /home/davila/Creatis/C11/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleHausdorffDistancePointSetFilter.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaMaracasVisu +include vtk +include creaVtk +include wx +include std + +author "Author ??" +description "Description ??" +category "" + +new creaMaracasVisu:ViewerNV Box02 + set Box02.nTypeView "6" + +new vtk:LoadHola Box03 + +new creaVtk:OutputWindow Box06 + +new wx:LayoutSplit Box07 + set Box07.Orientation "H" + set Box07.Proportion "30" + +new wx:LayoutLine Box08 + +new vtk:UpdateRender Box10 + set Box10.Active "true" + +new creaVtk:HausdorffDistancePointSetFilter Box13 + +new vtk:PolyDataToActor Box14 + set Box14.Colour "1 0 1" + set Box14.ScalarVisibility "true" + set Box14.ScalarVisibilityOn_NameColorArray "Distance" + +new std:MultipleInputs Box15 + +new wx:Slider Box17 + set Box17.In "0" + set Box17.Label "true" + set Box17.Max "100" + set Box17.ReactiveOnTrack "true" + set Box17.Title "Opacity" + +new std:Div Box18 + set Box18.In2 "100" + +new creaVtk:ScalarsToColors Box19 + set Box19.Type "100" + +new wx:LayoutLine Box21 + set Box21.Orientation "H" + set Box21.WinTitle "Surface A" + +new creaVtk:ScalarBarActor Box23 + set Box23.DisplayPosition "5 30" + set Box23.Title "DistAtoB" + +new std:ConcatStrings Box26 + set Box26.In1 "0" + set Box26.In2 " " + +new wx:CheckBox Box27 + set Box27.In "true" + set Box27.Title "Hausdorff" + +new vtk:PolyDataToActor Box28 + set Box28.Colour "1 1 0" + set Box28.ScalarVisibility "true" + set Box28.ScalarVisibilityOn_NameColorArray "Distance" + +new wx:Slider Box29 + set Box29.In "0" + set Box29.Label "true" + set Box29.Max "100" + set Box29.ReactiveOnTrack "true" + set Box29.Title "Opacity" + +new std:Div Box30 + set Box30.In2 "100" + +new wx:LayoutLine Box31 + set Box31.Orientation "H" + +new wx:CheckBox Box32 + set Box32.In "true" + set Box32.Title "Hausdorff" + +new wx:LayoutTab Box33 + +new wx:LayoutTab Box34 + set Box34.WinTitle "Surface B" + +new std:ConcatStrings Box35 + set Box35.In1 "0" + set Box35.In2 " " + +new creaVtk:ScalarsToColors Box36 + set Box36.Type "100" + +new creaVtk:ScalarBarActor Box37 + set Box37.Title "DistBtoA" + +new vtk:MarchingCubes Box38 + set Box38.Value "2000" + +new vtk:MarchingCubes Box39 + set Box39.Value "1550" + +new wx:LayoutLine Box40 + +new wx:OutputText Box43 + set Box43.Title "Retative Distance A to B" + +new wx:OutputText Box44 + set Box44.Title "Retative Distance B to A" + +new wx:OutputText Box45 + set Box45.Title "Hausdorff Distance" + +new wx:OutputText Box46 + + +connect Box03.Out Box02.In + +connect Box02.Widget Box07.Widget2 + +connect Box08.Widget Box07.Widget1 + +connect Box02.Renderer1 Box10.Renderer + +connect Box15.BoxChange Box10.BoxExecute + +connect Box17.Out Box18.In1 + +connect Box18.Out Box14.Opacity + +connect Box02.Renderer1 Box14.Renderer + +connect Box19.LookupTable Box14.ScalarVisibilityOn_LookupTable + +connect Box17.Widget Box21.Widget3 + +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 + +connect Box13.OutA Box14.In + +connect Box26.Out Box14.ScalarVisibilityOn_ScalarRange + +connect Box13.RelativeDistanceAtoB Box26.In3 + +connect Box27.Out Box14.ScalarVisibility + +connect Box27.Widget Box21.Widget4 + +connect Box29.Out Box30.In1 + +connect Box29.Widget Box31.Widget3 + +connect Box32.Widget Box31.Widget4 + +connect Box21.Widget Box33.Widget1 + +connect Box33.Widget Box08.Widget2 + +connect Box31.Widget Box34.Widget1 + +connect Box34.Widget Box08.Widget4 + +connect Box30.Out Box28.Opacity + +connect Box29.BoxChange Box28.BoxExecute + +connect Box28.BoxChange Box15.In7 + +connect Box13.RelativeDistanceBtoA Box35.In3 + +connect Box35.Out Box28.ScalarVisibilityOn_ScalarRange + +connect Box13.OutB Box28.In + +connect Box02.Renderer1 Box28.Renderer + +connect Box32.Out Box28.ScalarVisibility + +connect Box36.LookupTable Box28.ScalarVisibilityOn_LookupTable + +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 + +connect Box38.Out Box13.InA + +connect Box39.Out Box13.InB + +connect Box40.Widget Box08.Widget7 + +connect Box44.Widget Box40.Widget3 + +connect Box13.HausdorffDistance Box45.In + +connect Box13.RelativeDistanceAtoB Box43.In + +connect Box13.RelativeDistanceBtoA Box44.In + +connect Box45.Widget Box40.Widget5 + +connect Box43.Widget Box40.Widget2 + +connect Box46.Widget Box40.Widget1 + + + +# Complex input ports +exec Box06 +exec Box07 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx index 9f19bc6..b89a701 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.cxx @@ -34,14 +34,17 @@ void ScalarBarActor::Process() // std::cout << "Output value = " <SetLookupTable( bbGetInputLookupTable() ); - scalarbarActor->SetTitle("Value"); + scalarbarActor->SetTitle( bbGetInputTitle().c_str() ); scalarbarActor->SetNumberOfLabels(4); + if (bbGetInputDisplayPosition().size()==2) + { + scalarbarActor->SetDisplayPosition( bbGetInputDisplayPosition()[0] , bbGetInputDisplayPosition()[1] ); + } int fontsize = scalarbarActor->GetLabelTextProperty()->GetFontSize(); scalarbarActor->GetLabelTextProperty()->SetFontSize(fontsize/2); if (bbGetInputRenderer()!=NULL) @@ -50,7 +53,6 @@ printf ("EED ScalarBarActor Start\n"); } } // firsttime -printf ("EED ScalarBarActor End\n"); } diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h index 9dc8403..4a54397 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarBarActor.h @@ -23,6 +23,8 @@ class bbcreaVtk_EXPORT 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) //===== BBTK_DECLARE_INPUT(LookupTable,vtkScalarsToColors*); + BBTK_DECLARE_INPUT(DisplayPosition,std::vector); + BBTK_DECLARE_INPUT(Title,std::string); BBTK_DECLARE_INPUT(Renderer,vtkRenderer*); // BBTK_DECLARE_OUTPUT(Out,double); BBTK_PROCESS(Process); @@ -41,6 +43,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ScalarBarActor,bbtk::AtomicBlackBox); BBTK_DESCRIPTION("No Description."); 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,Renderer,"Renderer",vtkRenderer*,""); // 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 d306ff3..c8ec324 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx @@ -227,13 +227,11 @@ void ScalarsToColors::Process() // std::cout << "Output value = " <SetRange(0,255); } - colorLookupTable->SetNumberOfTableValues(1000); + int NumberOfColors=1000; + int NumberOfColorsHalf=NumberOfColors/2; + colorLookupTable->SetNumberOfTableValues( NumberOfColors ); colorLookupTable->Build(); double rgba1[4]; double rgba2[4]; int iLookTable; - for (iLookTable = 0; iLookTable<500; iLookTable++) + for (iLookTable = 0; iLookTableGetTableValue( iLookTable, rgba1); - colorLookupTable->GetTableValue(1000-1-iLookTable, rgba2); - colorLookupTable->SetTableValue(1000-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]); + 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); - int i,iMax; - iMax=(1000/16)*4; - for (i=0;iGetTableValue(500+i, rgba); - rgba[3]=(double)i/(double)iMax; - colorLookupTable->SetTableValue(500+i,rgba); - colorLookupTable->GetTableValue(500-i, rgba); - rgba[3]=(double)i/(double)iMax; - colorLookupTable->SetTableValue(500-i,rgba); - } // for -/* - iMax=100; - for (i=0;iGetTableValue(500+100+i, rgba); - rgba[3]=(double)i/(double)iMax; - _colorLookupTable->SetTableValue(500+100+i,rgba); - _colorLookupTable->GetTableValue(500-100-i, rgba); - rgba[3]=(double)i/(double)iMax; - _colorLookupTable->SetTableValue(500-100-i,rgba); - - } // for - - iMax=200; - for (i=0;iGetTableValue(500+i, rgba); - rgba[3]=0; - _colorLookupTable->SetTableValue(500+i,rgba); - _colorLookupTable->GetTableValue(500-i, rgba); - rgba[3]=0; - _colorLookupTable->SetTableValue(500-i,rgba); - } // for -*/ + int i,iMax=(NumberOfColors/16)*4; + for (i=0;iGetTableValue(NumberOfColorsHalf+i, rgba); + rgba[3]=(double)i/(double)iMax; + colorLookupTable->SetTableValue(NumberOfColorsHalf+i,rgba); + colorLookupTable->GetTableValue(NumberOfColorsHalf-i, rgba); + rgba[3]=(double)i/(double)iMax; + colorLookupTable->SetTableValue(NumberOfColorsHalf-i,rgba); + } // for + } //if Type 0 + colorLookupTable->Modified(); _scalarstocolors = colorLookupTable; - } // if Type 0 + } // if Type 0 || 100 //EED 2018-06-8 ***********************ARDS Projet*********************************************** - if (bbGetInputType()==1) + if ((bbGetInputType()==1) || (bbGetInputType()==101) ) { vtkLookupTable *colorLookupTable = vtkLookupTable::New(); if (bbGetInputRange().size()==2) @@ -314,12 +294,16 @@ printf("EED ScalarsToColors::Process Start\n"); colorLookupTable->SetSaturationRange(0.0, 0.0); // no color saturation colorLookupTable->SetRampToLinear(); colorLookupTable->Build(); - double rgba[4]; - colorLookupTable->GetTableValue(0,rgba); - rgba[3]=0; - colorLookupTable->SetTableValue(0,rgba); + // Transparency + if (bbGetInputType()==1) + { + double rgba[4]; + colorLookupTable->GetTableValue(0,rgba); + rgba[3]=0; + colorLookupTable->SetTableValue(0,rgba); + } // if Type 1 _scalarstocolors = colorLookupTable; - } // If Type 1 + } // If Type 1 || 101 if (bbGetInputType()==2) // Direction Color Vector @@ -349,8 +333,6 @@ printf("EED ScalarsToColors::Process Start\n"); bbSetOutputColor( colorRGB ); bbSetOutputLookupTable( _scalarstocolors ); -printf("EED ScalarsToColors::Process End\n"); - } //===== diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h index 4c66705..ca1f5e3 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 1=RangeTable 2=DirectionColorRGB 3=ComponentColorRGB[0-255]",int,""); + 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,ScalarValue,"Scalar value -> Color OUT",double,""); BBTK_INPUT(ScalarsToColors,Range,"Min Max range",std::vector,""); BBTK_OUTPUT(ScalarsToColors,Color,"Color",std::vector,"");