From bf834bffddf3a0cc4cd275e6fffacea93d58eeb2 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Tue, 12 Nov 2024 17:56:16 +0100 Subject: [PATCH] #3473 Compare Images with color layers --- .../boxes/CompareImagesSwitcherWidget_3Dp.bbg | 172 ++++++++++++++++-- .../boxes/CompareImagesSwitcherWidget_3Dp.bbs | 52 ++++++ .../CompareImages_3DwithPlanes_Widget.bbg | 77 ++++++-- .../CompareImages_3DwithPlanes_Widget.bbs | 11 ++ lib/Convolution.cxx | 26 ++- 5 files changed, 305 insertions(+), 33 deletions(-) diff --git a/PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbg b/PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbg index 8bbc79b..0d48937 100644 --- a/PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbg +++ b/PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbg @@ -16,7 +16,7 @@ COMPLEX_PORT Widget 61.252213:-169.894406:-900.000000 FIN_COMPLEX_PORT -COMPLEXINPUTS:3 +COMPLEXINPUTS:4 COMPLEX_PORT ImageVector1 -116.863827:117.249315:-900.000000 @@ -29,7 +29,11 @@ COMPLEX_PORT windowcolorlevel 26.116036:118.799900:-900.000000 FIN_COMPLEX_PORT -BOXES:62 +COMPLEX_PORT +_imageLayer +163.215250:118.793045:-900.000000 +FIN_COMPLEX_PORT +BOXES:73 BOX PackRecalage:ImageSwitcherBox:switch ISEXEC:FALSE @@ -97,8 +101,8 @@ FIN_BOX BOX wx:LayoutSplit:Box10 ISEXEC:FALSE --38.883692:-138.691650:-900.000000 --16.123692:-141.191650:-900.000000 +-24.521668:-133.112159:-900.000000 +-1.761668:-135.612159:-900.000000 PORT Orientation:"H" FIN_BOX @@ -145,8 +149,8 @@ FIN_BOX BOX creaMaracasVisu:ViewerNV:Box24 ISEXEC:FALSE --173.588539:-81.523570:-900.000000 --133.228539:-84.023570:-900.000000 +-174.713736:-75.272473:-900.000000 +-134.353736:-77.772473:-900.000000 PORT nTypeView:"-1" FIN_BOX @@ -285,8 +289,8 @@ FIN_BOX BOX creaMaracasVisu:wxVtkBaseView_Info:Box54 ISEXEC:FALSE --99.994455:-30.626837:-900.000000 --70.954455:-33.126837:-900.000000 +-100.826476:-30.959645:-900.000000 +-71.786476:-33.459645:-900.000000 PORT InteractionType:"12" FIN_BOX @@ -391,8 +395,8 @@ FIN_BOX BOX std:StringSelect:Box73 ISEXEC:FALSE --94.572419:67.063936:-900.000000 --70.052419:64.563936:-900.000000 +-94.572419:69.077427:-900.000000 +-70.052419:66.577427:-900.000000 PORT In0:"0 0" PORT @@ -488,7 +492,93 @@ ISEXEC:FALSE PORT In2:"2" FIN_BOX -CONNECTIONS:100 +BOX +creaMaracasVisu:ColorLayerImageView2:Box95 +ISEXEC:FALSE +-148.154812:-166.497696:-900.000000 +-118.354812:-168.997696:-900.000000 +PORT +lstRangeForColorBar:"-10 10" +FIN_BOX +BOX +wx:Slider:Box99 +ISEXEC:FALSE +-123.474901:-74.501498:-900.000000 +-93.674901:-77.001498:-900.000000 +PORT +In:"0" +PORT +Label:"true" +PORT +Max:"100" +PORT +Min:"0" +PORT +ReactiveOnTrack:"true" +PORT +Title:"Opacity Layer" +FIN_BOX +BOX +vtk:GetVectorVtkImageDataElement:Box100 +ISEXEC:FALSE +-152.626321:-148.485499:-900.000000 +-128.681321:-150.985499:-900.000000 +PORT +I:"0" +FIN_BOX +BOX +std:MagicBox:Box101 +ISEXEC:FALSE +156.270180:108.612018:-900.000000 +177.980180:106.112018:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ColorLayerImageView2:Box105 +ISEXEC:FALSE +-112.855075:-166.321842:-900.000000 +-83.055075:-168.821842:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ColorLayerImageView2:Box106 +ISEXEC:FALSE +-73.720376:-165.606533:-900.000000 +-43.920376:-168.106533:-900.000000 +FIN_BOX +BOX +vtk:GetVectorVtkImageDataElement:Box107 +ISEXEC:FALSE +-108.132767:-151.037078:-900.000000 +-84.187767:-153.537078:-900.000000 +PORT +I:"1" +FIN_BOX +BOX +vtk:GetVectorVtkImageDataElement:Box108 +ISEXEC:FALSE +-68.781743:-151.336834:-900.000000 +-44.836743:-153.836834:-900.000000 +PORT +I:"2" +FIN_BOX +BOX +creaMaracasVisu:ImageChangeInformation:Box109 +ISEXEC:FALSE +-154.129926:-155.610896:-900.000000 +-130.869926:-158.110896:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ImageChangeInformation:Box110 +ISEXEC:FALSE +-107.923943:-157.886199:-900.000000 +-84.663943:-160.386199:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ImageChangeInformation:Box111 +ISEXEC:FALSE +-72.189319:-157.569493:-900.000000 +-48.929319:-160.069493:-900.000000 +FIN_BOX +CONNECTIONS:120 CONNECTION checkS:Out:switch:On NumberOfControlPoints:0 @@ -789,4 +879,64 @@ NumberOfControlPoints:0 CONNECTION Box98:Out:Box96:In2 NumberOfControlPoints:0 +CONNECTION +Box24:wxVtkBaseView1:Box95:WxVtkBaseView +NumberOfControlPoints:0 +CONNECTION +Box99:Out:Box95:Opacity +NumberOfControlPoints:0 +CONNECTION +Box99:BoxChange:Box95:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box99:Widget:Box48:Widget3 +NumberOfControlPoints:0 +CONNECTION +_imageLayer:_imageLayer:Box101:In +NumberOfControlPoints:0 +CONNECTION +Box101:Out:Box100:In +NumberOfControlPoints:0 +CONNECTION +Box99:BoxChange:Box105:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box99:BoxChange:Box106:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box99:Out:Box105:Opacity +NumberOfControlPoints:0 +CONNECTION +Box99:Out:Box106:Opacity +NumberOfControlPoints:0 +CONNECTION +Box101:Out:Box107:In +NumberOfControlPoints:0 +CONNECTION +Box101:Out:Box108:In +NumberOfControlPoints:0 +CONNECTION +Box49:wxVtkBaseView1:Box105:WxVtkBaseView +NumberOfControlPoints:0 +CONNECTION +Box28:wxVtkBaseView1:Box106:WxVtkBaseView +NumberOfControlPoints:0 +CONNECTION +Box100:Out:Box109:In +NumberOfControlPoints:0 +CONNECTION +Box109:Out:Box95:In +NumberOfControlPoints:0 +CONNECTION +Box107:Out:Box110:In +NumberOfControlPoints:0 +CONNECTION +Box110:Out:Box105:In +NumberOfControlPoints:0 +CONNECTION +Box108:Out:Box111:In +NumberOfControlPoints:0 +CONNECTION +Box111:Out:Box106:In +NumberOfControlPoints:0 APP_END diff --git a/PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbs b/PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbs index d89befd..4abd92a 100644 --- a/PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbs +++ b/PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbs @@ -185,6 +185,38 @@ new std:Spin Box97 new std:Multiply Box98 set Box98.In2 "2" +new creaMaracasVisu:ColorLayerImageView2 Box95 + set Box95.lstRangeForColorBar "-10 10" + +new wx:Slider Box99 + set Box99.In "0" + set Box99.Label "true" + set Box99.Max "100" + set Box99.Min "0" + set Box99.ReactiveOnTrack "true" + set Box99.Title "Opacity Layer" + +new vtk:GetVectorVtkImageDataElement Box100 + set Box100.I "0" + +new std:MagicBox Box101 + +new creaMaracasVisu:ColorLayerImageView2 Box105 + +new creaMaracasVisu:ColorLayerImageView2 Box106 + +new vtk:GetVectorVtkImageDataElement Box107 + set Box107.I "1" + +new vtk:GetVectorVtkImageDataElement Box108 + set Box108.I "2" + +new creaMaracasVisu:ImageChangeInformation Box109 + +new creaMaracasVisu:ImageChangeInformation Box110 + +new creaMaracasVisu:ImageChangeInformation Box111 + connect checkS.Out switch.On connect sdrT.Out switch.Time @@ -282,11 +314,31 @@ connect Box96.Out Box73.In connect Box66.BoxChange Box97.BoxExecute connect checkS.Out Box98.In1 connect Box98.Out Box96.In2 +connect Box24.wxVtkBaseView1 Box95.WxVtkBaseView +connect Box99.Out Box95.Opacity +connect Box99.BoxChange Box95.BoxExecute +connect Box99.Widget Box48.Widget3 +connect Box101.Out Box100.In +connect Box99.BoxChange Box105.BoxExecute +connect Box99.BoxChange Box106.BoxExecute +connect Box99.Out Box105.Opacity +connect Box99.Out Box106.Opacity +connect Box101.Out Box107.In +connect Box101.Out Box108.In +connect Box49.wxVtkBaseView1 Box105.WxVtkBaseView +connect Box28.wxVtkBaseView1 Box106.WxVtkBaseView +connect Box100.Out Box109.In +connect Box109.Out Box95.In +connect Box107.Out Box110.In +connect Box110.Out Box105.In +connect Box108.Out Box111.In +connect Box111.Out Box106.In # Complex input ports input ImageVector1 Box22.In " " input ImageVector2 Box23.In " " input windowcolorlevel Box61.In " " +input _imageLayer Box101.In " " # Complex output ports output Widget switchWindow.Widget " " diff --git a/PackRecalage/bbs/boxes/CompareImages_3DwithPlanes_Widget.bbg b/PackRecalage/bbs/boxes/CompareImages_3DwithPlanes_Widget.bbg index fa7d5d5..a844c3d 100644 --- a/PackRecalage/bbs/boxes/CompareImages_3DwithPlanes_Widget.bbg +++ b/PackRecalage/bbs/boxes/CompareImages_3DwithPlanes_Widget.bbg @@ -16,7 +16,7 @@ COMPLEX_PORT Widget 23.094658:-95.112277:-900.000000 FIN_COMPLEX_PORT -COMPLEXINPUTS:5 +COMPLEXINPUTS:6 COMPLEX_PORT In2 9.912478:52.632655:-900.000000 @@ -27,7 +27,7 @@ In1 FIN_COMPLEX_PORT COMPLEX_PORT WinTitle -47.055687:52.319551:-900.000000 +95.051608:50.531737:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT Point @@ -37,7 +37,11 @@ COMPLEX_PORT BoxExecute -107.346519:51.485912:-900.000000 FIN_COMPLEX_PORT -BOXES:17 +COMPLEX_PORT +ImageLayer +54.597079:52.740503:-900.000000 +FIN_COMPLEX_PORT +BOXES:19 BOX wx:LayoutTab:tabs ISEXEC:FALSE @@ -61,32 +65,32 @@ FIN_BOX BOX PackRecalage:CompareImagesWidget_base_interface_3Dp:Box18 ISEXEC:FALSE --37.121721:26.501698:-900.000000 --12.131721:24.001698:-900.000000 +-42.210114:26.914270:-900.000000 +-17.220114:24.414270:-900.000000 FIN_BOX BOX PackRecalage:CompareImagesWidget_base_3Dp_B:Box13 ISEXEC:FALSE --83.767878:4.123813:-900.000000 --59.532878:1.623813:-900.000000 +-88.306174:-0.964580:-900.000000 +-64.071174:-3.464580:-900.000000 FIN_BOX BOX PackRecalage:CompareImagesTransparencyWidget_3Dp:Box14 ISEXEC:FALSE --34.022765:-34.453971:-900.000000 --9.272765:-36.953971:-900.000000 +-34.022765:-34.866543:-900.000000 +-9.272765:-37.366543:-900.000000 FIN_BOX BOX PackRecalage:CompareImagesWidget_base_3Dp_B:Box15 ISEXEC:FALSE --0.077606:3.628992:-900.000000 -24.157394:1.128992:-900.000000 +-41.197320:-0.771780:-900.000000 +-16.962320:-3.271780:-900.000000 FIN_BOX BOX PackRecalage:CompareImagesSwitcherWidget_3Dp:Box17 ISEXEC:FALSE --89.453457:-34.168804:-900.000000 --65.193457:-36.668804:-900.000000 +-91.653843:-35.131473:-900.000000 +-67.393843:-37.631473:-900.000000 FIN_BOX BOX std:MultipleInputs:Box11 @@ -125,20 +129,20 @@ FIN_BOX BOX PackRecalage:ImageConvolution:Box22 ISEXEC:FALSE --5.856335:-5.739973:-900.000000 -16.578665:-8.239973:-900.000000 +5.833216:-15.366662:-900.000000 +28.268216:-17.866662:-900.000000 FIN_BOX BOX PackRecalage:ImageConvolution:Box23 ISEXEC:FALSE -23.828235:-5.877413:-900.000000 -46.263235:-8.377413:-900.000000 +38.818365:-18.529633:-900.000000 +61.253365:-21.029633:-900.000000 FIN_BOX BOX PackRecalage:CompareParallelWidget:Box24 ISEXEC:FALSE -67.410579:-34.281925:-900.000000 -90.360579:-36.781925:-900.000000 +65.485241:-32.631635:-900.000000 +88.435241:-35.131635:-900.000000 FIN_BOX BOX creaVtk:CompareImagesByRGB-Widget:Box25 @@ -146,7 +150,19 @@ ISEXEC:FALSE 17.675021:-33.192313:-900.000000 41.350021:-35.692313:-900.000000 FIN_BOX -CONNECTIONS:48 +BOX +vtk:vtkImageDataPointerRelay:Box26 +ISEXEC:FALSE +50.091872:42.750902:-900.000000 +73.301872:40.250902:-900.000000 +FIN_BOX +BOX +PackRecalage:CompareImagesWidget_base_3Dp_B:Box27 +ISEXEC:FALSE +86.734580:-2.528407:-900.000000 +110.969580:-5.028407:-900.000000 +FIN_BOX +CONNECTIONS:55 CONNECTION In2:In2:Box59:In NumberOfControlPoints:0 @@ -291,4 +307,25 @@ NumberOfControlPoints:0 CONNECTION Box18:windowcolorlevel:Box14:windowcolorlevel NumberOfControlPoints:0 +CONNECTION +ImageLayer:ImageLayer:Box26:In +NumberOfControlPoints:0 +CONNECTION +Box11:BoxChange:Box27:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box18:ConvolutionFactor:Box27:ConvolutionFactor +NumberOfControlPoints:0 +CONNECTION +Box18:ConvolutionOnOff:Box27:ConvolutionOnOff +NumberOfControlPoints:0 +CONNECTION +Box26:Out:Box27:In +NumberOfControlPoints:0 +CONNECTION +Box12:Out:Box27:Point +NumberOfControlPoints:0 +CONNECTION +Box27:Out:Box17:_imageLayer +NumberOfControlPoints:0 APP_END diff --git a/PackRecalage/bbs/boxes/CompareImages_3DwithPlanes_Widget.bbs b/PackRecalage/bbs/boxes/CompareImages_3DwithPlanes_Widget.bbs index 0dd812c..559f1a5 100644 --- a/PackRecalage/bbs/boxes/CompareImages_3DwithPlanes_Widget.bbs +++ b/PackRecalage/bbs/boxes/CompareImages_3DwithPlanes_Widget.bbs @@ -55,6 +55,10 @@ new PackRecalage:CompareParallelWidget Box24 new creaVtk:CompareImagesByRGB-Widget Box25 +new vtk:vtkImageDataPointerRelay Box26 + +new PackRecalage:CompareImagesWidget_base_3Dp_B Box27 + connect Box18.ConvolutionFactor Box13.ConvolutionFactor connect Box18.ConvolutionOnOff Box13.ConvolutionOnOff @@ -98,6 +102,12 @@ connect Box12.Out Box25.point connect Box25.OutWidget Box20.Widget1 connect Box18.windowcolorlevel Box17.windowcolorlevel connect Box18.windowcolorlevel Box14.windowcolorlevel +connect Box11.BoxChange Box27.BoxExecute +connect Box18.ConvolutionFactor Box27.ConvolutionFactor +connect Box18.ConvolutionOnOff Box27.ConvolutionOnOff +connect Box26.Out Box27.In +connect Box12.Out Box27.Point +connect Box27.Out Box17._imageLayer # Complex input ports input In2 Box59.In " " @@ -105,6 +115,7 @@ input In1 Box56.In " " input Point Box12.In " " input WinTitle Box16.WinTitle " " input BoxExecute Box21.BoxExecute " " +input ImageLayer Box26.In " " # Complex output ports output Widget Box16.Widget " " diff --git a/lib/Convolution.cxx b/lib/Convolution.cxx index 6014ecd..4957b05 100644 --- a/lib/Convolution.cxx +++ b/lib/Convolution.cxx @@ -78,8 +78,30 @@ void Convolution::Run() { if(_on==true) { - double kernel[] = {0.0,1.0,0.0,1.0,-_factor,1.0,0.0,1.0,0.0}; - _convolve->SetKernel3x3(kernel); +// double kernel[] = { 0.0,1.0,0.0, 1.0,-_factor,1.0, 0.0,1.0,0.0}; +// _convolve->SetKernel3x3(kernel); + +// falta + double kernel[] = { + 0.0,0.0,0.0, 0.0,1,0.0, 0.0,0.0,0.0, + 0.0,1.0,0.0, 1.0,-_factor,1.0, 0.0,1.0,0.0, + 0.0,0.0,0.0, 0.0,1,0.0, 0.0,0.0,0.0 + }; + +//bien +// double kernel[] = { +// 1.0,1.0,1.0, 1.0,1.0,1.0, 1.0,1.0,1.0, +// 1.0,1.0,1.0, 1.0,-_factor,1.0, 1.0,1.0,1.0, +// 1.0,1.0,1.0, 1.0,1.0,1.0, 1.0,1.0,1.0 +// }; +// double kernel[] = { +// -1.0,-1.0,-1.0, -1.0,-1.0,-1.0, -1.0,-1.0,-1.0, +// -1.0,-1.0,-1.0, -1.0,_factor,-1.0, -1.0,-1.0,-1.0, +// -1.0,-1.0,-1.0, -1.0,-1.0,-1.0, -1.0,-1.0,-1.0 +// }; + + _convolve->SetKernel3x3x3(kernel); + _convolve->Update(); //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 -- 2.47.1