--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/appli/ExampleSliceImage-3DVisu.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:16
+BOX
+creaMaracasVisu:SliceImage-3DVisu:Box00
+ISEXEC:FALSE
+-134.773569:-18.724510:-900.000000
+-90.223569:-28.724510:-900.000000
+PORT
+ColorBorder:"0 0 0"
+PORT
+Direction:"0"
+PORT
+SliceOpacity:"50"
+PORT
+WindowColorLevel:"2500 1000"
+FIN_BOX
+BOX
+vtk:LoadHola:Box01
+ISEXEC:FALSE
+137.588432:142.772258:-900.000000
+173.138432:132.772258:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:ViewerNV:Box02
+ISEXEC:FALSE
+63.061066:12.525419:-900.000000
+98.936066:2.525419:-900.000000
+FIN_BOX
+BOX
+wx:Slider:Box03
+ISEXEC:FALSE
+-154.546639:101.942909:-900.000000
+-122.971639:91.942909:-900.000000
+PORT
+Label:"true"
+PORT
+ReactiveOnTrack:"true"
+PORT
+Title:"Slice Y"
+FIN_BOX
+BOX
+creaVtk:OutputWindow:Box05
+ISEXEC:TRUE
+26.000795:-148.827537:-900.000000
+66.600795:-158.827537:-900.000000
+FIN_BOX
+BOX
+wx:LayoutSplit:Box06
+ISEXEC:TRUE
+92.198291:-155.868396:-900.000000
+128.873291:-165.868396:-900.000000
+PORT
+Orientation:"H"
+FIN_BOX
+BOX
+wx:LayoutLine:Box07
+ISEXEC:FALSE
+29.178782:-41.771824:-900.000000
+86.738782:-51.771824:-900.000000
+FIN_BOX
+BOX
+vtk:UpdateRender:Box08
+ISEXEC:FALSE
+-132.514229:-72.675871:-900.000000
+-92.189229:-82.675871:-900.000000
+PORT
+Active:"true"
+FIN_BOX
+BOX
+wx:Slider:Box10
+ISEXEC:FALSE
+-5.331754:103.921346:-900.000000
+46.068246:93.921346:-900.000000
+PORT
+In:"100"
+PORT
+Label:"true"
+PORT
+Max:"100"
+PORT
+ReactiveOnTrack:"true"
+PORT
+Title:"Opacity"
+FIN_BOX
+BOX
+std:Div:Box11
+ISEXEC:FALSE
+-6.171301:76.027345:-900.000000
+23.153699:66.027345:-900.000000
+PORT
+In2:"100"
+FIN_BOX
+BOX
+std:MultipleInputs:Box13
+ISEXEC:FALSE
+-143.482266:-48.999565:-900.000000
+-103.782266:-58.999565:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:SliceImage-3DVisu:Box14
+ISEXEC:FALSE
+-199.965499:-18.427814:-900.000000
+-155.415499:-28.427814:-900.000000
+PORT
+ColorBorder:"0 0 0"
+PORT
+Direction:"0"
+PORT
+SliceOpacity:"50"
+PORT
+WindowColorLevel:"2500 1000"
+FIN_BOX
+BOX
+wx:Slider:Box15
+ISEXEC:FALSE
+-220.686169:101.889733:-900.000000
+-168.862229:91.889733:-900.000000
+PORT
+Label:"true"
+PORT
+ReactiveOnTrack:"true"
+PORT
+Title:"Slice Z"
+FIN_BOX
+BOX
+wx:Slider:Box16
+ISEXEC:FALSE
+-94.140502:103.392708:-900.000000
+-42.740502:93.392708:-900.000000
+PORT
+Label:"true"
+PORT
+ReactiveOnTrack:"true"
+PORT
+Title:"Slice X"
+FIN_BOX
+BOX
+creaMaracasVisu:SliceImage-3DVisu:Box17
+ISEXEC:FALSE
+-78.097576:-18.094290:-900.000000
+-33.547576:-28.094290:-900.000000
+PORT
+ColorBorder:"0 0 0"
+PORT
+Direction:"0"
+PORT
+SliceOpacity:"50"
+PORT
+WindowColorLevel:"2500 1000"
+FIN_BOX
+BOX
+wx:RadioButton:Box18
+ISEXEC:FALSE
+-321.023319:129.829528:-900.000000
+-257.303319:119.829528:-900.000000
+PORT
+In0:"XY"
+PORT
+In1:"YZ"
+PORT
+In2:"XZ"
+FIN_BOX
+CONNECTIONS:29
+CONNECTION
+Box01:Out:Box02:In
+NumberOfControlPoints:0
+CONNECTION
+Box02:Renderer1:Box00:Render
+NumberOfControlPoints:0
+CONNECTION
+Box02:Widget:Box06:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box07:Widget:Box06:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box03:Out:Box00:SliceDeep
+NumberOfControlPoints:0
+CONNECTION
+Box02:Renderer1:Box08:Renderer
+NumberOfControlPoints:0
+CONNECTION
+Box10:Out:Box11:In1
+NumberOfControlPoints:0
+CONNECTION
+Box11:Out:Box00:SliceOpacity
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box00:Image
+NumberOfControlPoints:0
+CONNECTION
+Box15:Out:Box14:SliceDeep
+NumberOfControlPoints:0
+CONNECTION
+Box11:Out:Box14:SliceOpacity
+NumberOfControlPoints:0
+CONNECTION
+Box10:Widget:Box07:Widget8
+NumberOfControlPoints:0
+CONNECTION
+Box03:Widget:Box07:Widget4
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box14:Image
+NumberOfControlPoints:0
+CONNECTION
+Box14:BoxChangeImageSlice:Box13:In1
+NumberOfControlPoints:0
+CONNECTION
+Box00:BoxChangeImageSlice:Box13:In3
+NumberOfControlPoints:0
+CONNECTION
+Box17:BoxChangeImageSlice:Box13:In5
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box17:Image
+NumberOfControlPoints:0
+CONNECTION
+Box16:Out:Box17:SliceDeep
+NumberOfControlPoints:0
+CONNECTION
+Box11:Out:Box17:SliceOpacity
+NumberOfControlPoints:0
+CONNECTION
+Box02:Renderer1:Box14:Render
+NumberOfControlPoints:0
+CONNECTION
+Box02:Renderer1:Box17:Render
+NumberOfControlPoints:0
+CONNECTION
+Box13:BoxChange:Box08:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box15:Widget:Box07:Widget6
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box14:Direction
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box00:Direction
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box17:Direction
+NumberOfControlPoints:0
+CONNECTION
+Box16:Widget:Box07:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box18:Widget:Box07:Widget1
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/appli/ExampleSliceImage-3DVisu.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include creaMaracasVisu
+include vtk
+include wx
+include creaVtk
+include std
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new creaMaracasVisu:SliceImage-3DVisu Box00
+ set Box00.ColorBorder "0 0 0"
+ set Box00.Direction "0"
+ set Box00.SliceOpacity "50"
+ set Box00.WindowColorLevel "2500 1000"
+
+new vtk:LoadHola Box01
+
+new creaMaracasVisu:ViewerNV Box02
+
+new wx:Slider Box03
+ set Box03.Label "true"
+ set Box03.ReactiveOnTrack "true"
+ set Box03.Title "Slice Y"
+
+new creaVtk:OutputWindow Box05
+
+new wx:LayoutSplit Box06
+ set Box06.Orientation "H"
+
+new wx:LayoutLine Box07
+
+new vtk:UpdateRender Box08
+ set Box08.Active "true"
+
+new wx:Slider Box10
+ set Box10.In "100"
+ set Box10.Label "true"
+ set Box10.Max "100"
+ set Box10.ReactiveOnTrack "true"
+ set Box10.Title "Opacity"
+
+new std:Div Box11
+ set Box11.In2 "100"
+
+new std:MultipleInputs Box13
+
+new creaMaracasVisu:SliceImage-3DVisu Box14
+ set Box14.ColorBorder "0 0 0"
+ set Box14.Direction "0"
+ set Box14.SliceOpacity "50"
+ set Box14.WindowColorLevel "2500 1000"
+
+new wx:Slider Box15
+ set Box15.Label "true"
+ set Box15.ReactiveOnTrack "true"
+ set Box15.Title "Slice Z"
+
+new wx:Slider Box16
+ set Box16.Label "true"
+ set Box16.ReactiveOnTrack "true"
+ set Box16.Title "Slice X"
+
+new creaMaracasVisu:SliceImage-3DVisu Box17
+ set Box17.ColorBorder "0 0 0"
+ set Box17.Direction "0"
+ set Box17.SliceOpacity "50"
+ set Box17.WindowColorLevel "2500 1000"
+
+new wx:RadioButton Box18
+ set Box18.In0 "XY"
+ set Box18.In1 "YZ"
+ set Box18.In2 "XZ"
+
+
+connect Box01.Out Box02.In
+
+connect Box02.Renderer1 Box00.Render
+
+connect Box02.Widget Box06.Widget2
+
+connect Box07.Widget Box06.Widget1
+
+connect Box03.Out Box00.SliceDeep
+
+connect Box02.Renderer1 Box08.Renderer
+
+connect Box10.Out Box11.In1
+
+connect Box11.Out Box00.SliceOpacity
+
+connect Box01.Out Box00.Image
+
+connect Box15.Out Box14.SliceDeep
+
+connect Box11.Out Box14.SliceOpacity
+
+connect Box10.Widget Box07.Widget8
+
+connect Box03.Widget Box07.Widget4
+
+connect Box01.Out Box14.Image
+
+connect Box14.BoxChangeImageSlice Box13.In1
+
+connect Box00.BoxChangeImageSlice Box13.In3
+
+connect Box17.BoxChangeImageSlice Box13.In5
+
+connect Box01.Out Box17.Image
+
+connect Box16.Out Box17.SliceDeep
+
+connect Box11.Out Box17.SliceOpacity
+
+connect Box02.Renderer1 Box14.Render
+
+connect Box02.Renderer1 Box17.Render
+
+connect Box13.BoxChange Box08.BoxExecute
+
+connect Box15.Widget Box07.Widget6
+
+connect Box18.Out Box14.Direction
+
+connect Box18.Out Box00.Direction
+
+connect Box18.Out Box17.Direction
+
+connect Box16.Widget Box07.Widget2
+
+connect Box18.Widget Box07.Widget1
+
+
+
+# Complex input ports
+exec Box05
+exec Box06
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C8/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleDrawAxisTree3D.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:4
+BOX
+creaMaracasVisu:DrawAxisTree3D:Box00
+ISEXEC:FALSE
+-21.033945:-26.493137:-900.000000
+24.206055:-36.493137:-900.000000
+PORT
+ColourLaw:"2"
+PORT
+LineWidth:"1"
+PORT
+Opacity:"1"
+PORT
+lstIndexs:"6 3 3"
+PORT
+lstPointX:"10 20 30 40 50 60 30 80 90 40 80 90"
+PORT
+lstPointY:"10 30 20 40 60 60 20 50 70 40 40 60"
+PORT
+lstPointZ:"10 20 30 40 50 60 30 45 53 40 80 90"
+FIN_BOX
+BOX
+vtk:LoadHola:Box01
+ISEXEC:FALSE
+-32.915716:74.662477:-900.000000
+2.634284:64.662477:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:ViewerNV:Box02
+ISEXEC:TRUE
+-42.870713:32.594587:-900.000000
+20.849287:22.594587:-900.000000
+FIN_BOX
+BOX
+vtk:vtkImageDataPointerRelay:Box03
+ISEXEC:FALSE
+-32.273458:55.394741:-900.000000
+19.901542:45.394741:-900.000000
+FIN_BOX
+CONNECTIONS:4
+CONNECTION
+Box01:Out:Box03:In
+NumberOfControlPoints:0
+CONNECTION
+Box03:Out:Box02:In
+NumberOfControlPoints:0
+CONNECTION
+Box02:Renderer1:Box00:Renderer
+NumberOfControlPoints:0
+CONNECTION
+Box02:BoxChange:Box00:BoxExecute
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/davila/Creatis/C8/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleDrawAxisTree3D.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include creaMaracasVisu
+include vtk
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new creaMaracasVisu:DrawAxisTree3D Box00
+ set Box00.ColourLaw "2"
+ set Box00.LineWidth "1"
+ set Box00.Opacity "1"
+ set Box00.lstIndexs "6 3 3"
+ set Box00.lstPointX "10 20 30 40 50 60 30 80 90 40 80 90"
+ set Box00.lstPointY "10 30 20 40 60 60 20 50 70 40 40 60"
+ set Box00.lstPointZ "10 20 30 40 50 60 30 45 53 40 80 90"
+
+new vtk:LoadHola Box01
+
+new creaMaracasVisu:ViewerNV Box02
+
+new vtk:vtkImageDataPointerRelay Box03
+
+
+connect Box01.Out Box03.In
+
+connect Box03.Out Box02.In
+
+connect Box02.Renderer1 Box00.Renderer
+
+connect Box02.BoxChange Box00.BoxExecute
+
+
+
+# Complex input ports
+exec Box02
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleSetPosition-FixAxis.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:8
+BOX
+vtk:LoadHola:Box00
+ISEXEC:FALSE
+-63.694843:55.476154:-900.000000
+-28.144843:45.476154:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:ViewerNV:Box01
+ISEXEC:FALSE
+-90.247532:24.814120:-900.000000
+-26.527532:14.814120:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:ViewerNV:Box02
+ISEXEC:FALSE
+7.513914:3.088466:-900.000000
+71.233914:-6.911534:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:SetPosition:Box03
+ISEXEC:FALSE
+-65.275361:-68.752498:-900.000000
+-28.725361:-78.752498:-900.000000
+FIN_BOX
+BOX
+wx:LayoutSplit:Box04
+ISEXEC:FALSE
+38.722672:-62.746533:-900.000000
+77.802672:-72.746533:-900.000000
+FIN_BOX
+BOX
+wx:CheckBox:Box05
+ISEXEC:FALSE
+1.106362:36.509947:-900.000000
+37.431362:26.509947:-900.000000
+PORT
+Title:"Fix Axis for the second viewer"
+FIN_BOX
+BOX
+creaVtk:OutputWindow:Box07
+ISEXEC:TRUE
+-25.446327:-108.581532:-900.000000
+15.153673:-118.581532:-900.000000
+FIN_BOX
+BOX
+wx:LayoutSplit:Box08
+ISEXEC:TRUE
+24.267396:-108.179945:-900.000000
+63.347396:-118.179945:-900.000000
+PORT
+Orientation:"H"
+FIN_BOX
+CONNECTIONS:10
+CONNECTION
+Box00:Out:Box01:In
+NumberOfControlPoints:0
+CONNECTION
+Box01:BoxChange:Box03:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box01:Point:Box03:Point
+NumberOfControlPoints:0
+CONNECTION
+Box02:wxVtkBaseView1:Box03:wxVtkBaseView
+NumberOfControlPoints:0
+CONNECTION
+Box01:Widget:Box04:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box02:Widget:Box04:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box00:Out:Box02:In
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box03:FixAxis2D
+NumberOfControlPoints:0
+CONNECTION
+Box04:Widget:Box08:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box05:Widget:Box08:Widget1
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleSetPosition-FixAxis.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include vtk
+include creaMaracasVisu
+include wx
+include creaVtk
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new vtk:LoadHola Box00
+
+new creaMaracasVisu:ViewerNV Box01
+
+new creaMaracasVisu:ViewerNV Box02
+
+new creaMaracasVisu:SetPosition Box03
+
+new wx:LayoutSplit Box04
+
+new wx:CheckBox Box05
+ set Box05.Title "Fix Axis for the second viewer"
+
+new creaVtk:OutputWindow Box07
+
+new wx:LayoutSplit Box08
+ set Box08.Orientation "H"
+
+
+connect Box00.Out Box01.In
+
+connect Box01.BoxChange Box03.BoxExecute
+
+connect Box01.Point Box03.Point
+
+connect Box02.wxVtkBaseView1 Box03.wxVtkBaseView
+
+connect Box01.Widget Box04.Widget1
+
+connect Box02.Widget Box04.Widget2
+
+connect Box00.Out Box02.In
+
+connect Box05.Out Box03.FixAxis2D
+
+connect Box04.Widget Box08.Widget2
+
+connect Box05.Widget Box08.Widget1
+
+
+
+# Complex input ports
+exec Box07
+exec Box08
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C8/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/HelpViewerNV.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:HelpViewerNV
+PACKAGENAME:creaMaracasVisu
+COMPLEXOUTPUTS:1
+COMPLEX_PORT
+widget
+-35.421851:-72.510817:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:0
+BOXES:10
+BOX
+wx:LayoutLine:Box02
+ISEXEC:TRUE
+-38.719592:-37.691851:-900.000000
+18.840408:-47.691851:-900.000000
+FIN_BOX
+BOX
+wx:OutputText:Box03
+ISEXEC:FALSE
+-84.617474:82.369571:-900.000000
+-47.842474:72.369571:-900.000000
+PORT
+In:"-Change Z&&2P&& Drag right click mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box04
+ISEXEC:FALSE
+-59.479411:68.651033:-900.000000
+-22.704411:58.651033:-900.000000
+PORT
+In:"-Zoom&&2P&& Drag ctrl-right click mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box05
+ISEXEC:FALSE
+-28.972162:52.915716:-900.000000
+7.802838:42.915716:-900.000000
+PORT
+In:"-Zoom&&2P&& Wheel mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box06
+ISEXEC:FALSE
+-4.155228:38.876049:-900.000000
+32.619772:28.876049:-900.000000
+PORT
+In:"-Move image&&2P&& Drag shift-left click mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box07
+ISEXEC:FALSE
+15.343630:19.839436:-900.000000
+52.118630:9.839436:-900.000000
+PORT
+In:"-Rotate image&&2P&& Drag ctrl-middle click mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box08
+ISEXEC:FALSE
+40.481693:6.120898:-900.000000
+77.256693:-3.879102:-900.000000
+PORT
+In:"-Picker (position, gray level)&&2P&& Mouse move"
+FIN_BOX
+BOX
+wx:OutputText:Box09
+ISEXEC:FALSE
+70.988942:-9.614420:-900.000000
+107.763942:-19.614420:-900.000000
+PORT
+In:"-Move axes&&2P&& Drag the axes with click mouse left"
+FIN_BOX
+BOX
+wx:OutputText:Box10
+ISEXEC:FALSE
+95.805876:-23.654087:-900.000000
+132.580876:-33.654087:-900.000000
+PORT
+In:"-Choose a point&&2P&& Double click "
+FIN_BOX
+BOX
+wx:OutputText:Box11
+ISEXEC:FALSE
+-103.204056:98.464914:-900.000000
+-66.429056:88.464914:-900.000000
+PORT
+In:"-Brightness / Contrast&&2P&& Drag middle click mouse "
+FIN_BOX
+CONNECTIONS:10
+CONNECTION
+Box11:Widget:Box02:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box03:Widget:Box02:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box04:Widget:Box02:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box05:Widget:Box02:Widget4
+NumberOfControlPoints:0
+CONNECTION
+Box06:Widget:Box02:Widget5
+NumberOfControlPoints:0
+CONNECTION
+Box07:Widget:Box02:Widget6
+NumberOfControlPoints:0
+CONNECTION
+Box08:Widget:Box02:Widget7
+NumberOfControlPoints:0
+CONNECTION
+Box09:Widget:Box02:Widget8
+NumberOfControlPoints:0
+CONNECTION
+Box10:Widget:Box02:Widget9
+NumberOfControlPoints:0
+CONNECTION
+Box02:Widget:widget:widget
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/C8/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/HelpViewerNV.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include wx
+
+define HelpViewerNV creaMaracasVisu
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new wx:LayoutLine Box02
+
+new wx:OutputText Box03
+ set Box03.In "-Change Z: Drag right click mouse"
+
+new wx:OutputText Box04
+ set Box04.In "-Zoom: Drag ctrl-right click mouse"
+
+new wx:OutputText Box05
+ set Box05.In "-Zoom: Wheel mouse"
+
+new wx:OutputText Box06
+ set Box06.In "-Move image: Drag shift-left click mouse"
+
+new wx:OutputText Box07
+ set Box07.In "-Rotate image: Drag ctrl-middle click mouse"
+
+new wx:OutputText Box08
+ set Box08.In "-Picker (position, gray level): Mouse move"
+
+new wx:OutputText Box09
+ set Box09.In "-Move axes: Drag the axes with click mouse left"
+
+new wx:OutputText Box10
+ set Box10.In "-Choose a point: Double click "
+
+new wx:OutputText Box11
+ set Box11.In "-Brightness / Contrast: Drag middle click mouse "
+
+
+connect Box11.Widget Box02.Widget1
+connect Box03.Widget Box02.Widget2
+connect Box04.Widget Box02.Widget3
+connect Box05.Widget Box02.Widget4
+connect Box06.Widget Box02.Widget5
+connect Box07.Widget Box02.Widget6
+connect Box08.Widget Box02.Widget7
+connect Box09.Widget Box02.Widget8
+connect Box10.Widget Box02.Widget9
+
+# Complex input ports
+
+# Complex output ports
+output widget Box02.Widget " "
+
+exec Box02
+
+endefine
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C10/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SegmentationConnectivityEED.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:SegmentationConnectivityEED
+PACKAGENAME:creaMaracasVisu
+COMPLEXOUTPUTS:2
+COMPLEX_PORT
+resultImage
+104.590916:-412.449578:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+OutWidget
+56.143827:-415.269475:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:4
+COMPLEX_PORT
+Threshold
+287.551302:88.983208:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+pointSeed
+107.354939:99.775368:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+InImage
+-22.150977:108.278281:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+Depth
+183.214488:94.857236:-900.000000
+FIN_COMPLEX_PORT
+BOXES:37
+BOX
+creaMaracasVisu:ViewerNV:Box01
+ISEXEC:FALSE
+-218.034362:-37.747977:-900.000000
+-84.884281:-47.747977:-900.000000
+PORT
+nTypeView:"6 1 2 0"
+FIN_BOX
+BOX
+creaMaracasVisu:ImageChangeInformation:Box05
+ISEXEC:FALSE
+-18.514127:33.418280:-900.000000
+33.010873:23.418280:-900.000000
+FIN_BOX
+BOX
+wx:LayoutTab:Box09
+ISEXEC:FALSE
+-72.239823:-322.710201:-900.000000
+-35.989823:-332.710201:-900.000000
+FIN_BOX
+BOX
+vtk:SegmentationConnectivity:Box12
+ISEXEC:FALSE
+58.121789:-1.265810:-900.000000
+110.121789:-11.265810:-900.000000
+PORT
+Value:"255"
+FIN_BOX
+BOX
+creaMaracasVisu:ColorLayerImageView:Box13
+ISEXEC:FALSE
+-310.837483:-180.661458:-900.000000
+-90.404412:-190.661458:-900.000000
+PORT
+TypeControlsInterface:"2"
+PORT
+WinTitle:"General Connectivity"
+PORT
+lstTransparenceBoundaries:"0"
+FIN_BOX
+BOX
+wx:LayoutSplit:Box14
+ISEXEC:FALSE
+-141.472047:-363.326153:-900.000000
+-99.748519:-373.326153:-900.000000
+PORT
+Orientation:"H"
+FIN_BOX
+BOX
+creaVtk:ImageContinuousErode3D:Box15
+ISEXEC:FALSE
+86.766945:-27.946018:-900.000000
+138.391945:-37.946018:-900.000000
+PORT
+Repetitions:"2"
+PORT
+X:"3"
+PORT
+Y:"3"
+PORT
+Z:"3"
+FIN_BOX
+BOX
+creaMaracasVisu:ColorLayerImageView:Box17
+ISEXEC:FALSE
+-182.971774:-213.746563:-900.000000
+-74.153795:-223.746563:-900.000000
+PORT
+TypeControlsInterface:"2"
+PORT
+WinTitle:"Connectivity after Erosion"
+PORT
+lstTransparenceBoundaries:"0"
+FIN_BOX
+BOX
+wx:LayoutLine:Box18
+ISEXEC:FALSE
+-198.282340:-320.226258:-900.000000
+-88.505122:-330.226258:-900.000000
+FIN_BOX
+BOX
+vtk:SegmentationConnectivity:Box19
+ISEXEC:FALSE
+86.586442:-90.622348:-900.000000
+138.586442:-100.622348:-900.000000
+PORT
+ThresholdMinMax:"250 260"
+PORT
+Value:"255"
+FIN_BOX
+BOX
+creaVtk:ImageContinuousDilate3D:Box21
+ISEXEC:FALSE
+120.268099:-116.594485:-900.000000
+171.868099:-126.594485:-900.000000
+PORT
+Repetitions:"0"
+PORT
+X:"3"
+PORT
+Y:"3"
+PORT
+Z:"3"
+FIN_BOX
+BOX
+creaMaracasVisu:ManualPaint_Model:Box22
+ISEXEC:FALSE
+132.271803:-217.538352:-900.000000
+192.911803:-227.538352:-900.000000
+PORT
+DistanceFill:"7"
+PORT
+GrayLevel:"255"
+PORT
+ToleranceFill:"5000"
+FIN_BOX
+BOX
+std:ConcatStrings:Box23
+ISEXEC:FALSE
+279.652968:41.704292:-900.000000
+319.377968:31.704292:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:ColorLayerImageView:Box24
+ISEXEC:FALSE
+-93.549175:-238.721391:-900.000000
+-45.624175:-248.721391:-900.000000
+PORT
+TypeControlsInterface:"2"
+PORT
+WinTitle:"Contour"
+PORT
+lstTransparenceBoundaries:"0"
+FIN_BOX
+BOX
+creaMaracasVisu:ColorLayerImageView:Box25
+ISEXEC:FALSE
+-46.164510:-259.315564:-900.000000
+1.760490:-269.315564:-900.000000
+PORT
+TypeControlsInterface:"2"
+PORT
+WinTitle:"Manaul paint over contour"
+PORT
+lstTransparenceBoundaries:"0"
+FIN_BOX
+BOX
+vtk:CreateImage:Box26
+ISEXEC:FALSE
+199.049406:-164.716260:-900.000000
+238.399406:-174.716260:-900.000000
+FIN_BOX
+BOX
+vtk:ImageVtkProperties:Box30
+ISEXEC:FALSE
+190.555886:-141.385916:-900.000000
+235.905886:-151.385916:-900.000000
+FIN_BOX
+BOX
+vtk:InversCrop:Box31
+ISEXEC:FALSE
+194.141721:-184.430525:-900.000000
+230.941721:-194.430525:-900.000000
+PORT
+Origin:"0 0 0"
+PORT
+Type:"1"
+FIN_BOX
+BOX
+vtk:BinaryOperations:Box42
+ISEXEC:FALSE
+228.848881:-297.021504:-900.000000
+271.798881:-307.021504:-900.000000
+FIN_BOX
+BOX
+std:GetVectorStringElement:Box43
+ISEXEC:FALSE
+269.393064:-39.079678:-900.000000
+318.793064:-49.079678:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:GetVectorStringElement:Box44
+ISEXEC:FALSE
+335.557143:-38.235763:-900.000000
+384.957143:-48.235763:-900.000000
+PORT
+I:"1"
+FIN_BOX
+BOX
+itk:BinaryThresholdImageFilter:Box45
+ISEXEC:FALSE
+301.535511:-181.107983:-900.000000
+353.710511:-191.107983:-900.000000
+PORT
+InsideValue:"126"
+PORT
+OutsideValue:"0"
+FIN_BOX
+BOX
+std:ConcatStrings:Box46
+ISEXEC:FALSE
+98.852025:37.311656:-900.000000
+138.577025:27.311656:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box47
+ISEXEC:FALSE
+168.837546:40.909042:-900.000000
+204.912546:30.909042:-900.000000
+FIN_BOX
+BOX
+std:MathOperation:Box49
+ISEXEC:FALSE
+197.798232:-2.006132:-900.000000
+238.848232:-12.006132:-900.000000
+PORT
+In2:"2"
+PORT
+Type:"2"
+FIN_BOX
+BOX
+std:ConcatStrings:Box50
+ISEXEC:FALSE
+151.373438:2.779371:-900.000000
+191.098438:-7.220629:-900.000000
+PORT
+In1:"3"
+FIN_BOX
+BOX
+creaMaracasVisu:ColorLayerImageView:Box54
+ISEXEC:FALSE
+-251.332481:-197.397418:-900.000000
+-82.913893:-207.397418:-900.000000
+PORT
+TypeControlsInterface:"2"
+PORT
+WinTitle:"Erosion"
+PORT
+lstTransparenceBoundaries:"0"
+FIN_BOX
+BOX
+wx:LayoutLine:Box41
+ISEXEC:FALSE
+-293.553421:-290.492249:-900.000000
+-100.566127:-300.492249:-900.000000
+FIN_BOX
+BOX
+wx:OutputText:Box48
+ISEXEC:FALSE
+-301.854860:-243.823607:-900.000000
+-126.221791:-253.823607:-900.000000
+PORT
+Title:"Depth"
+FIN_BOX
+BOX
+wx:OutputText:Box52
+ISEXEC:FALSE
+-276.517436:-256.409984:-900.000000
+-123.047842:-266.409984:-900.000000
+PORT
+Title:"Seed"
+FIN_BOX
+BOX
+wx:OutputText:Box53
+ISEXEC:FALSE
+-254.551016:-271.243698:-900.000000
+-120.254767:-281.243698:-900.000000
+PORT
+Title:"Seed"
+FIN_BOX
+BOX
+wx:LayoutTab:Box55
+ISEXEC:FALSE
+-318.814935:-219.886716:-900.000000
+-103.740076:-229.886716:-900.000000
+FIN_BOX
+BOX
+wx:LayoutTab:Box56
+ISEXEC:FALSE
+-239.842490:-236.699818:-900.000000
+-93.710398:-246.699818:-900.000000
+FIN_BOX
+BOX
+wx:LayoutTab:Box57
+ISEXEC:FALSE
+-190.058428:-253.036375:-900.000000
+-87.489458:-263.036375:-900.000000
+FIN_BOX
+BOX
+wx:LayoutTab:Box58
+ISEXEC:FALSE
+-130.743465:-271.398247:-900.000000
+-79.871981:-281.398247:-900.000000
+FIN_BOX
+BOX
+wx:LayoutTab:Box59
+ISEXEC:FALSE
+-78.100132:-279.871812:-900.000000
+-41.850132:-289.871812:-900.000000
+FIN_BOX
+BOX
+vtk:BinaryOperations:Box60
+ISEXEC:FALSE
+110.927168:-169.021578:-900.000000
+153.877168:-179.021578:-900.000000
+PORT
+Operation:"1"
+FIN_BOX
+CONNECTIONS:82
+CONNECTION
+Box05:Out:Box01:In
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box12:In
+NumberOfControlPoints:0
+CONNECTION
+Box01:Widget:Box09:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box12:Out:Box13:In
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView2:Box13:WxVtkBaseView
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView3:Box13:WxVtkBaseView1
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView4:Box13:WxVtkBaseView2
+NumberOfControlPoints:0
+CONNECTION
+Box09:Widget:Box14:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box12:Out:Box15:Image
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView2:Box17:WxVtkBaseView
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView3:Box17:WxVtkBaseView1
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView4:Box17:WxVtkBaseView2
+NumberOfControlPoints:0
+CONNECTION
+Box18:Widget:Box14:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box17:In
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box21:Image
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box12:ThresholdMinMax
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box22:Image
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView2:Box24:WxVtkBaseView
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView3:Box24:WxVtkBaseView1
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView4:Box24:WxVtkBaseView2
+NumberOfControlPoints:0
+CONNECTION
+Box22:Out:Box25:In
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView2:Box25:WxVtkBaseView
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView3:Box25:WxVtkBaseView1
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView4:Box25:WxVtkBaseView2
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box22:Range
+NumberOfControlPoints:0
+CONNECTION
+Box30:TypeName:Box26:OutputFormat
+NumberOfControlPoints:0
+CONNECTION
+Box30:Spacing:Box26:Spacing
+NumberOfControlPoints:0
+CONNECTION
+Box30:Size:Box26:Dimensions
+NumberOfControlPoints:0
+CONNECTION
+Box26:Out:Box31:ImageFix
+NumberOfControlPoints:0
+CONNECTION
+Box31:Out:Box22:Image2
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box31:ImageMove
+NumberOfControlPoints:0
+CONNECTION
+Box22:Out:Box42:In2
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box44:In
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box43:In
+NumberOfControlPoints:0
+CONNECTION
+Box43:Out:Box45:LowerThreshold
+NumberOfControlPoints:0
+CONNECTION
+Box44:Out:Box45:UpperThreshold
+NumberOfControlPoints:0
+CONNECTION
+Box45:Out:Box42:In1
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box45:In
+NumberOfControlPoints:0
+CONNECTION
+Box42:Out:resultImage:resultImage
+NumberOfControlPoints:0
+CONNECTION
+Threshold:Threshold:Box23:In1
+NumberOfControlPoints:0
+CONNECTION
+pointSeed:pointSeed:Box46:In1
+NumberOfControlPoints:0
+CONNECTION
+Box46:Out:Box12:PositionXYZ
+NumberOfControlPoints:0
+CONNECTION
+Box46:Out:Box19:PositionXYZ
+NumberOfControlPoints:0
+CONNECTION
+Depth:Depth:Box47:In
+NumberOfControlPoints:0
+CONNECTION
+Box47:Out:Box15:Repetitions
+NumberOfControlPoints:0
+CONNECTION
+Box49:Out:Box22:DistanceFill
+NumberOfControlPoints:0
+CONNECTION
+Box50:Out:Box15:X
+NumberOfControlPoints:0
+CONNECTION
+Box50:Out:Box15:Y
+NumberOfControlPoints:0
+CONNECTION
+Box50:Out:Box15:Z
+NumberOfControlPoints:0
+CONNECTION
+Box50:Out:Box21:X
+NumberOfControlPoints:0
+CONNECTION
+Box50:Out:Box21:Y
+NumberOfControlPoints:0
+CONNECTION
+Box50:Out:Box21:Z
+NumberOfControlPoints:0
+CONNECTION
+InImage:InImage:Box05:In
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView4:Box54:WxVtkBaseView2
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView3:Box54:WxVtkBaseView1
+NumberOfControlPoints:0
+CONNECTION
+Box01:wxVtkBaseView2:Box54:WxVtkBaseView
+NumberOfControlPoints:0
+CONNECTION
+Box15:Out:Box54:In
+NumberOfControlPoints:0
+CONNECTION
+Box14:Widget:OutWidget:OutWidget
+NumberOfControlPoints:0
+CONNECTION
+Box21:Out:Box24:In
+NumberOfControlPoints:0
+CONNECTION
+Box21:Out:Box30:In
+NumberOfControlPoints:0
+CONNECTION
+Box47:Out:Box49:In1
+NumberOfControlPoints:0
+CONNECTION
+Box15:Out:Box19:In
+NumberOfControlPoints:0
+CONNECTION
+Box47:Out:Box48:In
+NumberOfControlPoints:0
+CONNECTION
+Box48:Widget:Box41:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box46:Out:Box52:In
+NumberOfControlPoints:0
+CONNECTION
+Box52:Widget:Box41:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box53:In
+NumberOfControlPoints:0
+CONNECTION
+Box53:Widget:Box41:Widget6
+NumberOfControlPoints:0
+CONNECTION
+Box41:Widget:Box18:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box13:Widget:Box55:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box55:Widget:Box18:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box54:Widget:Box56:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box17:Widget:Box57:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box24:Widget:Box58:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box25:Widget:Box59:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box59:Widget:Box18:Widget8
+NumberOfControlPoints:0
+CONNECTION
+Box58:Widget:Box18:Widget6
+NumberOfControlPoints:0
+CONNECTION
+Box57:Widget:Box18:Widget4
+NumberOfControlPoints:0
+CONNECTION
+Box56:Widget:Box18:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box21:Out:Box60:In1
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box60:In2
+NumberOfControlPoints:0
+CONNECTION
+Box60:Out:Box22:ByImagePoints
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/C10/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SegmentationConnectivityEED.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include creaMaracasVisu
+include wx
+include vtk
+include creaVtk
+include std
+include itk
+
+define SegmentationConnectivityEED creaMaracasVisu
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new creaMaracasVisu:ViewerNV Box01
+ set Box01.nTypeView "6 1 2 0"
+
+new creaMaracasVisu:ImageChangeInformation Box05
+
+new wx:LayoutTab Box09
+
+new vtk:SegmentationConnectivity Box12
+ set Box12.Value "255"
+
+new creaMaracasVisu:ColorLayerImageView Box13
+ set Box13.TypeControlsInterface "2"
+ set Box13.WinTitle "General Connectivity"
+ set Box13.lstTransparenceBoundaries "0"
+
+new wx:LayoutSplit Box14
+ set Box14.Orientation "H"
+
+new creaVtk:ImageContinuousErode3D Box15
+ set Box15.Repetitions "2"
+ set Box15.X "3"
+ set Box15.Y "3"
+ set Box15.Z "3"
+
+new creaMaracasVisu:ColorLayerImageView Box17
+ set Box17.TypeControlsInterface "2"
+ set Box17.WinTitle "Connectivity after Erosion"
+ set Box17.lstTransparenceBoundaries "0"
+
+new wx:LayoutLine Box18
+
+new vtk:SegmentationConnectivity Box19
+ set Box19.ThresholdMinMax "250 260"
+ set Box19.Value "255"
+
+new creaVtk:ImageContinuousDilate3D Box21
+ set Box21.Repetitions "0"
+ set Box21.X "3"
+ set Box21.Y "3"
+ set Box21.Z "3"
+
+new creaMaracasVisu:ManualPaint_Model Box22
+ set Box22.DistanceFill "7"
+ set Box22.GrayLevel "255"
+ set Box22.ToleranceFill "5000"
+
+new std:ConcatStrings Box23
+
+new creaMaracasVisu:ColorLayerImageView Box24
+ set Box24.TypeControlsInterface "2"
+ set Box24.WinTitle "Contour"
+ set Box24.lstTransparenceBoundaries "0"
+
+new creaMaracasVisu:ColorLayerImageView Box25
+ set Box25.TypeControlsInterface "2"
+ set Box25.WinTitle "Manaul paint over contour"
+ set Box25.lstTransparenceBoundaries "0"
+
+new vtk:CreateImage Box26
+
+new vtk:ImageVtkProperties Box30
+
+new vtk:InversCrop Box31
+ set Box31.Origin "0 0 0"
+ set Box31.Type "1"
+
+new vtk:BinaryOperations Box42
+
+new std:GetVectorStringElement Box43
+ set Box43.I "0"
+
+new std:GetVectorStringElement Box44
+ set Box44.I "1"
+
+new itk:BinaryThresholdImageFilter Box45
+ set Box45.InsideValue "126"
+ set Box45.OutsideValue "0"
+
+new std:ConcatStrings Box46
+
+new std:MagicBox Box47
+
+new std:MathOperation Box49
+ set Box49.In2 "2"
+ set Box49.Type "2"
+
+new std:ConcatStrings Box50
+ set Box50.In1 "3"
+
+new creaMaracasVisu:ColorLayerImageView Box54
+ set Box54.TypeControlsInterface "2"
+ set Box54.WinTitle "Erosion"
+ set Box54.lstTransparenceBoundaries "0"
+
+new wx:LayoutLine Box41
+
+new wx:OutputText Box48
+ set Box48.Title "Depth"
+
+new wx:OutputText Box52
+ set Box52.Title "Seed"
+
+new wx:OutputText Box53
+ set Box53.Title "Seed"
+
+new wx:LayoutTab Box55
+
+new wx:LayoutTab Box56
+
+new wx:LayoutTab Box57
+
+new wx:LayoutTab Box58
+
+new wx:LayoutTab Box59
+
+new vtk:BinaryOperations Box60
+ set Box60.Operation "1"
+
+
+connect Box05.Out Box01.In
+connect Box05.Out Box12.In
+connect Box01.Widget Box09.Widget1
+connect Box12.Out Box13.In
+connect Box01.wxVtkBaseView2 Box13.WxVtkBaseView
+connect Box01.wxVtkBaseView3 Box13.WxVtkBaseView1
+connect Box01.wxVtkBaseView4 Box13.WxVtkBaseView2
+connect Box09.Widget Box14.Widget2
+connect Box12.Out Box15.Image
+connect Box01.wxVtkBaseView2 Box17.WxVtkBaseView
+connect Box01.wxVtkBaseView3 Box17.WxVtkBaseView1
+connect Box01.wxVtkBaseView4 Box17.WxVtkBaseView2
+connect Box18.Widget Box14.Widget1
+connect Box19.Out Box17.In
+connect Box19.Out Box21.Image
+connect Box23.Out Box12.ThresholdMinMax
+connect Box05.Out Box22.Image
+connect Box01.wxVtkBaseView2 Box24.WxVtkBaseView
+connect Box01.wxVtkBaseView3 Box24.WxVtkBaseView1
+connect Box01.wxVtkBaseView4 Box24.WxVtkBaseView2
+connect Box22.Out Box25.In
+connect Box01.wxVtkBaseView2 Box25.WxVtkBaseView
+connect Box01.wxVtkBaseView3 Box25.WxVtkBaseView1
+connect Box01.wxVtkBaseView4 Box25.WxVtkBaseView2
+connect Box23.Out Box22.Range
+connect Box30.TypeName Box26.OutputFormat
+connect Box30.Spacing Box26.Spacing
+connect Box30.Size Box26.Dimensions
+connect Box26.Out Box31.ImageFix
+connect Box31.Out Box22.Image2
+connect Box19.Out Box31.ImageMove
+connect Box22.Out Box42.In2
+connect Box23.Out Box44.In
+connect Box23.Out Box43.In
+connect Box43.Out Box45.LowerThreshold
+connect Box44.Out Box45.UpperThreshold
+connect Box45.Out Box42.In1
+connect Box05.Out Box45.In
+connect Box46.Out Box12.PositionXYZ
+connect Box46.Out Box19.PositionXYZ
+connect Box47.Out Box15.Repetitions
+connect Box49.Out Box22.DistanceFill
+connect Box50.Out Box15.X
+connect Box50.Out Box15.Y
+connect Box50.Out Box15.Z
+connect Box50.Out Box21.X
+connect Box50.Out Box21.Y
+connect Box50.Out Box21.Z
+connect Box01.wxVtkBaseView4 Box54.WxVtkBaseView2
+connect Box01.wxVtkBaseView3 Box54.WxVtkBaseView1
+connect Box01.wxVtkBaseView2 Box54.WxVtkBaseView
+connect Box15.Out Box54.In
+connect Box21.Out Box24.In
+connect Box21.Out Box30.In
+connect Box47.Out Box49.In1
+connect Box15.Out Box19.In
+connect Box47.Out Box48.In
+connect Box48.Widget Box41.Widget1
+connect Box46.Out Box52.In
+connect Box52.Widget Box41.Widget3
+connect Box23.Out Box53.In
+connect Box53.Widget Box41.Widget6
+connect Box41.Widget Box18.Widget1
+connect Box13.Widget Box55.Widget1
+connect Box55.Widget Box18.Widget2
+connect Box54.Widget Box56.Widget1
+connect Box17.Widget Box57.Widget1
+connect Box24.Widget Box58.Widget2
+connect Box25.Widget Box59.Widget2
+connect Box59.Widget Box18.Widget8
+connect Box58.Widget Box18.Widget6
+connect Box57.Widget Box18.Widget4
+connect Box56.Widget Box18.Widget3
+connect Box21.Out Box60.In1
+connect Box19.Out Box60.In2
+connect Box60.Out Box22.ByImagePoints
+
+# Complex input ports
+input Threshold Box23.In1 " "
+input pointSeed Box46.In1 " "
+input Depth Box47.In " "
+input InImage Box05.In " "
+
+# Complex output ports
+output resultImage Box42.Out " "
+output OutWidget Box14.Widget " "
+
+
+endefine
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SliceImage-3DVisu.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:InfoDev
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:SliceImage-3DVisu
+PACKAGENAME:creaMaracasVisu
+COMPLEXOUTPUTS:1
+COMPLEX_PORT
+BoxChangeImageSlice
+-180.302777:-317.574649:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:11
+COMPLEX_PORT
+Direction
+-431.136158:282.815347:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+WindowColorLevel
+-363.292621:285.496367:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+ColorBorder
+-299.200657:287.687412:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+Image
+-246.466668:285.529399:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+SliceDeep
+-173.833881:283.175203:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+SliceOpacity
+-137.466212:283.557306:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+Render
+-100.149261:284.086627:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+BorderActive
+-660.228760:278.316839:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+Interpolation_mode
+37.224821:284.244621:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+TypeTransparence
+-493.056508:283.285820:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+transparenceBeforeAboveRange
+-552.809749:283.731184:-900.000000
+FIN_COMPLEX_PORT
+BOXES:45
+BOX
+creaMaracasVisu:SliceImage:Box00
+ISEXEC:FALSE
+-195.575128:-74.642011:-900.000000
+-158.350128:-84.642011:-900.000000
+PORT
+TypeOrientation:"1"
+FIN_BOX
+BOX
+creaMaracasVisu:ImageActor:Box04
+ISEXEC:FALSE
+-175.861342:-256.750145:-900.000000
+-137.911342:-266.750145:-900.000000
+FIN_BOX
+BOX
+vtk:Transform:Box17
+ISEXEC:FALSE
+-320.706867:-77.874112:-900.000000
+-285.131867:-87.874112:-900.000000
+FIN_BOX
+BOX
+std:ConcatStrings:Box18
+ISEXEC:FALSE
+-272.546519:-70.682423:-900.000000
+-232.821519:-80.682423:-900.000000
+PORT
+In1:"0 "
+PORT
+In2:"0 "
+FIN_BOX
+BOX
+vtk:ImageVtkProperties:Box20
+ISEXEC:FALSE
+-312.672504:29.786119:-900.000000
+-267.322504:19.786119:-900.000000
+FIN_BOX
+BOX
+creaVtk:ScalarsToColors:Box22
+ISEXEC:FALSE
+-266.449667:-213.711970:-900.000000
+-224.924667:-223.711970:-900.000000
+PORT
+Type:"101"
+FIN_BOX
+BOX
+vtk:Transform:Box32
+ISEXEC:FALSE
+-321.807500:-96.018762:-900.000000
+-286.232500:-106.018762:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:DrawAxisTree3D:Box26
+ISEXEC:FALSE
+-516.159924:-217.577049:-900.000000
+-467.839924:-227.577049:-900.000000
+PORT
+Colour:"0 0 0"
+PORT
+iAxis:"0"
+PORT
+lstIndexs:"5"
+PORT
+lstPointX:"0 50 50 0 0"
+PORT
+lstPointY:"0 0 50 50 0"
+PORT
+lstPointZ:"0 0 0 0 0"
+FIN_BOX
+BOX
+vtk:Transform:Box27
+ISEXEC:FALSE
+-316.662998:-136.217224:-900.000000
+-281.087998:-146.217224:-900.000000
+FIN_BOX
+BOX
+std:CreateArithmeticSuiteVector:Box33
+ISEXEC:FALSE
+-531.652610:-47.521093:-900.000000
+-477.677610:-57.521093:-900.000000
+PORT
+Delta:"0"
+PORT
+Size:"5"
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box34
+ISEXEC:FALSE
+-528.461121:-23.430170:-900.000000
+-477.411121:-33.430170:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:MathOperationVector:Box35
+ISEXEC:FALSE
+-532.115714:-65.685386:-900.000000
+-484.590714:-75.685386:-900.000000
+PORT
+In1:"0 1 1 0 0 "
+PORT
+Type:"2"
+FIN_BOX
+BOX
+std:CreateArithmeticSuiteVector:Box36
+ISEXEC:FALSE
+-461.446157:-46.434918:-900.000000
+-407.471157:-56.434918:-900.000000
+PORT
+Delta:"0"
+PORT
+Size:"5"
+FIN_BOX
+BOX
+std:MathOperationVector:Box37
+ISEXEC:FALSE
+-462.838158:-67.517853:-900.000000
+-415.313158:-77.517853:-900.000000
+PORT
+In1:"0 0 1 1 0 "
+PORT
+Type:"2"
+FIN_BOX
+BOX
+vtk:vtkImageDataPointerRelay:Box38
+ISEXEC:FALSE
+-242.147618:127.630990:-900.000000
+-189.972618:117.630990:-900.000000
+FIN_BOX
+BOX
+std:ConcatStrings:Box40
+ISEXEC:FALSE
+-451.527135:125.243442:-900.000000
+-411.802135:115.243442:-900.000000
+PORT
+In1:"0"
+FIN_BOX
+BOX
+std:StringSelect:Box41
+ISEXEC:FALSE
+-369.319073:-76.024573:-900.000000
+-327.159073:-86.024573:-900.000000
+PORT
+In0:"0 1 0 0"
+PORT
+In1:"90 1 0 0"
+PORT
+In2:"-90 0 1 0"
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box44
+ISEXEC:FALSE
+-459.560548:-23.370210:-900.000000
+-408.510548:-33.370210:-900.000000
+PORT
+I:"1"
+FIN_BOX
+BOX
+std:StringSelect:Box45
+ISEXEC:FALSE
+-589.306604:57.564106:-900.000000
+-547.146604:47.564106:-900.000000
+PORT
+In0:"0"
+PORT
+In1:"0"
+PORT
+In2:"2"
+FIN_BOX
+BOX
+std:StringSelect:Box46
+ISEXEC:FALSE
+-544.486050:58.335903:-900.000000
+-502.326050:48.335903:-900.000000
+PORT
+In0:"1"
+PORT
+In1:"2"
+PORT
+In2:"1"
+FIN_BOX
+BOX
+vtk:Transform:Box52
+ISEXEC:FALSE
+-312.196510:-56.034435:-900.000000
+-276.621510:-66.034435:-900.000000
+FIN_BOX
+BOX
+std:StringSelect:Box55
+ISEXEC:FALSE
+-373.718706:28.297047:-900.000000
+-331.558706:18.297047:-900.000000
+PORT
+In0:"1"
+PORT
+In1:"-1"
+PORT
+In2:"-1"
+FIN_BOX
+BOX
+std:ConcatStrings:Box57
+ISEXEC:FALSE
+-364.668989:127.201835:-900.000000
+-324.943989:117.201835:-900.000000
+PORT
+In2:" "
+FIN_BOX
+BOX
+std:ConcatStrings:Box60
+ISEXEC:FALSE
+-192.633834:15.326494:-900.000000
+-152.908834:5.326494:-900.000000
+PORT
+BoxProcessMode:"Reactive"
+FIN_BOX
+BOX
+std:MagicBox:Box61
+ISEXEC:FALSE
+-104.070259:168.890570:-900.000000
+-67.995259:158.890570:-900.000000
+FIN_BOX
+BOX
+std:ConcatStrings:Box62
+ISEXEC:FALSE
+-297.110093:125.771424:-900.000000
+-257.385093:115.771424:-900.000000
+PORT
+In1:"1 1 0"
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box64
+ISEXEC:FALSE
+-387.763181:205.752953:-900.000000
+-336.713181:195.752953:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:ConcatStrings:Box65
+ISEXEC:FALSE
+-366.909956:245.293365:-900.000000
+-327.184956:235.293365:-900.000000
+FIN_BOX
+BOX
+std:Div:Box66
+ISEXEC:FALSE
+-395.212975:191.256056:-900.000000
+-365.887975:181.256056:-900.000000
+PORT
+In2:"2"
+FIN_BOX
+BOX
+std:Add:Box67
+ISEXEC:FALSE
+-389.417275:153.273064:-900.000000
+-358.967275:143.273064:-900.000000
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box68
+ISEXEC:FALSE
+-350.648788:191.725514:-900.000000
+-299.598788:181.725514:-900.000000
+PORT
+I:"1"
+FIN_BOX
+BOX
+std:Mul:Box69
+ISEXEC:FALSE
+-406.100940:175.438942:-900.000000
+-376.300940:165.438942:-900.000000
+PORT
+In2:"-1"
+FIN_BOX
+BOX
+std:Add:Box70
+ISEXEC:FALSE
+-345.592205:152.557386:-900.000000
+-315.142205:142.557386:-900.000000
+FIN_BOX
+BOX
+std:MathOperation:Box72
+ISEXEC:FALSE
+-257.408453:-30.946538:-900.000000
+-216.358453:-40.946538:-900.000000
+PORT
+In1:"1"
+PORT
+Type:"2"
+FIN_BOX
+BOX
+std:MathOperation:Box73
+ISEXEC:FALSE
+-263.661305:-53.857110:-900.000000
+-222.611305:-63.857110:-900.000000
+PORT
+Type:"2"
+FIN_BOX
+BOX
+std:StringSelect:Box74
+ISEXEC:FALSE
+-336.062237:53.397805:-900.000000
+-293.902237:43.397805:-900.000000
+PORT
+In0:"2"
+PORT
+In1:"0"
+PORT
+In2:"1"
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box75
+ISEXEC:FALSE
+-261.893099:1.211259:-900.000000
+-210.843099:-8.788741:-900.000000
+FIN_BOX
+BOX
+vtk:Transform:Box79
+ISEXEC:FALSE
+-313.408336:-36.360191:-900.000000
+-277.833336:-46.360191:-900.000000
+PORT
+Scale:"1 1 1"
+FIN_BOX
+BOX
+creaMaracasVisu:ImageChangeInformation:Box80
+ISEXEC:FALSE
+-90.830876:-128.464526:-900.000000
+-39.305876:-138.464526:-900.000000
+PORT
+NewSpacing:"1 1 1"
+FIN_BOX
+BOX
+std:StringSelect:Box81
+ISEXEC:FALSE
+-474.548561:74.412243:-900.000000
+-432.388561:64.412243:-900.000000
+PORT
+In0:"0"
+PORT
+In1:"-1"
+PORT
+In2:"-2"
+FIN_BOX
+BOX
+std:MathOperationVector:Box82
+ISEXEC:FALSE
+-450.471349:8.131320:-900.000000
+-402.946349:-1.868680:-900.000000
+PORT
+In1:"-1 -1 -1"
+PORT
+Type:"0"
+FIN_BOX
+BOX
+std:MagicBox:Box83
+ISEXEC:FALSE
+-672.007424:211.414023:-900.000000
+-635.932424:201.414023:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box78
+ISEXEC:FALSE
+26.038479:172.632362:-900.000000
+62.113479:162.632362:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box84
+ISEXEC:FALSE
+-501.738590:206.404618:-900.000000
+-465.663590:196.404618:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box85
+ISEXEC:FALSE
+-570.159315:210.007455:-900.000000
+-534.084315:200.007455:-900.000000
+FIN_BOX
+CONNECTIONS:71
+CONNECTION
+Box22:LookupTable:Box04:LookupTable
+NumberOfControlPoints:0
+CONNECTION
+Box32:Out:Box04:Transform
+NumberOfControlPoints:0
+CONNECTION
+Box26:BoxChange:Box04:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box32:Out:Box27:In
+NumberOfControlPoints:0
+CONNECTION
+Box27:Out:Box26:Transform
+NumberOfControlPoints:0
+CONNECTION
+Box34:Out:Box33:FirstValue
+NumberOfControlPoints:0
+CONNECTION
+Box33:ArithmeticSuiteVector:Box35:In0
+NumberOfControlPoints:0
+CONNECTION
+Box35:Out:Box26:lstPointX
+NumberOfControlPoints:0
+CONNECTION
+Box36:ArithmeticSuiteVector:Box37:In0
+NumberOfControlPoints:0
+CONNECTION
+Box37:Out:Box26:lstPointY
+NumberOfControlPoints:0
+CONNECTION
+Box38:Out:Box00:In
+NumberOfControlPoints:0
+CONNECTION
+Box38:Out:Box20:In
+NumberOfControlPoints:0
+CONNECTION
+Box40:Out:Box41:In
+NumberOfControlPoints:0
+CONNECTION
+Box44:Out:Box36:FirstValue
+NumberOfControlPoints:0
+CONNECTION
+Box40:Out:Box45:In
+NumberOfControlPoints:0
+CONNECTION
+Box40:Out:Box46:In
+NumberOfControlPoints:0
+CONNECTION
+Box45:Out:Box34:I
+NumberOfControlPoints:0
+CONNECTION
+Box46:Out:Box44:I
+NumberOfControlPoints:0
+CONNECTION
+Box17:Out:Box32:In
+NumberOfControlPoints:0
+CONNECTION
+Box52:Out:Box17:In
+NumberOfControlPoints:0
+CONNECTION
+Box40:Out:Box55:In
+NumberOfControlPoints:0
+CONNECTION
+Box57:Out:Box22:Range
+NumberOfControlPoints:0
+CONNECTION
+Box60:Out:Box00:Slice
+NumberOfControlPoints:0
+CONNECTION
+Box61:Out:Box26:Renderer
+NumberOfControlPoints:0
+CONNECTION
+Box61:Out:Box04:Renderer
+NumberOfControlPoints:0
+CONNECTION
+Box62:Out:Box26:Colour
+NumberOfControlPoints:0
+CONNECTION
+Box00:BoxChange:Box26:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Direction:Direction:Box40:In1
+NumberOfControlPoints:0
+CONNECTION
+ColorBorder:ColorBorder:Box62:In1
+NumberOfControlPoints:0
+CONNECTION
+Image:Image:Box38:In
+NumberOfControlPoints:0
+CONNECTION
+SliceDeep:SliceDeep:Box60:In1
+NumberOfControlPoints:0
+CONNECTION
+SliceOpacity:SliceOpacity:Box04:Opacity
+NumberOfControlPoints:0
+CONNECTION
+Render:Render:Box61:In
+NumberOfControlPoints:0
+CONNECTION
+WindowColorLevel:WindowColorLevel:Box65:In1
+NumberOfControlPoints:0
+CONNECTION
+Box65:Out:Box64:In
+NumberOfControlPoints:0
+CONNECTION
+Box64:Out:Box66:In1
+NumberOfControlPoints:0
+CONNECTION
+Box65:Out:Box68:In
+NumberOfControlPoints:0
+CONNECTION
+Box66:Out:Box69:In1
+NumberOfControlPoints:0
+CONNECTION
+Box68:Out:Box67:In1
+NumberOfControlPoints:0
+CONNECTION
+Box69:Out:Box67:In2
+NumberOfControlPoints:0
+CONNECTION
+Box67:Out:Box57:In1
+NumberOfControlPoints:0
+CONNECTION
+Box66:Out:Box70:In1
+NumberOfControlPoints:0
+CONNECTION
+Box68:Out:Box70:In2
+NumberOfControlPoints:0
+CONNECTION
+Box70:Out:Box57:In3
+NumberOfControlPoints:0
+CONNECTION
+Box04:BoxChange:BoxChangeImageSlice:BoxChangeImageSlice
+NumberOfControlPoints:0
+CONNECTION
+Box60:Out:Box72:In2
+NumberOfControlPoints:0
+CONNECTION
+Box72:Out:Box73:In1
+NumberOfControlPoints:0
+CONNECTION
+Box55:Out:Box73:In2
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box32:Translate
+NumberOfControlPoints:0
+CONNECTION
+Box73:Out:Box18:In3
+NumberOfControlPoints:0
+CONNECTION
+Box40:Out:Box74:In
+NumberOfControlPoints:0
+CONNECTION
+Box20:Spacing:Box75:In
+NumberOfControlPoints:0
+CONNECTION
+Box74:Out:Box75:I
+NumberOfControlPoints:0
+CONNECTION
+Box79:Out:Box52:In
+NumberOfControlPoints:0
+CONNECTION
+Box00:Out:Box80:In
+NumberOfControlPoints:0
+CONNECTION
+Box80:Out:Box04:In
+NumberOfControlPoints:0
+CONNECTION
+Box20:Spacing:Box79:Scale
+NumberOfControlPoints:0
+CONNECTION
+Box41:Out:Box17:RotateWXYZ
+NumberOfControlPoints:0
+CONNECTION
+Box40:Out:Box81:In
+NumberOfControlPoints:0
+CONNECTION
+Box81:Out:Box00:TypeOrientation
+NumberOfControlPoints:0
+CONNECTION
+Box20:Size:Box82:In0
+NumberOfControlPoints:0
+CONNECTION
+Box82:Out:Box34:In
+NumberOfControlPoints:0
+CONNECTION
+Box82:Out:Box44:In
+NumberOfControlPoints:0
+CONNECTION
+BorderActive:BorderActive:Box83:In
+NumberOfControlPoints:0
+CONNECTION
+Box83:Out:Box26:Active
+NumberOfControlPoints:0
+CONNECTION
+Interpolation_mode:Interpolation_mode:Box78:In
+NumberOfControlPoints:0
+CONNECTION
+Box78:Out:Box04:InterpolationMode
+NumberOfControlPoints:0
+CONNECTION
+TypeTransparence:TypeTransparence:Box84:In
+NumberOfControlPoints:0
+CONNECTION
+Box84:Out:Box22:Type
+NumberOfControlPoints:0
+CONNECTION
+Box85:Out:Box22:BelowAboveRangeTransparence
+NumberOfControlPoints:0
+CONNECTION
+transparenceBeforeAboveRange:transparenceBeforeAboveRange:Box85:In
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SliceImage-3DVisu.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include creaMaracasVisu
+include vtk
+include std
+include creaVtk
+
+define SliceImage-3DVisu creaMaracasVisu
+
+author "InfoDev"
+description "Description ??"
+
+category "<VOID>"
+
+new creaMaracasVisu:SliceImage Box00
+ set Box00.TypeOrientation "1"
+
+new creaMaracasVisu:ImageActor Box04
+
+new vtk:Transform Box17
+
+new std:ConcatStrings Box18
+ set Box18.In1 "0 "
+ set Box18.In2 "0 "
+
+new vtk:ImageVtkProperties Box20
+
+new creaVtk:ScalarsToColors Box22
+ set Box22.Type "101"
+
+new vtk:Transform Box32
+
+new creaMaracasVisu:DrawAxisTree3D Box26
+ set Box26.Colour "0 0 0"
+ set Box26.iAxis "0"
+ set Box26.lstIndexs "5"
+ set Box26.lstPointX "0 50 50 0 0"
+ set Box26.lstPointY "0 0 50 50 0"
+ set Box26.lstPointZ "0 0 0 0 0"
+
+new vtk:Transform Box27
+
+new std:CreateArithmeticSuiteVector Box33
+ set Box33.Delta "0"
+ set Box33.Size "5"
+
+new std:GetVectorDoubleElement Box34
+ set Box34.I "0"
+
+new std:MathOperationVector Box35
+ set Box35.In1 "0 1 1 0 0 "
+ set Box35.Type "2"
+
+new std:CreateArithmeticSuiteVector Box36
+ set Box36.Delta "0"
+ set Box36.Size "5"
+
+new std:MathOperationVector Box37
+ set Box37.In1 "0 0 1 1 0 "
+ set Box37.Type "2"
+
+new vtk:vtkImageDataPointerRelay Box38
+
+new std:ConcatStrings Box40
+ set Box40.In1 "0"
+
+new std:StringSelect Box41
+ set Box41.In0 "0 1 0 0"
+ set Box41.In1 "90 1 0 0"
+ set Box41.In2 "-90 0 1 0"
+
+new std:GetVectorDoubleElement Box44
+ set Box44.I "1"
+
+new std:StringSelect Box45
+ set Box45.In0 "0"
+ set Box45.In1 "0"
+ set Box45.In2 "2"
+
+new std:StringSelect Box46
+ set Box46.In0 "1"
+ set Box46.In1 "2"
+ set Box46.In2 "1"
+
+new vtk:Transform Box52
+
+new std:StringSelect Box55
+ set Box55.In0 "1"
+ set Box55.In1 "-1"
+ set Box55.In2 "-1"
+
+new std:ConcatStrings Box57
+ set Box57.In2 " "
+
+new std:ConcatStrings Box60
+ set Box60.BoxProcessMode "Reactive"
+
+new std:MagicBox Box61
+
+new std:ConcatStrings Box62
+ set Box62.In1 "1 1 0"
+
+new std:GetVectorDoubleElement Box64
+ set Box64.I "0"
+
+new std:ConcatStrings Box65
+
+new std:Div Box66
+ set Box66.In2 "2"
+
+new std:Add Box67
+
+new std:GetVectorDoubleElement Box68
+ set Box68.I "1"
+
+new std:Mul Box69
+ set Box69.In2 "-1"
+
+new std:Add Box70
+
+new std:MathOperation Box72
+ set Box72.In1 "1"
+ set Box72.Type "2"
+
+new std:MathOperation Box73
+ set Box73.Type "2"
+
+new std:StringSelect Box74
+ set Box74.In0 "2"
+ set Box74.In1 "0"
+ set Box74.In2 "1"
+
+new std:GetVectorDoubleElement Box75
+
+new vtk:Transform Box79
+ set Box79.Scale "1 1 1"
+
+new creaMaracasVisu:ImageChangeInformation Box80
+ set Box80.NewSpacing "1 1 1"
+
+new std:StringSelect Box81
+ set Box81.In0 "0"
+ set Box81.In1 "-1"
+ set Box81.In2 "-2"
+
+new std:MathOperationVector Box82
+ set Box82.In1 "-1 -1 -1"
+ set Box82.Type "0"
+
+new std:MagicBox Box83
+
+new std:MagicBox Box78
+
+new std:MagicBox Box84
+
+new std:MagicBox Box85
+
+
+connect Box22.LookupTable Box04.LookupTable
+connect Box32.Out Box04.Transform
+connect Box26.BoxChange Box04.BoxExecute
+connect Box32.Out Box27.In
+connect Box27.Out Box26.Transform
+connect Box34.Out Box33.FirstValue
+connect Box33.ArithmeticSuiteVector Box35.In0
+connect Box35.Out Box26.lstPointX
+connect Box36.ArithmeticSuiteVector Box37.In0
+connect Box37.Out Box26.lstPointY
+connect Box38.Out Box00.In
+connect Box38.Out Box20.In
+connect Box40.Out Box41.In
+connect Box44.Out Box36.FirstValue
+connect Box40.Out Box45.In
+connect Box40.Out Box46.In
+connect Box45.Out Box34.I
+connect Box46.Out Box44.I
+connect Box17.Out Box32.In
+connect Box52.Out Box17.In
+connect Box40.Out Box55.In
+connect Box57.Out Box22.Range
+connect Box60.Out Box00.Slice
+connect Box61.Out Box26.Renderer
+connect Box61.Out Box04.Renderer
+connect Box62.Out Box26.Colour
+connect Box00.BoxChange Box26.BoxExecute
+connect Box65.Out Box64.In
+connect Box64.Out Box66.In1
+connect Box65.Out Box68.In
+connect Box66.Out Box69.In1
+connect Box68.Out Box67.In1
+connect Box69.Out Box67.In2
+connect Box67.Out Box57.In1
+connect Box66.Out Box70.In1
+connect Box68.Out Box70.In2
+connect Box70.Out Box57.In3
+connect Box60.Out Box72.In2
+connect Box72.Out Box73.In1
+connect Box55.Out Box73.In2
+connect Box18.Out Box32.Translate
+connect Box73.Out Box18.In3
+connect Box40.Out Box74.In
+connect Box20.Spacing Box75.In
+connect Box74.Out Box75.I
+connect Box79.Out Box52.In
+connect Box00.Out Box80.In
+connect Box80.Out Box04.In
+connect Box20.Spacing Box79.Scale
+connect Box41.Out Box17.RotateWXYZ
+connect Box40.Out Box81.In
+connect Box81.Out Box00.TypeOrientation
+connect Box20.Size Box82.In0
+connect Box82.Out Box34.In
+connect Box82.Out Box44.In
+connect Box83.Out Box26.Active
+connect Box78.Out Box04.InterpolationMode
+connect Box84.Out Box22.Type
+connect Box85.Out Box22.BelowAboveRangeTransparence
+
+# Complex input ports
+input Direction Box40.In1 " "
+input ColorBorder Box62.In1 " "
+input Image Box38.In " "
+input SliceDeep Box60.In1 " "
+input SliceOpacity Box04.Opacity " "
+input Render Box61.In " "
+input WindowColorLevel Box65.In1 " "
+input BorderActive Box83.In " "
+input Interpolation_mode Box78.In " "
+input TypeTransparence Box84.In " "
+input transparenceBeforeAboveRange Box85.In " "
+
+# Complex output ports
+output BoxChangeImageSlice Box04.BoxChange " "
+
+
+endefine
namespace bbcreaMaracasVisu
{
+
+class ColorLayerImageView;
+
+class ColorLayerImageViewPanel_widgetBox : public ColorLayerImageViewPanel
+{
+ public:
+ ColorLayerImageViewPanel_widgetBox( wxWindow * parent, int min, int max,int opacity, int type );
+ void SetBox(ColorLayerImageView* box);
+ void ChangeOpacity();
+ private:
+ ColorLayerImageView *mBox;
+};
+
+ColorLayerImageViewPanel_widgetBox::ColorLayerImageViewPanel_widgetBox( wxWindow * parent, int min, int max,int opacity, int type )
+ : ColorLayerImageViewPanel( parent, min, max, opacity, type )
+{
+ mBox=NULL;
+}
+
+void ColorLayerImageViewPanel_widgetBox::ChangeOpacity()
+{
+ ColorLayerImageViewPanel::ChangeOpacity();
+ if (mBox!=NULL)
+ {
+ mBox->bbSetOutputOutOpacity( GetOpacity() );
+ mBox->bbSignalOutputModification();
+ } // if mBox
+}
+
+void ColorLayerImageViewPanel_widgetBox::SetBox(ColorLayerImageView* box)
+{
+ mBox=box;
+}
+
+
+
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ColorLayerImageView)
BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView,bbtk::WxBlackBox);
//=====
//=====
void ColorLayerImageView::Process()
{
- ColorLayerImageViewPanel *clivp = (ColorLayerImageViewPanel*)bbGetOutputWidget();
-
+ ColorLayerImageViewPanel_widgetBox *clivp = (ColorLayerImageViewPanel_widgetBox*)bbGetOutputWidget();
if (firsttime==true)
{
// firsttime=false;
clivp->SetActive( bbGetInputActive() );
}
-
clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() );
clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() );
clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() );
-
std::vector<double> range = bbGetInputlstRangeForColorBar();
clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
-
std::vector<int> colorbarposition = bbGetInputColorBarPosition();
clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
-
std::vector<double> base_color = bbGetInputlstBaseColor();
clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color );
-
std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
-
std::vector<double> transparence_level_boundaries = bbGetInputlstTransparenceBoundaries();
clivp->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries );
-
clivp->GetColorLayerImageViewManager()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() );
clivp->SetFittingMode( bbGetInputFittingMode() );
-
clivp->SetImage( bbGetInputIn() );
-
bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) );
-
- if (firsttime==true)
- {
+ bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) );
+ bbSetOutputOutOpacity( clivp->GetOpacity() );
+
+ if (firsttime==true)
+ {
firsttime=false;
clivp->ChangeOpacity();
- }
-
+ clivp->SetBox(this);
+ }
}
//=====
// Don't edit this file. This file is generated from xml description..
//=====
void ColorLayerImageView::CreateWidget(wxWindow* parent)
{
- ColorLayerImageViewPanel *clivp = new ColorLayerImageViewPanel(parent, 0, 100, bbGetInputOpacity() ,bbGetInputTypeControlsInterface() );
- bbSetOutputWidget( clivp );
+ ColorLayerImageViewPanel_widgetBox *clivp = new ColorLayerImageViewPanel_widgetBox(parent, 0, 100, bbGetInputOpacity() ,bbGetInputTypeControlsInterface() );
+ bbSetOutputWidget( (ColorLayerImageViewPanel*)clivp );
}
//=====
// Don't edit this file. This file is generated from xml description..
#include "bbtkWxBlackBox.h"
#include "wxVtkBaseView.h"
+#include <vtkScalarsToColors.h>
+
+#include <vtkScalarsToColors.h>
+
namespace bbcreaMaracasVisu
{
BBTK_DECLARE_INPUT(FittingMode,int);
BBTK_DECLARE_INPUT(ColorBarPosition,std::vector<int>);
BBTK_DECLARE_OUTPUT(NewImage,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(LookupTable,vtkScalarsToColors*);
+ BBTK_DECLARE_OUTPUT(OutOpacity,int);
BBTK_PROCESS(Process);
void Process();
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_INPUT(ColorLayerImageView,ColorBarPosition,"default (10,105)",std::vector<int>,"");
BBTK_OUTPUT(ColorLayerImageView,NewImage,"Image with correct Spacing",vtkImageData*,"");
-
+ BBTK_OUTPUT(ColorLayerImageView,LookupTable,"LookupTable",vtkScalarsToColors*,"");
+ BBTK_OUTPUT(ColorLayerImageView,OutOpacity,"Opacity",int,"");
BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView);
//=====
//=====
// 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)
//=====
-void ManualContourModel_Box::Process()
+
+
+void ManualContourModel_Box::ProcessBySegment(
+ int Type,
+ int &iGeneral, int sizeSegment,
+ std::vector<double> *lstInX,std::vector<double> *lstInY, std::vector<double> *lstInZ,
+ std::vector<double> *lstOutX,std::vector<double> *lstOutY, std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut, bool open )
+{
+ creaContoursFactory f;
+ manualContourModel *m;
+ int i,size=iGeneral+sizeSegment;
+ double x,y,z;
+ m = (manualContourModel*)f.getContourModel( bbGetInputType() );
+ m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
+ m->SetCloseContour( open );
+ for (i=iGeneral;i<size;i++)
+ {
+ m->AddPoint( (*lstInX)[i] , (*lstInY)[i] , (*lstInZ)[i] );
+ } // for
+ m->UpdateSpline();
+ int sizeContour = bbGetInputNbPoints();
+ for (i=0;i<sizeContour;i++)
+ {
+ m->GetSpline_i_Point(i,&x,&y,&z);
+ lstOutX->push_back(x);
+ lstOutY->push_back(y);
+ lstOutZ->push_back(z);
+ } // for
+ iGeneral=iGeneral+sizeSegment;
+ lstIndexsOut->push_back( sizeContour );
+ delete m;
+}
+
+
+void ManualContourModel_Box::RedistributionPoints( std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut )
+{
+ std::vector<double> lstRstX;
+ std::vector<double> lstRstY;
+ std::vector<double> lstRstZ;
+ int iLstIndexOut,sizeLstIndexOut = lstIndexsOut->size();
+ int ii, iGeneral=0;
+ int size;
+ for (iLstIndexOut=0; iLstIndexOut<sizeLstIndexOut; iLstIndexOut++)
+ {
+ lstRstX.clear();
+ lstRstY.clear();
+ lstRstZ.clear();
+ size=(*lstIndexsOut)[iLstIndexOut];
+ if (size>2)
+ {
+ double dist=0,dist2,distSeg,delta;
+ double dd,dx,dy,dz;
+ int i,k;
+ for ( i=iGeneral+1 ; i<iGeneral+size ; i++ )
+ {
+ dx = (*lstOutX)[i]-(*lstOutX)[i-1];
+ dy = (*lstOutY)[i]-(*lstOutY)[i-1];
+ dz = (*lstOutZ)[i]-(*lstOutZ)[i-1];
+ dist= dist+sqrt( dx*dx + dy*dy + dz*dz );
+ } //for
+ delta = dist/(size-1);
+ lstRstX.push_back( (*lstOutX)[iGeneral] );
+ lstRstY.push_back( (*lstOutY)[iGeneral] );
+ lstRstZ.push_back( (*lstOutZ)[iGeneral] );
+ for (i=iGeneral+1; i<iGeneral+size;i++)
+ {
+ dist2 = 0;
+ for (k=iGeneral+1; k<iGeneral+size;k++)
+ {
+ dx = (*lstOutX)[k]-(*lstOutX)[k-1];
+ dy = (*lstOutY)[k]-(*lstOutY)[k-1];
+ dz = (*lstOutZ)[k]-(*lstOutZ)[k-1];
+ distSeg = sqrt( dx*dx + dy*dy + dz*dz );
+ ii = i-iGeneral;
+ if ( dist2+distSeg >= ii*delta )
+ {
+ dd=(ii*delta-dist2)/distSeg;
+ if (distSeg==0)
+ {
+ dd = 0;
+ } // if distSeg == 0
+ lstRstX.push_back( (*lstOutX)[k-1] + dd*dx );
+ lstRstY.push_back( (*lstOutY)[k-1] + dd*dy );
+ lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz );
+ k=iGeneral+size;
+ } else {
+ if ( k==iGeneral+size-1 )
+ {
+ dd = 1;
+ lstRstX.push_back( (*lstOutX)[k-1] + dd*dx );
+ lstRstY.push_back( (*lstOutY)[k-1] + dd*dy );
+ lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz );
+ }
+ }// if dist2
+ dist2 = dist2+distSeg;
+ } // for k
+ } //for i
+ if (lstRstX.size()!=size)
+ {
+ printf("EED Warnning! ManualContourModel_Box::RedistributionPoints >> This list is not coherent iLstIndexOut=%d lstRstX.size()=%d size=%d\n",iLstIndexOut, lstRstX.size(), size);
+ }
+ for (i=iGeneral; i<iGeneral+size;i++)
+ {
+ ii=i-iGeneral;
+ (*lstOutX)[i] = lstRstX[ii];
+ (*lstOutY)[i] = lstRstY[ii];
+ (*lstOutZ)[i] = lstRstZ[ii];
+ } // for i
+ } // if size>2
+ iGeneral=iGeneral+size;
+ }// for iLstIndexOut
+}
+
+
+//-------------------------------------------------------------------------------------------------------------
+
+
+void ManualContourModel_Box::ExtractContour( std::vector<double> *lstX,
+ std::vector<double> *lstY,
+ std::vector<double> *lstZ,
+ std::vector<int> *lstIndexs,
+ int contour,
+ std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ )
+{
+ int i;
+// int iLstIndex;
+ int iContour;
+ int sizeLstIndexslstIndexs;
+ int iGeneral;
+ int iGeneralPlusSize;
+ if ( (lstX!=NULL) && (lstY!=NULL) && (lstZ!=NULL) && (lstIndexs!=NULL) && (lstOutX!=NULL) && (lstOutY!=NULL) && (lstOutZ!=NULL) )
+ {
+ sizeLstIndexslstIndexs = (*lstIndexs).size();
+ if ( sizeLstIndexslstIndexs!=0 )
+ {
+ (*lstOutX).clear();
+ (*lstOutY).clear();
+ (*lstOutZ).clear();
+ iGeneral = 0;
+ iGeneralPlusSize = (*lstIndexs)[0];
+ for ( iContour=1 ; iContour<=contour ; iContour++ )
+ {
+ iGeneral = iGeneral+(*lstIndexs)[iContour-1];
+ iGeneralPlusSize = iGeneral+(*lstIndexs)[iContour];
+ } // for iContour
+ for ( i=iGeneral ; i<iGeneralPlusSize ; i++ )
+ {
+ (*lstOutX).push_back( (*lstX)[i] );
+ (*lstOutY).push_back( (*lstY)[i] );
+ (*lstOutZ).push_back( (*lstZ)[i] );
+ } //for
+ } // size
+ } // NULL
+}
+
+void ManualContourModel_Box::PutPointsInContour(std::vector<double> *lstTmpX,
+ std::vector<double> *lstTmpY,
+ std::vector<double> *lstTmpZ,
+ int contour,
+ std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstOutIndexs )
+{
+ int i;
+// int iLstIndex;
+ int iContour;
+ int sizeLstIndexslstIndexs;
+ int iGeneral;
+ int iGeneralPlusSize;
+ int iSize;
+ int SizeContour;
+ if ( (lstTmpX!=NULL) && (lstTmpY!=NULL) && (lstTmpZ!=NULL) && (lstOutX!=NULL) && (lstOutY!=NULL) && (lstOutZ!=NULL) && (lstOutIndexs!=NULL) )
+ {
+ sizeLstIndexslstIndexs = (*lstOutIndexs).size();
+ if ( sizeLstIndexslstIndexs!=0 )
+ {
+ iGeneral = 0;
+ SizeContour = (*lstOutIndexs)[0];
+ iGeneralPlusSize = iGeneral + SizeContour;
+ for ( iContour=1 ; iContour<=contour ; iContour++ )
+ {
+ iGeneral = iGeneral + (*lstOutIndexs)[iContour-1];
+ SizeContour = (*lstOutIndexs)[iContour];
+ iGeneralPlusSize = iGeneral + SizeContour;
+ } // for iContour
+
+ if(SizeContour==(*lstTmpX).size() )
+ {
+ int iSize=0;
+ for ( i=iGeneral ; i<iGeneralPlusSize ; i++ )
+ {
+ (*lstOutX)[i] = (*lstTmpX)[iSize] ;
+ (*lstOutY)[i] = (*lstTmpY)[iSize] ;
+ (*lstOutZ)[i] = (*lstTmpZ)[iSize] ;
+ iSize++;
+ } //for
+ } else {
+ printf("EED Warnning!! ManualContourModel_Box::PutPointsInContour the lstTmp vector is not of the correct size. SizeContour=%d lstTmp.size=%d\n"
+ ,SizeContour, (*lstTmpX).size() );
+ for ( i=iGeneral ; i<iGeneralPlusSize ; i++ )
+ {
+ (*lstOutX)[i] = -9999 ;
+ (*lstOutY)[i] = -9999 ;
+ (*lstOutZ)[i] = -9999 ;
+ } //for
+ }
+ } // size
+ } // NULL
+}
+
+
+void ManualContourModel_Box::Redistribution_SIN( double alpha,
+ double beta,
+ std::vector<double> *lstC1X,
+ std::vector<double> *lstC1Y,
+ std::vector<double> *lstC1Z,
+ double sizeOfContour,
+ std::vector<double> *lstC2X,
+ std::vector<double> *lstC2Y,
+ std::vector<double> *lstC2Z )
+{
+ std::vector<double> lstRstX;
+ std::vector<double> lstRstY;
+ std::vector<double> lstRstZ;
+ int ii,iGeneral;
+ int size,iGeneralPlusSize;
+ int iGeneralPlusSizeMoisUn;
+ int iGeneralPlusSizeMoisDeux;
+ int i,k;
+ int firstK;
+ double iiByDelta;
+ double dist2,distSeg;
+ double dd,dx,dy,dz;
+ double t,tt, PI;
+ double TwoPI;
+ double dist;
+ dist = sizeOfContour;
+ PI = 3.14159265;
+ TwoPI = 2*PI;
+ iGeneral = 0;
+ size = (*lstC1X).size();
+ iGeneralPlusSize = iGeneral+size;
+ iGeneralPlusSizeMoisUn = iGeneralPlusSize-1;
+ iGeneralPlusSizeMoisDeux = iGeneralPlusSize-2;
+ if (size>2)
+ {
+ firstK = 0;
+ for (i=iGeneral; i<iGeneralPlusSize;i++) // For each point of one contour
+ {
+ ii = i-iGeneral;
+ dist2 = 0;
+
+ t = ((double)ii) / ((double)(size-1));
+ tt = t + 0.70710678182*sin(t*TwoPI)*beta + alpha;
+ if (tt>1) { tt=tt-1; }
+ if (tt<0) { tt=tt+1; }
+ iiByDelta = tt * dist;
+
+ for ( k=iGeneral ; k<iGeneralPlusSizeMoisUn ; k++ ) // Search inside
+ {
+ dx = (*lstC1X)[k+1]-(*lstC1X)[k];
+ dy = (*lstC1Y)[k+1]-(*lstC1Y)[k];
+ dz = (*lstC1Z)[k+1]-(*lstC1Z)[k];
+ distSeg = sqrt( dx*dx + dy*dy + dz*dz );
+ if ( dist2+distSeg >= iiByDelta )
+ {
+ if (distSeg==0)
+ {
+ dd = 0;
+ } else {
+ dd=(iiByDelta-dist2)/distSeg;
+ }// if distSeg == 0
+ lstRstX.push_back( (*lstC1X)[k] + dd*dx );
+ lstRstY.push_back( (*lstC1Y)[k] + dd*dy );
+ lstRstZ.push_back( (*lstC1Z)[k] + dd*dz );
+ if (ii==0) { firstK=k; }
+ k = iGeneralPlusSize-1;
+ } else {
+ if ( k==iGeneralPlusSizeMoisDeux )
+ {
+ dd = 1;
+ lstRstX.push_back( (*lstC1X)[k] + dd*dx );
+ lstRstY.push_back( (*lstC1Y)[k] + dd*dy );
+ lstRstZ.push_back( (*lstC1Z)[k] + dd*dz );
+ } // if k
+ }// if dist2
+ dist2 = dist2 + distSeg;
+ } // for k
+ } //for i
+ if (lstRstX.size()!=size)
+ {
+ printf("EED Warnning! ManualContourModel_Box::Redistribution_SIN >> This list is not coherent lstRstX.size()=%d size=%d\n", lstRstX.size(), size);
+ }
+ (*lstC2X).clear();
+ (*lstC2Y).clear();
+ (*lstC2Z).clear();
+ for (i=iGeneral; i<iGeneralPlusSize;i++)
+ {
+ (*lstC2X).push_back(-1);
+ (*lstC2Y).push_back(-1);
+ (*lstC2Z).push_back(-1);
+ } // for i
+ int iii;
+ for (i=iGeneral; i<iGeneralPlusSize;i++)
+ {
+ ii = i-iGeneral;
+ iii = iGeneral+ ( (i-iGeneral) + firstK) % size ;
+ (*lstC2X)[iii] = lstRstX[ii];
+ (*lstC2Y)[iii] = lstRstY[ii];
+ (*lstC2Z)[iii] = lstRstZ[ii];
+ } // for i
+ (*lstC2X)[iGeneralPlusSize-1]=(*lstC2X)[iGeneral];
+ (*lstC2Y)[iGeneralPlusSize-1]=(*lstC2Y)[iGeneral];
+ (*lstC2Z)[iGeneralPlusSize-1]=(*lstC2Z)[iGeneral];
+ } else {
+ for (i=0; i<size ; i++)
+ {
+ (*lstC2X)[i] = (*lstC1X)[i];
+ (*lstC2Y)[i] = (*lstC1Y)[i];
+ (*lstC2Z)[i] = (*lstC1Z)[i];
+ } // for i
+ }// if size>2
+}
+
+void ManualContourModel_Box::CopyContour2InContour1(
+ std::vector<double> *lstInX,
+ std::vector<double> *lstInY,
+ std::vector<double> *lstInZ,
+ std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ )
+{
+ int i,sizeLstInX=(*lstInX).size();
+ (*lstOutX).clear();
+ (*lstOutY).clear();
+ (*lstOutZ).clear();
+ for ( i=0 ; i<sizeLstInX ; i++ )
+ {
+ (*lstOutX).push_back( (*lstInX)[i] );
+ (*lstOutY).push_back( (*lstInY)[i] );
+ (*lstOutZ).push_back( (*lstInZ)[i] );
+ } // for i
+}
+
+double ManualContourModel_Box::IntegralDistanceTwoContours(std::vector<double> *lstTmpAX,
+ std::vector<double> *lstTmpAY,
+ std::vector<double> *lstTmpAZ,
+ std::vector<double> *lstTmpBX,
+ std::vector<double> *lstTmpBY,
+ std::vector<double> *lstTmpBZ )
+{
+ int i;
+ double dx;
+ double dy;
+ double dz;
+ double dist = 0;
+ int iSize = (*lstTmpAX).size();
+ for ( i=0 ; i<iSize ; i++ )
+ {
+ dx = (*lstTmpAX)[i]-(*lstTmpBX)[i];
+ dy = (*lstTmpAY)[i]-(*lstTmpBY)[i];
+ dz = (*lstTmpAZ)[i]-(*lstTmpBZ)[i];
+// dist = dist + sqrt( dx*dx + dy*dy + dz*dz );
+ dist = dist + (dx*dx + dy*dy + dz*dz) ;
+ } //for i
+ return dist;
+}
+
+void ManualContourModel_Box::findAlphaBetaSinDistribution( std::vector<double> *ptrLstTmp2X,
+ std::vector<double> *ptrLstTmp2Y,
+ std::vector<double> *ptrLstTmp2Z ,
+ int sizeContour,
+ std::vector<double> *ptrLstTmp1X,
+ std::vector<double> *ptrLstTmp1Y,
+ std::vector<double> *ptrLstTmp1Z,
+ double *alphaOut,
+ double *betaOut)
+{
+ std::vector<double> lstTmp2aX;
+ std::vector<double> lstTmp2aY;
+ std::vector<double> lstTmp2aZ;
+ double alpha,iAlpha,deltaAlpha;
+ double beta,iBeta,deltaBeta;
+ double distAcum;
+ double minDistAcum;
+ deltaAlpha = 0.1 / 2;
+ deltaBeta = 0.01 / 2;
+ beta = 0.05;
+ alpha = 0;
+ minDistAcum = 999999999999;
+ for (iAlpha=0 ; iAlpha<1; iAlpha=iAlpha+deltaAlpha )
+ {
+ Redistribution_SIN( iAlpha,beta, ptrLstTmp2X,ptrLstTmp2Y,ptrLstTmp2Z ,sizeContour, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ distAcum = IntegralDistanceTwoContours( ptrLstTmp1X,ptrLstTmp1Y,ptrLstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ if (distAcum<minDistAcum)
+ {
+ alpha = iAlpha;
+ minDistAcum = distAcum;
+ } // if integerDist
+ } // for alpha
+// find Beta
+ minDistAcum = 999999999999;
+ for (iBeta=0.0 ; iBeta<0.2; iBeta=iBeta+deltaBeta)
+ {
+ Redistribution_SIN( alpha,iBeta, ptrLstTmp2X,ptrLstTmp2Y,ptrLstTmp2Z ,sizeContour, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ distAcum = IntegralDistanceTwoContours( ptrLstTmp1X,ptrLstTmp1Y,ptrLstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ if (distAcum<minDistAcum)
+ {
+ beta = iBeta;
+ minDistAcum = distAcum;
+ } // if integerDist
+ } // for iBeta
+ *alphaOut = alpha;
+ *betaOut = beta;
+}
+
+
+
+double ManualContourModel_Box::SizeContour( std::vector<double> *lstX,
+ std::vector<double> *lstY,
+ std::vector<double> *lstZ)
+{
+ int i;
+ double dx;
+ double dy;
+ double dz;
+ double dist = 0;
+ int iSize = (*lstX).size() - 1;
+ for ( i=0 ; i<iSize ; i++ )
+ {
+ dx = (*lstX)[i+1]-(*lstX)[i];
+ dy = (*lstY)[i+1]-(*lstY)[i];
+ dz = (*lstZ)[i+1]-(*lstZ)[i];
+ dist= dist+sqrt( dx*dx + dy*dy + dz*dz );
+ } //for i
+ return dist;
+}
+
+
+
+void ManualContourModel_Box::CalculeLstSizeContours( std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut,
+ std::vector<double> *lstSizeContours )
{
+ int i;
+// int iLstIndex;
+ int iContour;
+ int sizeLstIndexs;
+ int iGeneral;
+ int iGeneralPlusSize;
+ double dx,dy,dz;
+ double dist;
+ (*lstSizeContours).clear();
+ if ( (lstOutX!=NULL) && (lstOutY!=NULL) && (lstOutZ!=NULL) && (lstIndexsOut!=NULL) )
+ {
+ sizeLstIndexs = (*lstIndexsOut).size();
+ if ( sizeLstIndexs!=0 )
+ {
+ iGeneral = 0;
+ for ( iContour=0 ; iContour<sizeLstIndexs ; iContour++ )
+ {
+ dist = 0;
+ iGeneralPlusSize = iGeneral + (*lstIndexsOut)[iContour];
+ for ( i=iGeneral+1 ; i<iGeneralPlusSize ; i++ )
+ {
+ dx = (*lstOutX)[i]-(*lstOutX)[i-1] ;
+ dy = (*lstOutY)[i]-(*lstOutY)[i-1] ;
+ dz = (*lstOutZ)[i]-(*lstOutZ)[i-1] ;
+ dist= dist + sqrt( dx*dx +dy*dy + dz*dz );
+ } // for iGeneral
+ (*lstSizeContours).push_back( dist );
+ iGeneral = iGeneralPlusSize;
+ } // for iContour
+ } // sizeLstIndexs
+ } // if lst NULL
+}
+
+void ManualContourModel_Box::RedistributionPointsAllContours_SIN( std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut )
+{
+ std::vector<double> lstTmp1X;
+ std::vector<double> lstTmp1Y;
+ std::vector<double> lstTmp1Z;
+ std::vector<double> lstTmp2X;
+ std::vector<double> lstTmp2Y;
+ std::vector<double> lstTmp2Z;
+ std::vector<double> lstTmp2aX;
+ std::vector<double> lstTmp2aY;
+ std::vector<double> lstTmp2aZ;
+ std::vector<double> lstTmp3X;
+ std::vector<double> lstTmp3Y;
+ std::vector<double> lstTmp3Z;
+ std::vector<int> lstContourExeption;
+ std::vector<double> lstSizeContours;
+ int iContour;
+ double nbContours = (*lstIndexsOut).size();
+ double alpha,beta;
+ double sizeContour1;
+ double sizeContour2;
+ double sizeContour3;
+
+ CalculeLstSizeContours(lstOutX,lstOutY,lstOutZ,lstIndexsOut, &lstSizeContours);
+
+// ------------ Wave 1 Back to Fordward (redistribution for the little one)-----------------
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut,0,&lstTmp1X,&lstTmp1Y,&lstTmp1Z);
+// sizeContour1 = SizeContour( &lstTmp1X, &lstTmp1Y, &lstTmp1Z );
+ sizeContour1 = lstSizeContours[0];
+
+// Increment
+ for ( iContour=0; iContour<nbContours-1 ; iContour++ ) // Back to Fordward
+ {
+ ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour+1 ,&lstTmp2X,&lstTmp2Y,&lstTmp2Z );
+// sizeContour2 = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
+ sizeContour2 = lstSizeContours[ iContour+1 ];
+
+ if (iContour+2<nbContours)
+ {
+// ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour+2 ,&lstTmp3X,&lstTmp3Y,&lstTmp3Z );
+// sizeContour3 = SizeContour( &lstTmp3X, &lstTmp3Y, &lstTmp3Z );
+ sizeContour3 = lstSizeContours[ iContour+2 ];
+ } else {
+ sizeContour3=-1;
+ }
+ if ( (sizeContour1>=sizeContour2) && (sizeContour2>sizeContour3) )
+ {
+ findAlphaBetaSinDistribution( &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp1X,&lstTmp1Y,&lstTmp1Z, &alpha,&beta);
+ Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ sizeContour2 = SizeContour( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ lstSizeContours[ iContour+1 ] = sizeContour2;
+ PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ, iContour+1 ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);
+ CopyContour2InContour1( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
+ } else {
+ if ( (sizeContour3!=-1) && (sizeContour1<sizeContour2) && (sizeContour2>sizeContour3) ) // Warning for a maximum local
+ {
+ lstInconsistentContourY.push_back( lstTmp2Y[0] );
+ lstInconsistentContourID.push_back( iContour+1 );
+ } // if maximum local
+ CopyContour2InContour1( &lstTmp2aX,&lstTmp2Y,&lstTmp2Z , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
+ } //if sizeContour1>sizeContour2>sizeContour3
+ sizeContour1 = sizeContour2;
+ } // for iContour
+
+
+// ------------ Wave 2 fordward to back (redistribute the litle one)-----------------
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut,nbContours-1,&lstTmp1X,&lstTmp1Y,&lstTmp1Z);
+// sizeContour1 = SizeContour( &lstTmp1X, &lstTmp1Y, &lstTmp1Z );
+ sizeContour1 = lstSizeContours[ nbContours-1 ];
+
+// Increment
+ for ( iContour=nbContours-1; iContour>0 ; iContour-- ) // Fordward to Back
+ {
+ ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-1 ,&lstTmp2X,&lstTmp2Y,&lstTmp2Z );
+// sizeContour2 = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
+ sizeContour2 = lstSizeContours[ iContour-1 ];
+ if (iContour-2>=0)
+ {
+// ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-2 ,&lstTmp3X,&lstTmp3Y,&lstTmp3Z );
+// sizeContour3 = SizeContour( &lstTmp3X, &lstTmp3Y, &lstTmp3Z );
+ sizeContour3 = lstSizeContours[ iContour-2 ];
+ } else {
+ sizeContour3=-1;
+ }
+ if ( (sizeContour1>sizeContour2) && (sizeContour2>sizeContour3) )
+ {
+ findAlphaBetaSinDistribution( &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp1X,&lstTmp1Y,&lstTmp1Z, &alpha,&beta);
+ Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ sizeContour2 = SizeContour( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ lstSizeContours[ iContour-1 ] = sizeContour2;
+ PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ, iContour-1 ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);
+ CopyContour2InContour1( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
+ } else {
+ if ( (sizeContour1>sizeContour2) && (sizeContour2<sizeContour3) ) // Warning for a minim local
+ {
+ lstContourExeption.push_back( iContour-1 );
+ } // if minimum local
+ if ( (sizeContour3!=-1) && (sizeContour1<sizeContour2) && (sizeContour2>sizeContour3) ) // Warning for a maximum local
+ {
+ lstInconsistentContourY.push_back( lstTmp2Y[0] );
+ lstInconsistentContourID.push_back( iContour-1 );
+ } // if Maximum local
+ CopyContour2InContour1( &lstTmp2X,&lstTmp2Y,&lstTmp2Z , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
+ } //if sizeContour1>sizeContour2>sizeContour3
+ sizeContour1 = sizeContour2;
+ } // for iContour
+
+// ------------ Wave 3 redistribution for the minimun detected in Wave 1 -----------------
+ double alpha1,alpha2;
+ double beta1,beta2;
+ double iExtra,sizeExtra=lstContourExeption.size();
+ for ( iExtra=0 ; iExtra<sizeExtra ; iExtra++ )
+ {
+ iContour = lstContourExeption[iExtra];
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-1 , &lstTmp1X,&lstTmp1Y,&lstTmp1Z);
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour , &lstTmp2X,&lstTmp2Y,&lstTmp2Z);
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour+1 , &lstTmp3X,&lstTmp3Y,&lstTmp3Z);
+// sizeContour2 = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
+ sizeContour2 = lstSizeContours[ iContour ];
+ printf("EED Warnning! ManualContourModel_Box::RedistributionPointsAllContours_SIN wave3 posible inconsistent contour y=%f iContour=%d\n", lstTmp2Y[0], iContour );
+ lstInconsistentContourY.push_back( lstTmp2Y[0] );
+ lstInconsistentContourID.push_back( iContour );
+ findAlphaBetaSinDistribution( &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp1X,&lstTmp1Y,&lstTmp1Z, &alpha1,&beta1);
+ findAlphaBetaSinDistribution( &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp3X,&lstTmp3Y,&lstTmp3Z, &alpha2,&beta2);
+ if (beta2>beta1)
+ {
+ alpha = alpha2;
+ } else {
+ alpha = alpha1;
+ }
+ beta = ( beta1 + beta2 ) / 2;
+ Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ sizeContour2 = SizeContour( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ lstSizeContours[ iContour ] = sizeContour2;
+ PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ, iContour ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);
+ } // for iExtra
+
+
+}
+
+void ManualContourModel_Box::ClockwisePoints( std::vector<double> *lstInX,
+ std::vector<double> *lstInY,
+ std::vector<double> *lstInZ,
+ std::vector<int> *lstIndexsIn )
+{
+ int iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
+ int i,iGeneral=0;
+ int size,size2;
+ double cx,cy,cz;
+ double px,py,pz;
+ double backpx,backpy,backpz;
+ double ang;
+ char dir=-1;
+ bool dirx,diry,dirz;
+ int flagAng=0;
+ float backang;
+ double tmp;
+
+ // For each contour
+ for (iLstIndexIn=0; iLstIndexIn<sizeLstIndexIn; iLstIndexIn++)
+ {
+ // Step 1. Find gravity center and direction
+ size = (*lstIndexsIn)[iLstIndexIn];
+ if (size>2) // for contour with more than 2 points
+ {
+ cx = 0;
+ cy = 0;
+ cz = 0;
+ dirx = true;
+ diry = true;
+ dirz = true;
+ for ( i=0 ; i<size ; i++ )
+ {
+ px=(*lstInX)[iGeneral+i];
+ py=(*lstInY)[iGeneral+i];
+ pz=(*lstInZ)[iGeneral+i];
+ cx = px + cx;
+ cy = py + cy;
+ cz = pz + cz;
+ if (i!=0)
+ {
+ if (backpx!=px) { dirx=false; }
+ if (backpy!=py) { diry=false; }
+ if (backpz!=pz) { dirz=false; }
+ backpx=px;
+ backpy=py;
+ backpz=pz;
+ } // if i!=0
+ backpx=px;
+ backpy=py;
+ backpz=pz;
+ } // for i
+ cx=cx/size;
+ cy=cy/size;
+ cz=cz/size;
+ if (dirx==true) { dir=1; } // YZ
+ if (diry==true) { dir=2; } // XZ
+ if (dirz==true) { dir=0; } // XZ
+ // Step 2. Find angle diference find
+ flagAng=0;
+ for ( i=0 ; i<size ; i++ )
+ {
+ px = (*lstInX)[iGeneral+i]-cx;
+ py = (*lstInY)[iGeneral+i]-cy;
+ pz = (*lstInZ)[iGeneral+i]-cz;
+ if (dir==0) { ang=atan2( py , px ); } // XY
+ if (dir==1) { ang=atan2( pz , py ); } // YZ
+ if (dir==2) { ang=atan2( pz , px ); } // XZ
+ if (i>0)
+ {
+ if (backang<ang)
+ {
+ flagAng++;
+ } else {
+ flagAng--;
+ }// if backang<ang
+ } // if i
+ backang=ang;
+ } // for i
+
+
+ // Step 3. Invert order of points
+ if (flagAng<0)
+ {
+ size2 = size/2;
+ for ( i=0 ; i<size2 ; i++ )
+ {
+ tmp = (*lstInX)[iGeneral+i];
+ (*lstInX)[iGeneral+i] = (*lstInX)[iGeneral+size-1-i];
+ (*lstInX)[iGeneral+size-1-i] = tmp;
+ tmp = (*lstInY)[iGeneral+i];
+ (*lstInY)[iGeneral+i] = (*lstInY)[iGeneral+size-1-i];
+ (*lstInY)[iGeneral+size-1-i] = tmp;
+ tmp = (*lstInZ)[iGeneral+i];
+ (*lstInZ)[iGeneral+i] = (*lstInZ)[iGeneral+size-1-i];
+ (*lstInZ)[iGeneral+size-1-i] = tmp;
+ } // for i
+ } // flagAng
+ } // size>2
+ iGeneral = iGeneral+size;
+ } // for iLstIndexIn
+}
+
+
+void ManualContourModel_Box::ShiftValues( std::vector<double> *lstInX,
+ std::vector<double> *lstInY,
+ std::vector<double> *lstInZ,
+ std::vector<int> *lstIndexsIn )
+{
+ int iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
+ int ii, iGeneral=0;
+ int size,size2;
+ double dist,distMin;
+ int i,iBack;
+ int ig;
+ double dx,dy,dz;
+ std::vector<double> LstTmpX;
+ std::vector<double> LstTmpY;
+ std::vector<double> LstTmpZ;
+ if (sizeLstIndexIn>=2)
+ {
+ for (iLstIndexIn=0; iLstIndexIn<sizeLstIndexIn-1; iLstIndexIn++)
+ {
+ size = (*lstIndexsIn)[iLstIndexIn];
+ size2 = (*lstIndexsIn)[iLstIndexIn+1];
+ //find min distance and iBack
+ distMin = 10000000;
+ iBack = 0;
+ // Comparing distance between two contours
+ // Both contours need the same size
+ for (ig=0; ig<size; ig++)
+ {
+ dist=0;
+ for ( i=0 ; i<size2 ; i++ )
+ {
+ dx = (*lstInX)[iGeneral+i]-(*lstInX)[iGeneral+size+(i+ig)%size];
+ dy = (*lstInY)[iGeneral+i]-(*lstInY)[iGeneral+size+(i+ig)%size];
+ dz = (*lstInZ)[iGeneral+i]-(*lstInZ)[iGeneral+size+(i+ig)%size];
+ dist= dist + sqrt( dx*dx + dy*dy + dz*dz );
+ } // for i size2
+ if ( dist<distMin )
+ {
+ iBack = ig+size;
+ distMin = dist;
+ }
+ } // for ig size
+ if (iBack!=0)
+ {
+ LstTmpX.clear();
+ LstTmpY.clear();
+ LstTmpZ.clear();
+ for (i=0 ; i<size2 ; i++)
+ {
+ ii = (i+iBack)%size2;
+ if (ii<(size2-1)) // Skip the last item
+ {
+ LstTmpX.push_back( (*lstInX)[iGeneral+size+ii] );
+ LstTmpY.push_back( (*lstInY)[iGeneral+size+ii] );
+ LstTmpZ.push_back( (*lstInZ)[iGeneral+size+ii] );
+ }
+ } // for i
+ //Repeat the first item at the end to close the contour
+ LstTmpX.push_back( LstTmpX[0] );
+ LstTmpY.push_back( LstTmpY[0] );
+ LstTmpZ.push_back( LstTmpZ[0] );
+ for (i=0 ; i<size2 ; i++)
+ {
+ (*lstInX)[iGeneral+size+i] = LstTmpX[i];
+ (*lstInY)[iGeneral+size+i] = LstTmpY[i];
+ (*lstInZ)[iGeneral+size+i] = LstTmpZ[i];
+ } // for i
+ }
+ iGeneral=iGeneral+size;
+ } // for iLstIndexIn
+ } // if sizeLstIndexIn
+}
+
+
+
+void ManualContourModel_Box::Process()
+{
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
- creaContoursFactory f;
- manualContourModel *m;
- std::vector<double> lstX;
- std::vector<double> lstY;
- std::vector<double> lstZ;
- int i,size;
- double x,y,z;
- m = (manualContourModel*)f.getContourModel( bbGetInputType() );
- m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
- m->SetCloseContour( bbGetInputOpenClose() );
- size = bbGetInputLstControlPointsX().size();
- for (i=0;i<size;i++)
- {
-// m->InsertPoint( bbGetInputLstControlPointsX()[i] , bbGetInputLstControlPointsY()[i] , bbGetInputLstControlPointsZ()[i] );
- m->AddPoint( bbGetInputLstControlPointsX()[i] , bbGetInputLstControlPointsY()[i] , bbGetInputLstControlPointsZ()[i] );
- } // for
- m->UpdateSpline();
- size = bbGetInputNbPoints();
- for (i=0;i<size;i++)
+ if (bbGetInputActive()==true)
{
- m->GetSpline_i_Point(i,&x,&y,&z);
- lstX.push_back(x);
- lstY.push_back(y);
- lstZ.push_back(z);
- } // for
- bbSetOutputLstContourPointsX(lstX);
- bbSetOutputLstContourPointsY(lstY);
- bbSetOutputLstContourPointsZ(lstZ);
+ lstInconsistentContourY.clear();
+ lstInconsistentContourID.clear();
- delete m;
+ // First Step Spline Interpolation
+ std::vector<double> lstInX=bbGetInputLstControlPointsX();
+ std::vector<double> lstInY=bbGetInputLstControlPointsY();
+ std::vector<double> lstInZ=bbGetInputLstControlPointsZ();
+ if ( (lstInX.size()!=lstInY.size()) || (lstInY.size()!=lstInZ.size()) )
+ {
+ printf("Warnning !! .. ManualContourModel_Box: The list X Y Z, no have the same number of elements \n");
+ return;
+ }
+ std::vector<int> lstIndexsIn=bbGetInputLstIndexsIn();
+ std::vector<int> lstIndexsOut;
+ std::vector<double> lstOutX;
+ std::vector<double> lstOutY;
+ std::vector<double> lstOutZ;
+ if (bbGetInputLstIndexsIn().size()==0)
+ {
+ lstIndexsIn.push_back( lstInX.size() );
+ }
+
+ // Step 1. All contours the same clockwise direction (Control Points)
+ if (bbGetInputDoubleContour()==1)
+ {
+ ClockwisePoints( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
+ // ShiftValues( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
+ } // DoubleContour
+ int i,size = lstIndexsIn.size();
+ int iGeneral= 0;
+
+ // Step 2. Spline interpolation of control points
+ for (i=0;i<size;i++)
+ {
+ ProcessBySegment( bbGetInputType() ,
+ iGeneral, lstIndexsIn[i] ,
+ &lstInX , &lstInY , &lstInZ,
+ &lstOutX , &lstOutY , &lstOutZ,
+ &lstIndexsOut,bbGetInputOpenClose() );
+ } // for
+ if (bbGetInputDoubleContour()==0)
+ {
+ // Finish if Simple contours
+ //////////////////// Set Out DoubleContour = 0
+ bbSetOutputLstContourPointsX(lstOutX);
+ bbSetOutputLstContourPointsY(lstOutY);
+ bbSetOutputLstContourPointsZ(lstOutZ);
+ bbSetOutputLstIndexsOut(lstIndexsOut);
+ } else {
+ // Step 3. Interpolation in the other direction
+ // Step 3.1 Linear Normalice points around contours
+ RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
+ //EED 01/2021
+ // Step 3.2 Shift points to find minimun acumulate distance
+ ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
+ // Step 3.3. SIN Normalice points around contours
+ if (bbGetInputParam().size()>=1)
+ {
+ if (bbGetInputParam()[0]==1)
+ {
+ RedistributionPointsAllContours_SIN( &lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
+ ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
+ } // if 1
+ } // if size
+ // Step 3.4 Transpose the vectors
+ lstInX.clear();
+ lstInY.clear();
+ lstInZ.clear();
+ lstIndexsIn.clear();
+ size = bbGetInputNbPoints();
+ int j,size2 = lstIndexsOut.size();
+ for (i=0;i<size;i++)
+ {
+ for (j=0;j<size2;j++)
+ {
+ lstInX.push_back( lstOutX[ j*lstIndexsOut[j] + i ] );
+ lstInY.push_back( lstOutY[ j*lstIndexsOut[j] + i ] );
+ lstInZ.push_back( lstOutZ[ j*lstIndexsOut[j] + i ] );
+ } // for j
+ lstIndexsIn.push_back( size2 );
+ } // for i
+ lstOutX.clear();
+ lstOutY.clear();
+ lstOutZ.clear();
+ lstIndexsOut.clear();
+ // Step 3.5 Interponation 2
+ size=lstIndexsIn.size();
+ iGeneral=0;
+ for (i=0;i<size;i++)
+ {
+ ProcessBySegment( bbGetInputType() ,
+ iGeneral, lstIndexsIn[i] ,
+ &lstInX,&lstInY,&lstInZ,
+ &lstOutX,&lstOutY,&lstOutZ,
+ &lstIndexsOut,bbGetInputOpenClose2());
+ } // for
+ RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
+ // Step 3.6 Transpose the vectors
+ lstInX.clear();
+ lstInY.clear();
+ lstInZ.clear();
+ lstIndexsIn.clear();
+ size = bbGetInputNbPoints();
+ size2 = lstIndexsOut.size();
+ for (i=0;i<size;i++)
+ {
+ for (j=0;j<size2;j++)
+ {
+ lstInX.push_back( lstOutX[ j*lstIndexsOut[j] + i ] );
+ lstInY.push_back( lstOutY[ j*lstIndexsOut[j] + i ] );
+ lstInZ.push_back( lstOutZ[ j*lstIndexsOut[j] + i ] );
+ } // for j
+ lstIndexsIn.push_back( size2 );
+ } // for i
+ lstOutX.clear();
+ lstOutY.clear();
+ lstOutZ.clear();
+ lstIndexsOut.clear();
+ //////////////////// Set Out DoubleContour = 1
+ bbSetOutputLstContourPointsX( lstInX );
+ bbSetOutputLstContourPointsY( lstInY );
+ bbSetOutputLstContourPointsZ( lstInZ );
+ bbSetOutputLstIndexsOut( lstIndexsIn );
+ bbSetOutputLstPssblIncnsnstntCntrY( lstInconsistentContourY );
+ bbSetOutputLstPssblIncnsnstntCntrID( lstInconsistentContourID );
+ } // if DoubleContour
+ } // 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)
//=====
void ManualContourModel_Box::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
- bbSetInputType(1);
+ bbSetInputActive(true);
+ bbSetInputType(1);
+ bbSetInputDoubleContour(0);
bbSetInputOpenClose(false);
- bbSetInputNbPoints(100);
-
+ bbSetInputOpenClose2(false);
+ bbSetInputNbPoints(100);
}
//=====
// 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)
//=====
void ManualContourModel_Box::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
// if any
-
-
}
//=====
// 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)
//=====
void ManualContourModel_Box::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
-// if any
-
-}
+// if any
}
-// EO namespace bbcreaMaracasVisu
+} // EO namespace bbcreaMaracasVisu
//=====
// 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(Type,int);
+ BBTK_DECLARE_INPUT(DoubleContour,int);
BBTK_DECLARE_INPUT(OpenClose,bool);
+ BBTK_DECLARE_INPUT(OpenClose2,bool);
BBTK_DECLARE_INPUT(NbPoints,int);
+ BBTK_DECLARE_INPUT(LstIndexsIn,std::vector<int>);
BBTK_DECLARE_INPUT(LstControlPointsX,std::vector<double>);
BBTK_DECLARE_INPUT(LstControlPointsY,std::vector<double>);
BBTK_DECLARE_INPUT(LstControlPointsZ,std::vector<double>);
+ BBTK_DECLARE_INPUT(Param,std::vector<double>);
+
+
BBTK_DECLARE_OUTPUT(LstContourPointsX,std::vector<double>);
BBTK_DECLARE_OUTPUT(LstContourPointsY,std::vector<double>);
BBTK_DECLARE_OUTPUT(LstContourPointsZ,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(LstIndexsOut,std::vector<int>);
+ BBTK_DECLARE_OUTPUT(LstPssblIncnsnstntCntrY,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(LstPssblIncnsnstntCntrID,std::vector<int>);
+
BBTK_PROCESS(Process);
void Process();
+
+
+void ClockwisePoints( std::vector<double> *lstInX,
+ std::vector<double> *lstInY,
+ std::vector<double> *lstOuZ,
+ std::vector<int> *lstIndexsIn );
+
+void ShiftValues( std::vector<double> *lstInX,
+ std::vector<double> *lstInY,
+ std::vector<double> *lstOuZ,
+ std::vector<int> *lstIndexsIn );
+
+
+ void ProcessBySegment(
+ int Type,
+ int &iGeneral, int sizeSegment,
+ std::vector<double> *lstInX,std::vector<double> *lstInY, std::vector<double> *lstInZ,
+ std::vector<double> *lstOutX,std::vector<double> *lstOutY, std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut,
+ bool open );
+
+
+// Linear Distribution
+void RedistributionPoints( std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut );
+
+
+
+// sin distribution
+void RedistributionPoints_SIN_iContour(int iContour,
+ std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut,double alpha,double beta );
+// find best sin distribution
+void RedistributionPointsAllContours_SIN( std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut );
+
+void findAlphaBetaSinDistribution( std::vector<double> *lstTmp2X,
+ std::vector<double> *lstTmp2Y,
+ std::vector<double> *lstTmp2Z ,
+ int sizeContour,
+ std::vector<double> *lstTmp1X,
+ std::vector<double> *lstTmp1Y,
+ std::vector<double> *lstTmp1Z,
+ double *alpha,
+ double *beta);
+
+void Redistribution_SIN( double alpha,
+ double beta,
+ std::vector<double> *lstC1X,
+ std::vector<double> *lstC1Y,
+ std::vector<double> *lstC1Z,
+ double sizeOfContour,
+ std::vector<double> *lstC2X,
+ std::vector<double> *lstC2Y,
+ std::vector<double> *lstC2Z );
+
+double SizeContour( std::vector<double> *lstX,
+ std::vector<double> *lstY,
+ std::vector<double> *lstZ );
+
+void CalculeLstSizeContours( std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut,
+ std::vector<double> *lstSizeContours );
+
+
+void ExtractContour(std::vector<double> *lstX,
+ std::vector<double> *lstY,
+ std::vector<double> *lstZ,
+ std::vector<int> *lstIndexs,
+ int contour,
+ std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ );
+
+void PutPointsInContour( std::vector<double> *lstTmpX,
+ std::vector<double> *lstTmpY,
+ std::vector<double> *lstTmpZ,
+ int iContour,
+ std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ,
+ std::vector<int> *lstOutIndexs );
+
+double IntegralDistanceTwoContours( std::vector<double> *lstTmpAX,
+ std::vector<double> *lstTmpAY,
+ std::vector<double> *lstTmpAZ,
+ std::vector<double> *lstTmpBX,
+ std::vector<double> *lstTmpBY,
+ std::vector<double> *lstTmpBZ );
+
+void CopyContour2InContour1( std::vector<double> *lstInX,
+ std::vector<double> *lstInY,
+ std::vector<double> *lstInZ,
+ std::vector<double> *lstOutX,
+ std::vector<double> *lstOutY,
+ std::vector<double> *lstOutZ );
+
+std::vector<double> lstInconsistentContourY;
+std::vector<int> lstInconsistentContourID;
+
//=====
// 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_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
+ BBTK_INPUT(ManualContourModel_Box,Active,"(true default) Active true/false",bool,"");
BBTK_INPUT(ManualContourModel_Box,Type,"(1 default) 1=spline, 2=rectangle, 3=circle, 4=bullEye, 6=Line, 7=points, 8=rotationTool, 10=polygon, 12=Spline3D",int,"");
+ BBTK_INPUT(ManualContourModel_Box,DoubleContour,"(0 default) 0=Simple, 1=Double (This is used to construct surface, use LstIndexesIn)",int,"");
BBTK_INPUT(ManualContourModel_Box,OpenClose,"(false default) false=open, true=close",bool,"");
+ BBTK_INPUT(ManualContourModel_Box,OpenClose2,"(false default) false=open, true=close. Used with the DoubleContour option.",bool,"");
BBTK_INPUT(ManualContourModel_Box,NbPoints,"(100 default) Number of points int the spline",int,"");
+ BBTK_INPUT(ManualContourModel_Box,LstIndexsIn,"Lst number of points by segment",std::vector<int>,"");
BBTK_INPUT(ManualContourModel_Box,LstControlPointsX,"List of control points",std::vector<double>,"");
BBTK_INPUT(ManualContourModel_Box,LstControlPointsY,"List of control points",std::vector<double>,"");
BBTK_INPUT(ManualContourModel_Box,LstControlPointsZ,"List of control points",std::vector<double>,"");
-
+ BBTK_INPUT(ManualContourModel_Box,Param,"Param",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsX,"List of points in the contour",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsY,"List of points in the contour",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsZ,"List of points in the contour",std::vector<double>,"");
+ BBTK_OUTPUT(ManualContourModel_Box,LstIndexsOut,"Lst number of points by segment",std::vector<int>,"");
+ BBTK_OUTPUT(ManualContourModel_Box,LstPssblIncnsnstntCntrY,"Lst of possible Inconsinstent Contour Y, little contour between two big contour, Difficult for the SIN distribution (DoubleContour 1)",std::vector<double>,"");
+ BBTK_OUTPUT(ManualContourModel_Box,LstPssblIncnsnstntCntrID,"Lst of possible Inconsinstent Contour ID, little contour between two big contour, Difficult for the SIN distribution (DoubleContour 1)",std::vector<int>,"");
+
+
BBTK_END_DESCRIBE_BLACK_BOX(ManualContourModel_Box);
//=====
//=====
void ManualPaint::Process()
{
-
-/*
- std::string msg;
- if (bbGetInputTitle()!="")
- {
- msg = bbGetInputTitle()+": " + bbGetInputIn();
- }
- else
- {
- msg = bbGetInputIn();
- }
- ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
- */
-
if (bbGetInputWxVtkBaseView1()==NULL)
{
wxMessageDialog(NULL, bbtk::std2wx("(ManualPaint) Input 'WxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
}
-
if (bbGetInputIn()==NULL)
{
wxMessageDialog(NULL, bbtk::std2wx("(ManualPaint) Input 'vtkImageData' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
}
-
-
if (firsttime==true)
{
firsttime=false;
-
- ManualPaintModel *mpModel = new ManualPaintModel();
+ ManualPaintModel *mpModel = new ManualPaintModel();
+ ManualPaintControler *mpControler = new ManualPaintControler();
mpModel->SetImages( bbGetInputIn() , bbGetInputIn2() );
-
- wxManualPaintPanel *mpPanel = (wxManualPaintPanel*)bbGetOutputWidget();
- mpPanel->SetManualPaintModel(mpModel);
-
- if (bbGetInputWxVtkBaseView1()!=NULL)
- {
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
- mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView1() );
- mpControler->Config();
- }
-
- if (bbGetInputWxVtkBaseView2()!=NULL)
- {
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
- mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView2() );
- mpControler->Config();
- }
-
- if (bbGetInputWxVtkBaseView3()!=NULL)
- {
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
- mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView3() );
- mpControler->Config();
- }
-
- if (bbGetInputWxVtkBaseView4()!=NULL)
- {
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
- mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView4() );
- mpControler->Config();
- }
-
+ mpControler->SetManualPaintModel(mpModel);
+ mpControler->SetWxVtk2DBaseView( 1, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView1() );
+ mpControler->SetWxVtk2DBaseView( 2, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView2() );
+ mpControler->SetWxVtk2DBaseView( 3, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView3() );
+ mpControler->SetWxVtk2DBaseView( 4, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView4() );
+ mpControler->Config();
+ wxManualPaintPanel *mpPanel = (wxManualPaintPanel*)bbGetOutputWidget();
+ mpPanel->SetManualPaintControler(mpControler);
} // firsttime
-
}
+
//=====
// Don't edit this file. This file is generated from xml description..
//=====
//=====
void ManualPaint::bbUserSetDefaultValues()
{
- firsttime=true;
+ firsttime = true;
bbSetInputIn(NULL);
bbSetInputWxVtkBaseView1(NULL);
bbSetInputWxVtkBaseView2(NULL);
#include "bbcreaMaracasVisuManualPaint_Model.h"
#include "bbcreaMaracasVisuPackage.h"
+#include <omp.h>
+
namespace bbcreaMaracasVisu
{
// 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)
//=====
-
-void ManualPaint_Model::Process()
+//-- Alternativa con openmp --
+void ManualPaint_Model::LstPointOMPAnalice()
{
-// THE MAIN PROCESSING METHOD BODY
-// Here we simply set the input 'In' value to the output 'Out'
-// And print out the output value
-// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
-// void bbSet{Input|Output}NAME(const TYPE&)
-// const TYPE& bbGet{Input|Output}NAME() const
-// Where :
-// * NAME is the name of the input/output
-// (the one provided in the attribute 'name' of the tag 'input')
-// * TYPE is the C++ type of the input/output
-// (the one provided in the attribute 'type' of the tag 'input')
-// bbSetOutputOut( bbGetInputIn() );
-// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
- if (bbGetInputImage()!=NULL)
- {
- manualpaintmodel->SetActive( bbGetInputActive() );
- manualpaintmodel->SetTool( bbGetInputTool() );
- manualpaintmodel->Set2D3D( bbGetInput2D3D() );
- manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
- manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
- manualpaintmodel->SetDirection( bbGetInputDirection() );
- manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
- manualpaintmodel->SetBrushForm( bbGetInputBrushForm() );
- manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() );
- manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );
- manualpaintmodel->SetRangeMin( bbGetInputRange()[0] );
- manualpaintmodel->SetRangeMax( bbGetInputRange()[1] );
- if (bbGetInputPoint().size()==3)
- {
- manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
- } // if Points
+printf("EED ManualPaint_Model::LstPointOMPAnalice\n" );
+printf("EED FillFilter::Run ojo toca limpiar bien el codigo _px px ...... \n");
+printf("EED FillFilter::Run ojo toca limpiar bien el codigo _px px ...... \n");
+printf("EED FillFilter::Run ojo toca limpiar bien el codigo _px px ...... \n");
+printf("EED FillFilter::Run ojo toca limpiar bien el codigo _px px ...... \n");
+
+
+printf("EED ManualPaint_Model::LstPointOMPAnalice Start \n");
+//-- Alternativa con openmp --
+// A. Create copie of index original list => lst1
+// B. if list1 es not empty do..
+// B.1. Create copy of lst1 to lst2
+// B.2. For each element of lst2 (incrimental) check the distance of the rest of the list (decremental) and take it out
+// B.3. openmp sobre la La lst2 que queda (PaintImage)
+// B.4. Quitar los elementos de lst2 en lst1 y recomenzar desde el punto B;
+
+ double distMin,dist2Min;
+ if (bbGetInputTool()==0)
+ {
+ distMin=bbGetInputBrushSize();
+ } else {
+ distMin=bbGetInputDistanceFill();
+ }
+ dist2Min=distMin*distMin*1.2;
+
+// A. Create copie of index original list => lst1
+ std::vector<int> lst1;
+ int i1,size1 = bbGetInputByLstPointsX().size();
+ for (i1=0;i1<size1;i1++)
+ {
+ lst1.push_back(i1);
+ } // for i1
- if ( bbGetInputByLstPointsX().size()!=0 )
+// B. if list1 es not empty do..
+ int i2,i3,size2;
+ double dist2,dx,dy,dz;
+ while (lst1.size()!=0)
+ {
+// B.1. Create copy of lst1 to lst2
+ size1=lst1.size();
+ std::vector<int> lst2;
+ for (i1=0;i1<size1;i1++)
{
- int i,size = bbGetInputByLstPointsX().size();
- for (i=0;i<size;i++)
- {
- manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
- } // for
- }// if ByLstPointsX
+ lst2.push_back( lst1[i1] );
+ } // for i1
- if (bbGetInputByImagePoints()!=NULL)
+// B.2. For each element of lst2 (incrimental) check the distance of the rest of the list (decremental) and take it out
+ for (i2=0;i2<lst2.size();i2++)
{
-// int ia,ja,ka;
-// int ii,jj,kk;
- int ext[6];
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- bbGetInputByImagePoints()->GetWholeExtent(ext);
-#else
- bbGetInputByImagePoints()->GetExtent(ext);
-#endif
-
- int dimX=ext[1]-ext[0]+1;
- int dimY=ext[3]-ext[2]+1;
- int dimZ=ext[5]-ext[4]+1;
-
- DEF_POINTER_IMAGE_VTK_CREA(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints());
- DEF_POINTER_IMAGE_VTK_CREA(vI2,sSI2,pI2,sTI2,bbGetInputImage2());
-
-//#pragma omp parallel for
-
- int i,j,k;
- for (k=0;k<dimZ;k++)
+ size2=lst2.size();
+ for ( i3=size2-1 ; i3>i2 ; i3-- )
{
- if (k%50==0)
+ dx = bbGetInputByLstPointsX()[ lst2[i2] ]-bbGetInputByLstPointsX()[ lst2[i3] ];
+ dy = bbGetInputByLstPointsY()[ lst2[i2] ]-bbGetInputByLstPointsY()[ lst2[i3] ];
+ dz = bbGetInputByLstPointsZ()[ lst2[i2] ]-bbGetInputByLstPointsZ()[ lst2[i3] ];
+ dist2 = dx*dx +dy*dy + dz*dz ;
+ if (dist2<dist2Min)
{
- printf("ManualPaint_Model %d%\n", (int)(k*100.0/dimZ) );
- }
- for (j=0;j<dimY;j++)
+ lst2.erase( lst2.begin()+i3 );
+ } } // for i3
+ } // for i2
+
+// B.3. openmp sobre la La lst2 que queda (PaintImage)
+ size2=lst2.size();
+long int k1omp=(double)(size2-1)*0.0;
+long int k2omp=(double)(size2-1)*0.2;
+long int k3omp=(double)(size2-1)*0.4;
+long int k4omp=(double)(size2-1)*0.6;
+long int k5omp=(double)(size2-1)*0.8;
+long int k6omp=(double)(size2-1)*1.0;
+printf("EED ManualPaint_Model::LstPointOMPAnalice (with openmp) size=%d\n",size2);
+#pragma omp parallel for
+ for (i2=0;i2<size2;i2++)
+ {
+ if ( (k1omp==i2) || (k2omp==i2) || (k3omp==i2) ||
+ (k4omp==i2) || (k5omp==i2) || (k6omp==i2) )
+ {
+ if (size2==1)
+ {
+ printf(" 100% (just one element)\n");
+ } else {
+ printf(" %d% \n", (int)(((double)i2/(double)(size2-1))*100 ));
+ }
+ }// if K#omp
+ manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[ lst2[i2] ] ,
+ bbGetInputByLstPointsY()[ lst2[i2] ] ,
+ bbGetInputByLstPointsZ()[ lst2[i2] ] );
+ } // for i2
+
+// B.4. Quitar los elementos de lst2 en lst1 y recomenzar desde el punto B;
+ for (i2=0;i2<size2;i2++)
+ {
+ size1=lst1.size();
+ for (i1=0;i1<size1;i1++)
+ {
+ if (lst2[i2]==lst1[i1])
{
- for (i=0;i<dimX;i++)
+ lst1.erase( lst1.begin()+i1 );
+ i1=size1;
+ } // if
+ } // for i1
+ } // for i2
+
+ } // while
+printf("EED ManualPaint_Model::LstPointOMPAnalice End\n");
+
+}
+
+
+void ManualPaint_Model::Process()
+{
+/* Notas
+0. Quitar comentarion ByLstPoints openmp
+1. Falta openmp ByImagePoints
+2. Desligar cada PaintImage de la mascara
+ -pequeno bloque de memoria para cada PaintImage
+ -el resultado volverlo a colocar en la image2 original
+ -Si no existe image2 original y hay que colocarlo en la imagen de origien
+ hay que crear una imagen2 temporal y luego bajar la imagen
+3. Verificar el mecanismo de undo con ByLstPoints
+4. Verificar el mecanismo de undo con ByImagePoints
+*/
+ if (bbGetInputActive()==true)
+ {
+ if (bbGetInputImage()!=NULL)
+ {
+ manualpaintmodel->SetActive( bbGetInputActive() );
+ manualpaintmodel->SetTool( bbGetInputTool() );
+ manualpaintmodel->Set2D3D( bbGetInput2D3D() );
+ manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
+ manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
+ manualpaintmodel->SetDirection( bbGetInputDirection() );
+ manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
+ manualpaintmodel->SetBrushForm( bbGetInputBrushForm() );
+ manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() );
+ manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );
+ manualpaintmodel->SetRangeMin( bbGetInputRange()[0] );
+ manualpaintmodel->SetRangeMax( bbGetInputRange()[1] );
+ if (bbGetInputPoint().size()==3)
+ {
+ manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
+ manualpaintmodel->SetUndoImage();
+ manualpaintmodel->Copy_GeneralAuxFill_to_Results();
+ } // if Points
+ if ( bbGetInputByLstPointsX().size()!=0 )
+ {
+ //-- Alternativa con openmp --
+// LstPointOMPAnalice();
+
+// /* -- Original ByLstPoints sin openmp --
+ int i,size = bbGetInputByLstPointsX().size();
+long int k1omp=(double)(size-1)*0.0;
+long int k2omp=(double)(size-1)*0.2;
+long int k3omp=(double)(size-1)*0.4;
+long int k4omp=(double)(size-1)*0.6;
+long int k5omp=(double)(size-1)*0.8;
+long int k6omp=(double)(size-1)*1.0;
+printf("EED ManualPaint_Model::Process list of points (with openmp) size=%d\n",size);
+#pragma omp parallel for
+ for (i=0;i<size;i++)
+ {
+ if ( (k1omp==i) || (k2omp==i) || (k3omp==i) ||
+ (k4omp==i) || (k5omp==i) || (k6omp==i) )
+ {
+ if (size==1)
+ {
+ printf(" 100% (just one element)\n");
+ } else {
+ printf(" %d% \n", (int)(((double)i/(double)(size-1))*100 ));
+ }
+ }// if K#omp
+ manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] ,
+ bbGetInputByLstPointsY()[i] ,
+ bbGetInputByLstPointsZ()[i] );
+ //_manualPaintModel->SetUndoImage(); // Probably needed. Here is ok.
+ } // for
+// -- Original ByLstPoints sin openmp --*/
+
+ manualpaintmodel->Copy_GeneralAuxFill_to_Results();
+
+ }// if ByLstPointsX
+ if ((bbGetInputByImagePoints()!=NULL) && (bbGetInputImage2()!=NULL) )
+ {
+ // -- Alternativa con openmp --
+ // Calcular numero de cuadrantes
+ // Recorrer el primer cuadrante
+ // Sacar la lista de todos los cuadrantes con el iElement Listo para analizar
+ // Recorrer la lista con openmp y ejecutar PaintImage
+
+///* -------------------- Original ByImagePoints sin openmp----------------------------
+ // int ia,ja,ka;
+ // int ii,jj,kk;
+ int ext[6];
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ bbGetInputByImagePoints()->GetWholeExtent(ext);
+ #else
+ bbGetInputByImagePoints()->GetExtent(ext);
+ #endif
+ int dimX=ext[1]-ext[0]+1;
+ int dimY=ext[3]-ext[2]+1;
+ int dimZ=ext[5]-ext[4]+1;
+ DEF_POINTER_IMAGE_VTK_CREA(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints());
+ DEF_POINTER_IMAGE_VTK_CREA(vI2,sSI2,pI2,sTI2,bbGetInputImage2());
+
+ long int index, size=dimX*dimY*dimZ;
+
+printf("EED ManualPaint_Model::Process A.start\n");
+std::vector<int> lstX;
+std::vector<int> lstY;
+std::vector<int> lstZ;
+ int i,j,k;
+ double value1;
+ double value2;
+ for (index=0; index<size; index++)
+ {
+ GETVALUE2_VTK_CREA(value1,pBIP,sTBIP,index)
+ if (value1>0)
+ {
+ GETVALUE2_VTK_CREA(value2,pI2,sTI2,index)
+ if (value2==0)
+ {
+ i = index % dimX;
+ j = (index % (dimX*dimY)) / dimX;
+ k = index / (dimX*dimY);
+ lstX.push_back(i);
+ lstY.push_back(j);
+ lstZ.push_back(k);
+ } // if value2
+ } // if value1
+ } // for
+printf("EED ManualPaint_Model::Process B.end\n");
+
+size=lstX.size();
+long int k1omp=(double)(size-1)*0.0;
+long int k2omp=(double)(size-1)*0.2;
+long int k3omp=(double)(size-1)*0.4;
+long int k4omp=(double)(size-1)*0.6;
+long int k5omp=(double)(size-1)*0.8;
+long int k6omp=(double)(size-1)*1.0;
+printf("EED ManualPaint_Model::Process ByImagePoints (with openmp) size=%d GrayLevel=%f this=%p\n",size,(double)bbGetInputGrayLevel(),this);
+//omp_set_num_threads( omp_get_max_threads()-1 );
+#pragma omp parallel for
+ for (index=0; index<size; index++)
+ {
+ if ( (k1omp==index) || (k2omp==index) || (k3omp==index) ||
+ (k4omp==index) || (k5omp==index) || (k6omp==index) )
+ {
+ if (size==1)
+ {
+ printf(" 100% (just one element)\n");
+ } else {
+ printf(" %d%% omp_get_num_threads=%d\n", (int)(((double)index/(double)(size-1))*100 ), omp_get_num_threads() );
+ }
+ }// if K#omp
+// double value1;
+// GETVALUE2_VTK_CREA(value1,pBIP,sTBIP,index)
+// if (value1>0)
+// {
+// double value2;
+// GETVALUE2_VTK_CREA(value2,pI2,sTI2,index)
+// if (value2==0)
+// {
+// int i = index % dimX;
+// int j = (index % (dimX*dimY)) / dimX;
+// int k = index / (dimX*dimY);
+ manualpaintmodel->PaintImage(lstX[index],lstY[index],lstZ[index]);
+// // manualpaintmodel->SetUndoImage(); // Probably needed. Here is ok.
+// } // vI2
+// } // vBIP
+ } // for index END openmp
+ manualpaintmodel->Copy_GeneralAuxFill_to_Results();
+
+
+
+
+
+
+
+/* openmp
+long int k1omp=(double)(size-1)*0.0;
+long int k2omp=(double)(size-1)*0.2;
+long int k3omp=(double)(size-1)*0.4;
+long int k4omp=(double)(size-1)*0.6;
+long int k5omp=(double)(size-1)*0.8;
+long int k6omp=(double)(size-1)*1.0;
+printf("EED ManualPaint_Model::Process ByImagePoints (with openmp) size=%d GrayLevel=%f this=%p\n",size,(double)bbGetInputGrayLevel(),this);
+omp_set_num_threads( omp_get_max_threads()-1 );
+#pragma omp parallel for
+ for (index=0; index<size; index++)
+ {
+ if ( (k1omp==index) || (k2omp==index) || (k3omp==index) ||
+ (k4omp==index) || (k5omp==index) || (k6omp==index) )
+ {
+ if (size==1)
+ {
+ printf(" 100% (just one element)\n");
+ } else {
+ printf(" %d%% omp_get_num_threads=%d\n", (int)(((double)index/(double)(size-1))*100 ), omp_get_num_threads() );
+ }
+ }// if K#omp
+ double value1;
+ GETVALUE2_VTK_CREA(value1,pBIP,sTBIP,index)
+ if (value1>0)
{
- GETVALUE_VTK_CREA(vBIP,pBIP,sTBIP)
- if (vBIP>0)
+ double value2;
+ GETVALUE2_VTK_CREA(value2,pI2,sTI2,index)
+ if (value2==0)
{
- GETVALUE_VTK_CREA(vI2,pI2,sTI2)
- if (vI2==0)
+ int i = index % dimX;
+ int j = (index % (dimX*dimY)) / dimX;
+ int k = index / (dimX*dimY);
+ manualpaintmodel->PaintImage(i,j,k);
+// manualpaintmodel->SetUndoImage(); // Probably needed. Here is ok.
+ } // vI2
+ } // vBIP
+ } // for index END openmp
+ manualpaintmodel->Copy_GeneralAuxFill_to_Results();
+*/
+
+/*
+ int i,j,k;
+ //#pragma omp parallel for
+ for (k=0;k<dimZ;k++)
+ {
+ for (j=0;j<dimY;j++)
+ {
+ for (i=0;i<dimX;i++)
+ {
+ GETVALUE_VTK_CREA(vBIP,pBIP,sTBIP)
+ if (vBIP>0)
{
- manualpaintmodel->PaintImage(i,j,k);
- } // vI2
- } // vBIP
- pBIP = pBIP + sSBIP;
- pI2 = pI2 + sSI2;
- }// for i
- }// for j
- }// for k
-
- printf("ManualPaint_Model %d%\n", 100 );
- } // if ByImagePoints
- } else {
- printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
- } // if
+ GETVALUE_VTK_CREA(vI2,pI2,sTI2)
+ if (vI2==0)
+ {
+ manualpaintmodel->PaintImage(i,j,k);
+ // manualpaintmodel->SetUndoImage(); // Probably needed. Here is ok.
+ } // vI2
+ } // vBIP
+ pBIP = pBIP + sSBIP;
+ pI2 = pI2 + sSI2;
+ }// for i
+ }// for j
+ }// for k
+//------- Original ByImagePoints sin openmp-------- */
+
+
+ } // if ByImagePoints
+
+ } else {
+ printf("EED Warning!! creaMaracasVisu::ManualPaint_Model (BBTK) bbInputImage not set. \n");
+ } // if (bbGetInputImage()!=NULL)
+ } // if active
if (bbGetInputImage2()!=NULL)
{
} else {
bbSetOutputOut( NULL );
}
+ bbSetOutputManualpaintmodel( manualpaintmodel );
}
//=====
// 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)
// Here we initialize the input 'In' to 0
bbSetInputActive(true);
- bbSetInputTool(1); // Paint
- bbSetInput2D3D(1); // 3D
+ bbSetInputTool(1); // Paint
+ bbSetInput2D3D(1); // 3D
bbSetInputImage(NULL);
bbSetInputImage2(NULL);
bbSetInputGrayLevel(100);
- bbSetInputDirection(2); // XY
+ bbSetInputDirection(2); // XY
bbSetInputBrushSize(3);
- bbSetInputBrushForm(1); // sphere
+ bbSetInputBrushForm(1); // sphere
bbSetInputToleranceFill(50);
bbSetInputDistanceFill(25);
-
std::vector<int> point;
- point.push_back(0);
- point.push_back(0);
- point.push_back(0);
- bbSetInputPoint(point);
-
+// point.push_back(0);
+// point.push_back(0);
+// point.push_back(0);
+// bbSetInputPoint(point);
std::vector<double> range;
range.push_back(0);
range.push_back(200);
bbSetInputRange(range);
-
bbSetInputByImagePoints(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)
// Here does nothing
// but this is where you should allocate the internal/output pointers
// if any
-
- manualpaintmodel=new ManualPaintModel();
-
-
+ manualpaintmodel=new ManualPaintModel();
}
//=====
// 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(ByLstPointsZ,std::vector<int>);
BBTK_DECLARE_INPUT(Range,std::vector<double>);
BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Manualpaintmodel,ManualPaintModel*);
BBTK_PROCESS(Process);
void Process();
-
+ void LstPointOMPAnalice();
ManualPaintModel *manualpaintmodel;
//=====
BBTK_INPUT(ManualPaint_Model,Image,"Image input / image result",vtkImageData*,"");
BBTK_INPUT(ManualPaint_Model,Image2,"Image result",vtkImageData*,"");
BBTK_INPUT(ManualPaint_Model,GrayLevel,"Fill gray level (100 default)",double,"");
- BBTK_INPUT(ManualPaint_Model,Direction,"Used in the 2D mode. 0=YZ , 1=XY , 2=XY(default) ",int,"");
+ BBTK_INPUT(ManualPaint_Model,Direction,"Used in the 2D mode. 0=YZ , 1=XZ , 2=XY(default) ",int,"");
BBTK_INPUT(ManualPaint_Model,BrushSize,"default 3",int,"");
BBTK_INPUT(ManualPaint_Model,BrushForm,"1 default A) 2D 0=rect,1=circle B) 3D 0=cube,1=sphere",int,"");
BBTK_INPUT(ManualPaint_Model,ToleranceFill,"default 50",double,"");
BBTK_INPUT(ManualPaint_Model,ByLstPointsZ,"Z Lst of points to run the Manual Paint",std::vector<int>,"");
BBTK_INPUT(ManualPaint_Model,Range,"min-max range [0 200] default",std::vector<double>,"");
BBTK_OUTPUT(ManualPaint_Model,Out,"Output image. Is the same pointer of input Image or Image2 with the modifications",vtkImageData*,"");
+ BBTK_OUTPUT(ManualPaint_Model,Manualpaintmodel,"ManualPaintModel",ManualPaintModel*,"");
BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint_Model);
//=====
--- /dev/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)
+//=====
+#include "bbcreaMaracasVisuManualPaint_UndoRedo.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include <wxMPRBaseData.h>
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_UndoRedo)
+BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_UndoRedo,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void ManualPaint_UndoRedo::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ if (bbGetInputManualpaintmodel()!=NULL)
+ {
+ if ( bbGetInputType()==1 )
+ {
+ bbGetInputManualpaintmodel()->Undo();
+ } // if Type 1
+ if ( bbGetInputType()==2 )
+ {
+ bbGetInputManualpaintmodel()->Redo();
+ } // if Type 2
+
+
+ if (bbGetInputwxvtkbaseview()!=NULL)
+ {
+
+ vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxvtkbaseview()->GetVtkBaseData());
+ vtkmprbasedata->SetX( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointX() );
+ vtkmprbasedata->SetY( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointY() );
+ vtkmprbasedata->SetZ( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointZ() );
+ wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
+ bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent( newevent );
+ #else
+ bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent( newevent );
+ #endif
+ } // if bbGetInputwxvtkbaseview()
+
+
+ } // if bbGetInputManualpaintmodel()
+
+
+
+
+}
+//=====
+// 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)
+//=====
+void ManualPaint_UndoRedo::bbUserSetDefaultValues()
+{
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputType(1);
+ bbSetInputManualpaintmodel(NULL);
+ bbSetInputwxvtkbaseview(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)
+//=====
+void ManualPaint_UndoRedo::bbUserInitializeProcessing()
+{
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+}
+
+//=====
+// 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)
+//=====
+void ManualPaint_UndoRedo::bbUserFinalizeProcessing()
+{
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+}
+
+} // EO namespace bbcreaMaracasVisu
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaMaracasVisuManualPaint_UndoRedo_h_INCLUDED__
+#define __bbcreaMaracasVisuManualPaint_UndoRedo_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxVtkBaseView.h"
+#include <ManualPaintModel.h>
+
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT ManualPaint_UndoRedo
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ManualPaint_UndoRedo,bbtk::AtomicBlackBox);
+//=====
+// 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(Manualpaintmodel,ManualPaintModel*);
+ BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_INPUT(wxvtkbaseview,wxVtkBaseView*);
+
+// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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_BEGIN_DESCRIBE_BLACK_BOX(ManualPaint_UndoRedo,bbtk::AtomicBlackBox);
+ BBTK_NAME("ManualPaint_UndoRedo");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(ManualPaint_UndoRedo,Manualpaintmodel,"ManualPaintModel",ManualPaintModel*,"");
+ BBTK_INPUT(ManualPaint_UndoRedo,Type,"(Default 1) 1:Undo 2:Redo",int,"");
+ BBTK_INPUT(ManualPaint_UndoRedo,wxvtkbaseview,"wxVtkBaseView",wxVtkBaseView*,"");
+// BBTK_OUTPUT(ManualPaint_UndoRedo,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint_UndoRedo);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuManualPaint_UndoRedo_h_INCLUDED__
+
--- /dev/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)
+//=====
+#include "bbcreaMaracasVisuReadCreaContourFile.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ReadCreaContourFile)
+BBTK_BLACK_BOX_IMPLEMENTATION(ReadCreaContourFile,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void ReadCreaContourFile::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ if (bbGetInputFileNameRoi().compare("")==0)
+ {
+ printf("EED Warnning! ReadCreaContourFile::Process FileNameRoi EMPTY\n");
+ } else {
+ char tmp[255];
+ FILE *ff= fopen(bbGetInputFileNameRoi().c_str(),"r");
+ if (ff==NULL)
+ {
+ printf("EED Warnning! ReadCreaContourFile::Process Wrong file %s\n", bbGetInputFileNameRoi().c_str() );
+ } else {
+ fscanf(ff,"%s",tmp); // --CreaContour--
+ std::string tmpStr(tmp);
+ if (tmpStr.compare("--CreaContour--")==0 )
+ {
+ int iContour,iControlPoint;
+ int dimX, dimY,dimZ;
+ int NumberOfContours;
+ double x,y,z,zz;
+ int TypeModel;
+ int NumberOfControlPoints;
+
+
+ std::vector<double> LstX;
+ std::vector<double> LstY;
+ std::vector<double> LstZ;
+ std::vector<int> LstIndexs;
+
+ fscanf(ff,"%s",tmp); // version
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); // ImageDimensions
+ fscanf(ff,"%d",&dimX); //
+ fscanf(ff,"%d",&dimY); //
+ fscanf(ff,"%d",&dimZ); //
+ fscanf(ff,"%s",tmp); // ImageSpacing
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); // NumberOfContours
+ fscanf(ff,"%d",&NumberOfContours); //
+ for (iContour=0 ; iContour<NumberOfContours ; iContour++)
+ {
+ fscanf(ff,"%s",tmp); // Instant
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); zz=atof(tmp); // zz
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); //
+ fscanf(ff,"%s",tmp); // TypeModel
+ fscanf(ff,"%d",&TypeModel); //
+ if ((TypeModel==1) || (TypeModel==6) )
+ {
+ fscanf(ff,"%s",tmp); // NumberOfControlPoints
+ fscanf(ff,"%d",&NumberOfControlPoints); //
+ LstIndexs.push_back( NumberOfControlPoints );
+ for (iControlPoint=0 ; iControlPoint<NumberOfControlPoints ; iControlPoint++)
+ {
+ fscanf(ff,"%s",tmp); x=atof(tmp); // x
+ fscanf(ff,"%s",tmp); y=atof(tmp); // y
+ fscanf(ff,"%s",tmp); z=atof(tmp); // z
+ if (bbGetInputFromDirection()==0) // XY
+ {
+ LstX.push_back(x);
+ LstY.push_back(y);
+ LstZ.push_back(zz);
+ } // if FromDirection
+ if (bbGetInputFromDirection()==1) // YZ
+ {
+ LstX.push_back(zz);
+ LstY.push_back(x);
+ LstZ.push_back(y);
+ } // if FromDirection
+ if (bbGetInputFromDirection()==2) // XZ
+ {
+ LstX.push_back(x);
+ LstY.push_back(zz);
+ LstZ.push_back( (y*(-1)) + (dimY-1) );
+ } // if FromDirection
+ } // iControlPoint
+ } // TypeModel
+ fscanf(ff,"%s",tmp); // TypeView
+ fscanf(ff,"%s",tmp); //
+
+ } // for i NumberOfContours
+ fclose(ff);
+ bbSetOutputLstX( LstX );
+ bbSetOutputLstY( LstY );
+ bbSetOutputLstZ( LstZ );
+ bbSetOutputLstIndexs( LstIndexs );
+
+ } else {
+ printf("EED Warnning! ReadCreaContourFile::Process %s is not a creaContour .roi file\n",bbGetInputFileNameRoi() );
+ } // if --CreaContour--
+ } // if ff
+ } // if FileNameRoi
+
+}
+//=====
+// 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)
+//=====
+void ReadCreaContourFile::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputFileNameRoi("");
+ bbSetInputFromDirection(0);
+
+}
+//=====
+// 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)
+//=====
+void ReadCreaContourFile::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void ReadCreaContourFile::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaMaracasVisuReadCreaContourFile_h_INCLUDED__
+#define __bbcreaMaracasVisuReadCreaContourFile_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT ReadCreaContourFile
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ReadCreaContourFile,bbtk::AtomicBlackBox);
+//=====
+// 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(FileNameRoi,std::string);
+ BBTK_DECLARE_INPUT(FromDirection,int);
+
+ BBTK_DECLARE_OUTPUT(LstX,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(LstY,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(LstZ,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(LstIndexs,std::vector<int>);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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_BEGIN_DESCRIBE_BLACK_BOX(ReadCreaContourFile,bbtk::AtomicBlackBox);
+ BBTK_NAME("ReadCreaContourFile");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(ReadCreaContourFile,FileNameRoi,"creaContour file (*.roi)",std::string,"");
+ BBTK_INPUT(ReadCreaContourFile,FromDirection,"(default 0) 0:XY 1:YZ 2:XZ",int,"");
+
+ BBTK_OUTPUT(ReadCreaContourFile,LstX,"Vetor X",std::vector<double>,"");
+ BBTK_OUTPUT(ReadCreaContourFile,LstY,"Vetor Y",std::vector<double>,"");
+ BBTK_OUTPUT(ReadCreaContourFile,LstZ,"Vetor Z",std::vector<double>,"");
+ BBTK_OUTPUT(ReadCreaContourFile,LstIndexs,"List of : number of elements by segments",std::vector<int>,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(ReadCreaContourFile);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuReadCreaContourFile_h_INCLUDED__
+
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
- if (bbGetInputwxVtkBaseView()!=NULL)
+
+ if (bbGetInputActive()==true)
{
- vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxVtkBaseView()->GetVtkBaseData());
- if (bbGetInputPoint().size()==3)
+ if (bbGetInputwxVtkBaseView()!=NULL)
{
- vtkmprbasedata->SetX( bbGetInputPoint()[0] );
- vtkmprbasedata->SetY( bbGetInputPoint()[1] );
- vtkmprbasedata->SetZ( bbGetInputPoint()[2] );
- wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refres
-//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
-#if wxMAJOR_VERSION <= 2
- bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
-#else
- bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
-#endif
-
-
- } // if bbGetInputPosition
- } // bbGetInputwxVtkBaseView
+ vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxVtkBaseView()->GetVtkBaseData());
+ if (bbGetInputPoint().size()==3)
+ {
+ vtkmprbasedata->SetX( bbGetInputPoint()[0] );
+ vtkmprbasedata->SetY( bbGetInputPoint()[1] );
+ vtkmprbasedata->SetZ( bbGetInputPoint()[2] );
+ vtkmprbasedata->SetFixAxis2D( bbGetInputFixAxis2D() );
+ wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
+ bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
+ #else
+ bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
+ #endif
+ } // if bbGetInputPosition
+ } // bbGetInputwxVtkBaseView
+ } // 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)
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
- bbSetInputwxVtkBaseView( NULL ) ;
+ bbSetInputActive(true);
+ bbSetInputwxVtkBaseView( NULL ) ;
+ bbSetInputFixAxis2D( false ) ;
}
//=====
// 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)
//=====
// 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(Point,std::vector<int>);
BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(FixAxis2D,bool);
// BBTK_DECLARE_OUTPUT(Out,double);
BBTK_PROCESS(Process);
void Process();
BBTK_AUTHOR("Info-Dev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(SetPosition,Active,"(default true) true/false",bool,"");
BBTK_INPUT(SetPosition,Point,"vector with point to be set [X Y Z]",std::vector<int>,"");
BBTK_INPUT(SetPosition,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,"");
+ BBTK_INPUT(SetPosition,FixAxis2D,"(default false) true/false",bool,"");
+
// BBTK_OUTPUT(SetPosition,Out,"First output",double,"");
BBTK_END_DESCRIBE_BLACK_BOX(SetPosition);
//=====
--- /dev/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)
+//=====
+#include "bbcreaMaracasVisuSetwxVtkBaseViewLookupTable.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include "wxVtk2DBaseView.h"
+
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SetwxVtkBaseViewLookupTable)
+BBTK_BLACK_BOX_IMPLEMENTATION(SetwxVtkBaseViewLookupTable,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void SetwxVtkBaseViewLookupTable::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ SetLookupTable( bbGetInputBaseView1() , bbGetInputScalarToColors(), bbGetInputOutputFormat() );
+ SetLookupTable( bbGetInputBaseView2() , bbGetInputScalarToColors(), bbGetInputOutputFormat() );
+ SetLookupTable( bbGetInputBaseView3() , bbGetInputScalarToColors(), bbGetInputOutputFormat() );
+ SetLookupTable( bbGetInputBaseView4() , bbGetInputScalarToColors(), bbGetInputOutputFormat() );
+}
+
+
+void SetwxVtkBaseViewLookupTable::SetLookupTable(wxVtkBaseView* baseview , vtkScalarsToColors* scalartocolors, int outputformat )
+{
+ if (baseview!=NULL)
+ {
+ if ( baseview->GetDirection()>=0 && baseview->GetDirection()<=2)
+ {
+ wxVtk2DBaseView* baseview2D = (wxVtk2DBaseView*)baseview;
+ baseview2D->_imageViewer2XYZ -> setScalarsToColors( scalartocolors, outputformat );
+ } // if Direction
+ } // if baseview
+}
+
+
+
+//=====
+// 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)
+//=====
+void SetwxVtkBaseViewLookupTable::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputBaseView1( NULL );
+ bbSetInputBaseView2( NULL );
+ bbSetInputBaseView3( NULL );
+ bbSetInputBaseView4( 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)
+//=====
+void SetwxVtkBaseViewLookupTable::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void SetwxVtkBaseViewLookupTable::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaMaracasVisuSetwxVtkBaseViewLookupTable_h_INCLUDED__
+#define __bbcreaMaracasVisuSetwxVtkBaseViewLookupTable_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxVtkBaseView.h"
+#include "vtkScalarsToColors.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT SetwxVtkBaseViewLookupTable
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(SetwxVtkBaseViewLookupTable,bbtk::AtomicBlackBox);
+//=====
+// 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(BaseView1,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(BaseView2,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(BaseView3,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(BaseView4,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(ScalarToColors,vtkScalarsToColors*);
+ BBTK_DECLARE_INPUT(OutputFormat,int);
+// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+ void SetLookupTable(wxVtkBaseView* baseview , vtkScalarsToColors* scalartocolors, int outputformat );
+
+//=====
+// 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_BEGIN_DESCRIBE_BLACK_BOX(SetwxVtkBaseViewLookupTable,bbtk::AtomicBlackBox);
+ BBTK_NAME("SetwxVtkBaseViewLookupTable");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(SetwxVtkBaseViewLookupTable,BaseView1,"wxVtkBaseView 1",wxVtkBaseView*,"");
+ BBTK_INPUT(SetwxVtkBaseViewLookupTable,BaseView2,"wxVtkBaseView 2",wxVtkBaseView*,"");
+ BBTK_INPUT(SetwxVtkBaseViewLookupTable,BaseView3,"wxVtkBaseView 3",wxVtkBaseView*,"");
+ BBTK_INPUT(SetwxVtkBaseViewLookupTable,BaseView4,"wxVtkBaseView 4",wxVtkBaseView*,"");
+ BBTK_INPUT(SetwxVtkBaseViewLookupTable,ScalarToColors,"LookUp table",vtkScalarsToColors*,"");
+ BBTK_INPUT(SetwxVtkBaseViewLookupTable,OutputFormat,"default (1) VTK_LUMINANCE=1, VTK_LUMINANCE_ALPHA=2, VTK_RGB=3, VTK_RGBA=4",int,"");
+
+// BBTK_OUTPUT(SetwxVtkBaseViewLookupTable,Out,"First output",double,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(SetwxVtkBaseViewLookupTable);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuSetwxVtkBaseViewLookupTable_h_INCLUDED__
+
--- /dev/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)
+//=====
+#include "bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include <wxMPRBaseData.h>
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SetwxVtkBaseViewSetOpacityAxis)
+BBTK_BLACK_BOX_IMPLEMENTATION(SetwxVtkBaseViewSetOpacityAxis,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void SetwxVtkBaseViewSetOpacityAxis::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ if (bbGetInputwxVtkBaseView()!=NULL)
+ {
+ vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxVtkBaseView()->GetVtkBaseData());
+ vtkmprbasedata->SetOpacityAxis( bbGetInputOpacity() );
+ wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+ bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
+#else
+ bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
+#endif
+ } // bbGetInputwxVtkBaseView
+}
+
+//=====
+// 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)
+//=====
+void SetwxVtkBaseViewSetOpacityAxis::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputOpacity( 1 ) ;
+ bbSetInputwxVtkBaseView( 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)
+//=====
+void SetwxVtkBaseViewSetOpacityAxis::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void SetwxVtkBaseViewSetOpacityAxis::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis_h_INCLUDED__
+#define __bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxVtkBaseView.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT SetwxVtkBaseViewSetOpacityAxis
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(SetwxVtkBaseViewSetOpacityAxis,bbtk::AtomicBlackBox);
+//=====
+// 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(Opacity,double);
+ BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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_BEGIN_DESCRIBE_BLACK_BOX(SetwxVtkBaseViewSetOpacityAxis,bbtk::AtomicBlackBox);
+ BBTK_NAME("SetwxVtkBaseViewSetOpacityAxis");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(SetwxVtkBaseViewSetOpacityAxis,Opacity,"Axis opacity",double,"");
+ BBTK_INPUT(SetwxVtkBaseViewSetOpacityAxis,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,"");
+// BBTK_OUTPUT(SetPosition,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(SetwxVtkBaseViewSetOpacityAxis);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis_h_INCLUDED__
+
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SliceImage)
BBTK_BLACK_BOX_IMPLEMENTATION(SliceImage,bbtk::AtomicBlackBox);
+
void SliceImage::Process()
{
vtkImageData *imagedata=NULL;
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- imageReslice->SetInput( bbGetInputIn() );
+ imageReslice->SetInput( bbGetInputIn() );
#else
- imageReslice->SetInputData( bbGetInputIn() );
+ imageReslice->SetInputData( bbGetInputIn() );
#endif
- imageReslice->SetInformationInput(bbGetInputIn() );
+ imageReslice->SetInformationInput(bbGetInputIn() );
- double slice=bbGetInputSlice();
- if (slice<0)
- {
- slice=0;
- }
-
- if (bbGetInputTypeOrientation()==3)
- {
+ double slice=bbGetInputSlice();
+ if (slice<0)
+ {
+ slice=0;
+ }
+
+ if (bbGetInputTypeOrientation()==3)
+ {
// Orientation 3 = FREE
// v1 = [ v1x , v1y , v1z ]
// v2 = [ v2x , v2y , v2z ]
imageReslice->SetResliceAxesOrigin( slice*bbGetInputIn()->GetSpacing()[0] ,0 ,0);
} else if (bbGetInputTypeOrientation()==2)
{
- // Orientation 2 = YZ
- // v1 = [ 0 , 0 ,-1 ]
- // v2 = [ 1 , 0 , 0 ]
- // v3 = [ 0 ,-1 , 0 ]
+ // Orientation 2 = Y-Z
+ // v1 = [ 0 , 1 ,0 ]
+ // v2 = [ 0 , 0 ,-1 ]
+ // v3 = [ -1 ,0 , 0 ]
+ // SetResliceAxesDirectionCosines(v1x,v2x,v3x,v1y,v2y,v3y,v1z,v2z,v3z);
+ imageReslice->SetResliceAxesDirectionCosines( 0,1,0, 0,0,-1, -1,0,0 );
+ imageReslice->SetResliceAxesOrigin( slice*bbGetInputIn()->GetSpacing()[0] ,0 ,0);
+ } else if (bbGetInputTypeOrientation()==-2)
+ {
+ // Orientation -2 = ZY
+ // v1 = [ 0 , 0 , 1 ]
+ // v2 = [ 0 , 1 , 0 ]
+ // v3 = [ -1, 0 , 0 ]
// SetResliceAxesDirectionCosines(v1x,v2x,v3x,v1y,v2y,v3y,v1z,v2z,v3z);
- imageReslice->SetResliceAxesDirectionCosines(0,1,0, 0,0,-1 ,-1,0,0);
+ imageReslice->SetResliceAxesDirectionCosines( 0,0,1, 0,1,0, -1,0,0 );
imageReslice->SetResliceAxesOrigin( slice*bbGetInputIn()->GetSpacing()[0] ,0 ,0);
} else if (bbGetInputTypeOrientation()==1) {
- // Orientation 1 = XZ
+ // Orientation 1 = X-Z
+ // v1 = [ 1 , 0 , 0 ]
+ // v2 = [ 0 , 0 , -1 ]
+ // v3 = [ 0 ,1 , 0 ]
+ // SetResliceAxesDirectionCosines(v1x,v2x,v3x,v1y,v2y,v3y,v1z,v2z,v3z);
+ imageReslice->SetResliceAxesDirectionCosines( 1,0,0, 0,0,-1, 0,1,0 );
+ imageReslice->SetResliceAxesOrigin(0, slice*bbGetInputIn()->GetSpacing()[1],0 );
+ } else if (bbGetInputTypeOrientation()==-1) {
+ // Orientation -1 = XZ
// v1 = [ 1 , 0 , 0 ]
// v2 = [ 0 , 0 , 1 ]
// v3 = [ 0 ,-1 , 0 ]
// SetResliceAxesDirectionCosines(v1x,v2x,v3x,v1y,v2y,v3y,v1z,v2z,v3z);
- imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,0,-1 ,0,1,0);
+ imageReslice->SetResliceAxesDirectionCosines( 1,0,0, 0,0,1, 0,-1,0 );
imageReslice->SetResliceAxesOrigin(0, slice*bbGetInputIn()->GetSpacing()[1],0 );
- } else
- {
+ } else {
// Orientation 0 = XY
// v1 = [ 1 , 0 , 0 ]
// v2 = [ 0 , 1 , 0 ]
imageReslice->SetResliceAxesOrigin(0,0, slice*bbGetInputIn()->GetSpacing()[2] );
}
imageReslice->SetOutputDimensionality(2);
- imageReslice->SetInterpolationModeToLinear();
-
+ if ( bbGetInputInterpolationMode()==0) { imageReslice->SetInterpolationModeToNearestNeighbor(); }
+ if ( bbGetInputInterpolationMode()==1) { imageReslice->SetInterpolationModeToLinear(); }
+ if ( bbGetInputInterpolationMode()==2) { imageReslice->SetInterpolationModeToCubic(); }
+
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
imagedata = imageReslice->GetOutput();
bbSetInputIn(NULL);
bbSetInputZ(0);
bbSetInputSlice(0);
+ bbSetInputInterpolationMode(0); // Linear
bbSetInputTypeOrientation(0);
imageReslice=NULL;
std::vector<double> lstCos;
BBTK_DECLARE_INPUT(In,vtkImageData*);
BBTK_DECLARE_INPUT(Z, double );
BBTK_DECLARE_INPUT(Slice, double );
+ BBTK_DECLARE_INPUT(InterpolationMode,int);
BBTK_DECLARE_INPUT(TypeOrientation, int );
BBTK_DECLARE_INPUT(ResliceAxesDirectionCosines, std::vector<double> );
BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
BBTK_BEGIN_DESCRIBE_BLACK_BOX(SliceImage,bbtk::AtomicBlackBox);
-BBTK_NAME("SliceImage");
-BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
-BBTK_DESCRIPTION("filter");
-BBTK_CATEGORY("");
-BBTK_INPUT(SliceImage,In,"Input image",vtkImageData *,"");
-BBTK_INPUT(SliceImage,Slice,"Slice",double,"");
-BBTK_INPUT(SliceImage,Z,"Z (deprecated)",double,"");
-BBTK_INPUT(SliceImage,ResliceAxesDirectionCosines,"ResliceAxesDirectionCosines [v1x,v1y,v1z,v2x,v2y,v2z,v3x,v3y,v3z], ",std::vector<double>,"");
-BBTK_INPUT(SliceImage,TypeOrientation,"Type orientation (default 0) 0=XY, 1=XZ, 2=YZ, 3=Free (Set the input ResliceAxesDirectionCosines)",int,"");
-BBTK_OUTPUT(SliceImage,Out,"Output image",vtkImageData *,"");
+ BBTK_NAME("SliceImage");
+ BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
+ BBTK_DESCRIPTION("filter");
+ BBTK_CATEGORY("");
+
+ BBTK_INPUT(SliceImage,In,"Input image",vtkImageData *,"");
+ BBTK_INPUT(SliceImage,Slice,"Slice",double,"");
+ BBTK_INPUT(SliceImage,Z,"Z (deprecated)",double,"");
+ BBTK_INPUT(SliceImage,InterpolationMode,"(default 0) 0=NearestNeighbor 1=Linear 2=Cubic",int,"");
+ BBTK_INPUT(SliceImage,ResliceAxesDirectionCosines,"ResliceAxesDirectionCosines [v1x,v1y,v1z,v2x,v2y,v2z,v3x,v3y,v3z], ",std::vector<double>,"");
+ BBTK_INPUT(SliceImage,TypeOrientation,"Type orientation (default 0) 0=XY, 1=X-Z, -1=XZ, 2=Y-Z, -2=ZY, 3=Free (Set the input ResliceAxesDirectionCosines)",int,"");
+
+ BBTK_OUTPUT(SliceImage,Out,"Output image",vtkImageData *,"");
+
BBTK_END_DESCRIBE_BLACK_BOX(SliceImage);
}
// EO namespace bbcreaMaracasVisu
{
bbSetOutputvtkRenderer( bbGetInputwxVtkBaseView()->GetRenderer() );
bbSetOutputDirection( bbGetInputwxVtkBaseView()->GetDirection() );
+
+ vtkBaseData *vtkbasedata = bbGetInputwxVtkBaseView()->GetVtkBaseData();
+ if (vtkbasedata!=NULL)
+ {
+ marImageData *marimagedata = vtkbasedata->GetMarImageData();
+ if (marimagedata!=NULL)
+ {
+ bbSetOutputImage( marimagedata->GetImageData() );
+ } // MarImageData
+ std::vector<double> LstWindowColorLevel;
+ LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() );
+ LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() );
+ bbSetOutputWindowColorLevel( LstWindowColorLevel );
+ bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
+
+ } // BaseData
}
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
- bbSetOutputDirection(2);
- bbSetOutputvtkRenderer(NULL);
+
+ std::vector<double> LstWindowColorLevel;
+ LstWindowColorLevel.push_back( 1000 );
+ LstWindowColorLevel.push_back( 500 );
+ bbSetOutputWindowColorLevel( LstWindowColorLevel );
+ bbSetOutputDirection(2);
+ bbSetOutputInterpolation(true);
+ bbSetOutputvtkRenderer(NULL);
}
//=====
BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*);
BBTK_DECLARE_OUTPUT(vtkRenderer,vtkRenderer*);
BBTK_DECLARE_OUTPUT(Direction,int);
+ BBTK_DECLARE_OUTPUT(Image,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(WindowColorLevel,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Interpolation,bool);
+
BBTK_PROCESS(Process);
void Process();
//=====
BBTK_OUTPUT(wxVtkBaseView_Info,Direction,"Direction -1=3D 0=YZ 1=XZ 2=XY(default)",int,"");
BBTK_OUTPUT(wxVtkBaseView_Info,vtkRenderer,"vtkRenderer default=NULL",vtkRenderer*,"");
+ BBTK_OUTPUT(wxVtkBaseView_Info,Image,"vtkImageData",vtkImageData*,"");
+ BBTK_OUTPUT(wxVtkBaseView_Info,WindowColorLevel,"List [Window, Level]",std::vector<double>,"");
+ BBTK_OUTPUT(wxVtkBaseView_Info,Interpolation,"(default true) true/false",bool,"");
BBTK_END_DESCRIBE_BLACK_BOX(wxVtkBaseView_Info);
//=====
#include "bbmaracasvisuAxeVolume.h"
#include "bbcreaMaracasVisuPackage.h"
+#include "creaVtk_MACROS.h"
+
namespace bbcreaMaracasVisu
{
void AxeVolume::Process()
{
- if ( mimage!=NULL )
- {
- mimage->Delete();
- }
-
- int ext[6];
- bbGetInputIn()->GetExtent(ext);
- int sizeX=ext[1]-ext[0]+1;
- int sizeY=ext[3]-ext[2]+1;
- int sizeZ=ext[5]-ext[4]+1;
-
- double spc[3];
- bbGetInputIn()->GetSpacing(spc);
- double invSpc[3];
- invSpc[0] = 1/spc[0];
- invSpc[1] = 1/spc[1];
- invSpc[2] = 1/spc[2];
-
- int outputformat = GetTypeFormat( bbGetInputOutputFormat() , bbGetInputIn() );
-
- mimage = vtkImageData::New();
- mimage->SetSpacing(bbGetInputIn()->GetSpacing());
- mimage->SetDimensions(bbGetInputIn()->GetDimensions());
- mimage->SetExtent(bbGetInputIn()->GetExtent());
- mimage->SetOrigin(bbGetInputIn()->GetOrigin());
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- mimage->SetScalarType( outputformat );
- mimage->AllocateScalars();
-#else
- mimage->AllocateScalars( outputformat , 1);
-#endif
-
- int sizeLstPointR = bbGetInputlstPointR().size();
- int iAxe,sizeAxe = bbGetInputlstPointX().size();
- int ii;
- int sizeImage = sizeX*sizeY*sizeZ;
- unsigned short *p;
-
- // Clean image
- p = (unsigned short*)mimage->GetScalarPointer (0, 0, 0);
- for ( ii=0 ; ii<sizeImage ; ii++)
+ if (bbGetInputIn()!=NULL)
{
- *p = 0;
- p++;
- }
-
-
-#pragma omp parallel for
- for (iAxe=0 ; iAxe<sizeAxe; iAxe++)
- {
- int i,j,k;
- double rx,ry,rz;
- double r,rr;
- double px,py,pz;
- double px1,py1,pz1;
- double px2,py2,pz2;
- printf("AxeVolume %d/%d\n ",iAxe,sizeAxe);
- if (iAxe<sizeLstPointR)
+ if ( mimage!=NULL )
{
- r = bbGetInputlstPointR()[ iAxe ]* invSpc[0];
- } else {
- if (bbGetInputlstPointR().size()>=1)
+ mimage->Delete();
+ }
+
+ int ext[6];
+ bbGetInputIn()->GetExtent(ext);
+ int sizeX=ext[1]-ext[0]+1;
+ int sizeY=ext[3]-ext[2]+1;
+ int sizeZ=ext[5]-ext[4]+1;
+
+ double spc[3];
+ bbGetInputIn()->GetSpacing(spc);
+ double invSpc[3];
+ invSpc[0] = 1/spc[0];
+ invSpc[1] = 1/spc[1];
+ invSpc[2] = 1/spc[2];
+
+ int outputformat = GetTypeFormat( bbGetInputOutputFormat() , bbGetInputIn() );
+
+ mimage = vtkImageData::New();
+ mimage->SetSpacing(bbGetInputIn()->GetSpacing());
+ mimage->SetDimensions(bbGetInputIn()->GetDimensions());
+ mimage->SetExtent(bbGetInputIn()->GetExtent());
+ mimage->SetOrigin(bbGetInputIn()->GetOrigin());
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ mimage->SetScalarType( outputformat );
+ mimage->AllocateScalars();
+ #else
+ mimage->AllocateScalars( outputformat , 1);
+ #endif
+
+ int sizeLstPointR = bbGetInputlstPointR().size();
+ int iAxe,sizeAxe = bbGetInputlstPointX().size();
+ int ii;
+ int sizeImage = sizeX*sizeY*sizeZ;
+ // unsigned short *p;
+
+ // Clean image
+ memset( (char*)mimage->GetScalarPointer(0,0,0) , 0, sizeImage*(mimage->GetScalarSize()) );
+
+ // p = (unsigned short*)mimage->GetScalarPointer (0, 0, 0);
+ // for ( ii=0 ; ii<sizeImage ; ii++)
+ // {
+ // *p = 0;
+ // p++;
+ // }
+
+
+ DEF_POINTER_IMAGE_VTK_CREA(vI,ssI,pI,stI,mimage)
+
+
+ int k1omp=(double)(sizeAxe-1)*0.0;
+ int k2omp=(double)(sizeAxe-1)*0.2;
+ int k3omp=(double)(sizeAxe-1)*0.4;
+ int k4omp=(double)(sizeAxe-1)*0.6;
+ int k5omp=(double)(sizeAxe-1)*0.8;
+ int k6omp=(double)(sizeAxe-1)*1.0;
+
+ printf("EED AxeVolume::Process (with openmp)\n");
+
+ #pragma omp parallel for
+ for (iAxe=0 ; iAxe<sizeAxe; iAxe++)
+ {
+ if ( (k1omp==iAxe) || (k2omp==iAxe) || (k3omp==iAxe) ||
+ (k4omp==iAxe) || (k5omp==iAxe) || (k6omp==iAxe) ) { printf(" %d%\n", (int)(((double)iAxe/(double)(sizeAxe-1))*100 )); }
+ int i,j,k;
+ double rx,ry,rz;
+ double r,rr;
+ double px,py,pz;
+ double px1,py1,pz1;
+ double px2,py2,pz2;
+ double vItmpOMP;
+
+ if (iAxe<sizeLstPointR)
{
- r = bbGetInputlstPointR()[ bbGetInputlstPointR().size()-1 ] * invSpc[0];
+ r = bbGetInputlstPointR()[ iAxe ]* invSpc[0];
} else {
- r = 1;
- }
- }
- px = bbGetInputlstPointX()[iAxe] * invSpc[0];
- py = bbGetInputlstPointY()[iAxe] * invSpc[1];
- pz = bbGetInputlstPointZ()[iAxe] * invSpc[2];
- px1 = px - r;
- py1 = py - r;
- pz1 = pz - r;
- px2 = px + r;
- py2 = py + r;
- pz2 = pz + r;
- rr=r*r;
-
- for ( i=px1 ; i<=px2 ; i++ )
- {
- rx = i - px;
- rx = rx*rx;
- for ( j=py1 ; j<py2 ; j++ )
+ if (bbGetInputlstPointR().size()>=1)
+ {
+ r = bbGetInputlstPointR()[ bbGetInputlstPointR().size()-1 ] * invSpc[0];
+ } else {
+ r = 1;
+ }
+ } // if iAxe sizeLstPointR
+ px = bbGetInputlstPointX()[iAxe] * invSpc[0];
+ py = bbGetInputlstPointY()[iAxe] * invSpc[1];
+ pz = bbGetInputlstPointZ()[iAxe] * invSpc[2];
+ px1 = px - r;
+ py1 = py - r;
+ pz1 = pz - r;
+ px2 = px + r;
+ py2 = py + r;
+ pz2 = pz + r;
+ rr=r*r;
+
+ long int index;
+ for ( i=px1 ; i<=px2 ; i++ )
{
- ry = j - py;
- ry = ry*ry;
- for ( k=pz1 ; k<pz2 ; k++ )
+ rx = i - px;
+ rx = rx*rx;
+ for ( j=py1 ; j<py2 ; j++ )
{
- if ( (i>=0) && (i<sizeX) && (j>=0) && (j<sizeY) &&(k>=0) && (k<sizeZ) )
+ ry = j - py;
+ ry = ry*ry;
+ for ( k=pz1 ; k<pz2 ; k++ )
{
-// p = (unsigned short*)mimage->GetScalarPointer (i, j, k);
-// if (*p==0)
- if ( mimage->GetScalarComponentAsDouble(i,j,k,0)==0 )
+ if ( (i>=0) && (i<sizeX) && (j>=0) && (j<sizeY) &&(k>=0) && (k<sizeZ) )
{
- rz = k - pz;
- rz = rz*rz;
- if ( rx + ry + rz <= rr )
+ // p = (unsigned short*)mimage->GetScalarPointer (i, j, k);
+ // if (*p==0)
+ index=i+j*sizeX+k*sizeX*sizeY;
+ GETVALUE2_VTK_CREA(vItmpOMP,pI,stI,index)
+ // EED2020-04-25 if ( mimage->GetScalarComponentAsDouble(i,j,k,0)==0 )
+ if ( vI==0 )
{
-// *p=255;
- mimage->SetScalarComponentFromDouble (i,j,k,0, bbGetInputValue() );
- }
- } // *p==0
- } // if inside point
- } //for k
- } //for j
- } //for i
- } // for iAxe
- bbSetOutputOut( mimage );
+ rz = k - pz;
+ rz = rz*rz;
+ if ( rx + ry + rz <= rr )
+ {
+ // *p=255;
+ vItmpOMP=bbGetInputValue();
+ SETVALUE2_VTK_CREA(vItmpOMP,pI,stI,index)
+ // EED2020-04-25 mimage->SetScalarComponentFromDouble (i,j,k,0, bbGetInputValue() );
+ }
+ } // *p==0
+ } // if inside point
+ } //for k
+ } //for j
+ } //for i
+ } // for iAxe
+ bbSetOutputOut( mimage );
+ } else {
+ printf("\n");
+ printf("EED Warnning!! AxeVolume::Process The Input In is not set.\n");
+ printf("\n");
+ }// if bbGetInputIn()
}
polydatamapper->SetInput(polydata);
#else
polydatamapper->SetInputData(polydata);
+ polydatamapper->Update();
#endif
vtkactor->SetMapper(polydatamapper);
spc[2]=1;
int lstpointsXsize =bbGetInputlstPointX().size();
-
- if( lstpointsXsize>0 ){
- vtkPoints* allPoints = vtkPoints::New( );
-vtkPolyLine *polyline = vtkPolyLine::New();
+ if( lstpointsXsize>0 )
+ {
+ vtkPoints *allPoints = vtkPoints::New( );
+ vtkPolyLine *polyline = vtkPolyLine::New();
vtkCellArray* allTopology = vtkCellArray::New( );
// allTopology->InsertNextCell( numPoints );
+
size=iGeneral+numPoints;
+
for (i=iGeneral;i<size;i++)
{
//multiplicar ver parametros spacing, en maracas cuando se toca la imagen y se ve dycom
// allTopology->InsertCellPoint( i-iGeneral );
} // rof
- allTopology->InsertNextCell(polyline);
-
- // create cell array for edges
- vtkCellArray *edges = vtkCellArray::New();
-
-// connect edge's and vertexes point ids
- for(vtkIdType i = iGeneral; i < size-1; i++)
- {
- vtkLine *edge = vtkLine::New();
- edge->GetPointIds()->SetId(0, i-iGeneral);
- edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
- edges->InsertNextCell(edge);
- edge->Delete();
-// vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();
-// vertex->GetPointIds()->SetId(0, i);
-// vertexes->InsertNextCell(vertex);
- }
-
- polydata->SetPoints( allPoints );
- polydata->SetLines(edges);
+
+ allTopology->InsertNextCell(polyline);
+ // create cell array for edges
+ vtkCellArray *edges = vtkCellArray::New();
+ // connect edge's and vertexes point ids
+ for(vtkIdType i = iGeneral; i < size-1; i++)
+ {
+ vtkLine *edge = vtkLine::New();
+ edge->GetPointIds()->SetId(0, i-iGeneral);
+ edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
+ edges->InsertNextCell(edge);
+ edge->Delete();
+ // vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();
+ // vertex->GetPointIds()->SetId(0, i);
+ // vertexes->InsertNextCell(vertex);
+ }
+ polydata->SetPoints( allPoints );
+ polydata->SetLines(edges);
// polydata->SetLines( allTopology );
vtkactor->GetProperty()->SetColor( r,g,b );
} // Law 2 color for each segment
-
if (bbGetInputColourLaw()==3) // color for each point
{
// Setup the colors array
colors->SetName("Colors");
// colors->SetName("vertex color");
int iPoint,pointSize=iGeneral+numPoints;
-
-
for (iPoint=iGeneral; iPoint<pointSize; iPoint++)
{
r = bbGetInputColour()[0+iPoint*3]*255.0;
} // Law 3 color for each point
-
vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
{
vtkactor->SetUserTransform( bbGetInputTransform() );
}
-
- // Interface Update
- if (bbGetInputRenderer()!=NULL )
- {
- bbGetInputRenderer()->AddActor( vtkactor );
- }
+ // Interface Update
+ if (bbGetInputRenderer()!=NULL )
+ {
+ bbGetInputRenderer()->AddActor( vtkactor );
+ }
}
void DrawAxisTree3D::Process()
{
- printf("EED DrawAxisTree3D::Process start \n");
-
- int iGeneral=0;
- int iAxis,sizeLstAxis=bbGetInputlstIndexs().size();
- int iActor,sizeActors = vecVtkActors.size();
- int numPoints;
-
-// if (oldLstSize!=sizeLstAxis)
-// {
-// oldLstSize=sizeLstAxis;
- for (iActor=0 ; iActor<sizeActors; iActor++)
- {
- if (bbGetInputRenderer()!=NULL )
- {
- bbGetInputRenderer()->RemoveActor( vecVtkActors[iActor] );
- vecVtkPolyData[iActor]->Delete();
- vecVtkPolyDataMaper[iActor]->Delete();
- vecVtkActors[iActor]->Delete();
- } // if
- } // for iActor
- vecVtkPolyData.clear();
- vecVtkPolyDataMaper.clear();
- vecVtkActors.clear();
-
- for ( iAxis=0 ; iAxis<sizeLstAxis ; iAxis++)
- {
- numPoints = bbGetInputlstIndexs()[iAxis];
- DrawOneAxis(iGeneral,numPoints,iAxis);
- iGeneral = iGeneral+numPoints;
-
- // if ((iAxis % 1)==0)
- // {
- // printf("EED DrawAxisTree3D::Process %d/%d\n", iAxis,sizeLstAxis );
- // }
-
- } // for iAxis
-
- if ( bbGetInputiAxis() < (int)(vecVtkActors.size()-1) )
- {
- bbSetOutputOutAxis( vecVtkActors[ bbGetInputiAxis() ] );
- } else {
- printf("DrawAxisTree3D .ERROR. missing index vector...\n");
- } // if
-
- // } else {// if oldLstSize
- for (iActor=0 ; iActor<sizeActors; iActor++)
- {
- vecVtkActors[iActor]->GetProperty()->SetOpacity( bbGetInputOpacity() );
- vecVtkActors[iActor]->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
- }
-// } // if oldLstSize
-
- printf("EED DrawAxisTree3D::Process end \n");
+
+ // Removing actors
+ int iActor,sizeActors = vecVtkActors.size();
+ for (iActor=0 ; iActor<sizeActors; iActor++)
+ {
+ if (bbGetInputRenderer()!=NULL )
+ {
+ bbGetInputRenderer()->RemoveActor( vecVtkActors[iActor] );
+ vecVtkPolyData[iActor]->Delete();
+ vecVtkPolyDataMaper[iActor]->Delete();
+ vecVtkActors[iActor]->Delete();
+ } // if
+ } // for iActor
+ vecVtkPolyData.clear();
+ vecVtkPolyDataMaper.clear();
+ vecVtkActors.clear();
+
+ // Adding actors
+ if (bbGetInputActive()==true)
+ {
+ if ( (bbGetInputlstPointX().size()==bbGetInputlstPointY().size()) &&
+ (bbGetInputlstPointX().size()==bbGetInputlstPointZ().size()) )
+ {
+ int iGeneral=0;
+ std::vector<int> lstIndexs = bbGetInputlstIndexs();
+ if ( bbGetInputlstIndexs().size()==0 )
+ {
+ lstIndexs.push_back( bbGetInputlstPointX().size() );
+ } // if
+ int iAxis,sizeLstAxis=lstIndexs.size();
+ int numPoints;
+ for ( iAxis=0 ; iAxis<sizeLstAxis ; iAxis++)
+ {
+ numPoints = lstIndexs[iAxis];
+ DrawOneAxis(iGeneral,numPoints,iAxis);
+ iGeneral = iGeneral+numPoints;
+ } // for iAxis
+ if ( bbGetInputiAxis() < (int)(vecVtkActors.size() ) )
+ {
+ bbSetOutputOutAxis( vecVtkActors[ bbGetInputiAxis() ] );
+ } else {
+ printf("DrawAxisTree3D .ERROR. iAxis for exist in actors vector ...\n");
+ } // if
+ } else {
+ printf("\nDrawAxisTree3D .ERROR. size of vectors lstPointX.size=%d lstPointY.size=%d lstPointZ.size=%d are not coherent \n\n",bbGetInputlstPointX().size(), bbGetInputlstPointY().size(), bbGetInputlstPointZ().size() );
+ }// size X Y Z
+ } // if Active
}
void DrawAxisTree3D::bbUserSetDefaultValues()
{
oldLstSize=-1;
- bbSetInputiAxis(0);
std::vector<double> colour;
// 1- red
colour.push_back(1.0);
colour.push_back(0.5);
colour.push_back(0.5);
+ bbSetInputActive(true);
+ bbSetInputiAxis(0);
bbSetInputColour(colour);
bbSetInputOpacity(1);
bbSetInputLineWidth(0.5);
bbSetInputColourLaw(1);
+ bbSetInputTransform(NULL);
+ bbSetOutputOutAxis(NULL);
}
public bbtk::AtomicBlackBox
{
BBTK_BLACK_BOX_INTERFACE(DrawAxisTree3D,bbtk::AtomicBlackBox);
+ BBTK_DECLARE_INPUT(Active , bool);
BBTK_DECLARE_INPUT(Renderer , vtkRenderer*);
BBTK_DECLARE_INPUT(lstIndexs , std::vector<int>);
BBTK_DECLARE_INPUT(lstPointX , std::vector<double>);
private:
int oldLstSize;
- std::vector<vtkPolyData*> vecVtkPolyData;
+ std::vector<vtkPolyData*> vecVtkPolyData;
std::vector<vtkPolyDataMapper*> vecVtkPolyDataMaper;
- std::vector<vtkActor*> vecVtkActors;
+ std::vector<vtkActor*> vecVtkActors;
void DrawOneAxis(int iGeneral,int numPoints, int iAxis);
};
BBTK_AUTHOR("InfoTeam CREATIS-LRMN");
BBTK_DESCRIPTION("Draw Axis Tree 3D");
BBTK_CATEGORY("actor");
+ BBTK_INPUT(DrawAxisTree3D,Active,"(default true) true/false",bool,"");
BBTK_INPUT(DrawAxisTree3D,Renderer,"Renderer",vtkRenderer*,"");
BBTK_INPUT(DrawAxisTree3D,lstIndexs,"Indexs",std::vector<int>,"");
BBTK_INPUT(DrawAxisTree3D,lstPointX,"lstPointX",std::vector<double>,"");
BBTK_INPUT(DrawAxisTree3D,Opacity,"Opacity",double,"");
BBTK_INPUT(DrawAxisTree3D,LineWidth,"LineWidth (default 0.5)",double,"");
BBTK_INPUT(DrawAxisTree3D,iAxis,"iAxis",int,"");
- BBTK_OUTPUT(DrawAxisTree3D,OutAxis,"Axis[iAxis]",vtkProp3D *,"");
+ BBTK_OUTPUT(DrawAxisTree3D,OutAxis,"Axis[iAxis]",vtkProp3D*,"");
BBTK_END_DESCRIBE_BLACK_BOX(DrawAxisTree3D);
}
// EO namespace bbcreaMaracasVisu
BBTK_BLACK_BOX_IMPLEMENTATION(ImageActor,bbtk::AtomicBlackBox);
void ImageActor::Process()
{
-
-printf("EED ImageActor::Process Start\n");
-
//JCP 04/04/09
- vtkRenderer *render = bbGetInputRenderer();
vtkImageData *img = bbGetInputIn();
vtkLinearTransform* transform = bbGetInputTransform();
imageactor->SetInputData( img );
#endif
} else {
-/*
- vtkLookupTable *table = vtkLookupTable::New();
- table->SetRange(0, 1000); // image intensity range
- table->SetValueRange(0.0, 1.0); // from black to white
- table->SetSaturationRange(0.0, 0.0); // no color saturation
- table->SetRampToLinear();
- table->Build();
- double rgba[4];
- table->GetTableValue(0,rgba);
- rgba[3]=0;
- table->SetTableValue(0,rgba);
-*/
-
-
-/*
- vtkLookupTable *table = vtkLookupTable::New();
- table->SetTableRange (0, 2000);
- table->SetHueRange (1, 0);
- table->SetSaturationRange (1, 1);
- table->SetValueRange (1, 1);
- table->Build(); //effective built
-*/
-
-/*
-vtkColorTransferFunction *table = vtkColorTransferFunction::New();
-table->SetColorSpaceToHSV();
- table->HSVWrapOff();
- table->AddHSVSegment(0.0, 0.6, 1.0, 1.0,
- 1.0, 0.0, 1.0, 1.0);
- table->SetNanColor(1.0, 0.0, 1.0);
-*/
-
-/*
-printf("EED ImageActor::Process Warnning ***************************Not here this code *");
-vtkLookupTable *table = vtkLookupTable::New();
- table->SetNumberOfTableValues(1000);
- table->SetRange(0, 1000);
- table->Build();
- double rgba1[4];
- double rgba2[4];
- for (int iLookTable = 0; iLookTable<500; iLookTable++)
- {
- table->GetTableValue( iLookTable, rgba1);
- table->GetTableValue(1000-1-iLookTable, rgba2);
- table->SetTableValue(1000-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
- table->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
- } // for iLookTable
- double rgba[4];
- table->GetTableValue(0,rgba);
- rgba[3]=0;
- table->SetTableValue(0,rgba);
-*/
vtkImageMapToColors *color = vtkImageMapToColors::New();
color->SetLookupTable( bbGetInputLookupTable() );
-// color->SetLookupTable( table );
color->PassAlphaToOutputOn();
-// imageshiftscale->SetInput( img );
-// imageshiftscale->SetOutputScalarTypeToUnsignedChar();
-
-// color->SetInput( imageshiftscale->GetOutput() );
-
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
color->SetInput( img );
imageactor->GetMapper()->SetInput( color->GetOutput() );
#else
color->SetInputData( img );
+ color->Update();
imageactor->GetMapper()->SetInputData( color->GetOutput() );
#endif
- imageactor->GetProperty()->SetInterpolationTypeToNearest();
+
+ if ( bbGetInputInterpolationMode()==0) { imageactor->GetProperty()->SetInterpolationTypeToNearest(); }
+ if ( bbGetInputInterpolationMode()==1) { imageactor->GetProperty()->SetInterpolationTypeToLinear(); }
+ if ( bbGetInputInterpolationMode()==2) { imageactor->GetProperty()->SetInterpolationTypeToCubic(); }
+ imageactor->SetForceOpaque(true);
}
if (transform!=NULL)
{
imageactor->SetUserTransform( transform );
} // transform
- if(render != NULL )
- {
-// render->AddActor( imageactor );
- } // render
bbSetOutputOut(imageactor);
} // img
-
-
+
// Interface Update
if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
{
firsttime=false;
bbGetInputRenderer()->AddActor( imageactor );
}
-
imageactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
- bbSetOutputOut(imageactor);
-
-
-printf("EED ImageActor::Process End\n");
-
-
+ bbSetOutputOut(imageactor);
}
+
void ImageActor::bbUserSetDefaultValues()
{
firsttime = true;
imageactor = NULL;
bbSetInputIn(NULL);
-// bbSetInputType(0);
bbSetInputOpacity(1);
bbSetInputTransform(NULL);
bbSetInputRenderer(NULL);
bbSetInputLookupTable(NULL);
+ bbSetInputInterpolationMode(0);
}
BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
BBTK_DECLARE_INPUT(Opacity,double);
BBTK_DECLARE_INPUT(LookupTable,vtkScalarsToColors*);
-// BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_INPUT(InterpolationMode,int);
+
BBTK_DECLARE_OUTPUT(Out,vtkProp3D*);
BBTK_PROCESS(Process);
void Process();
BBTK_DESCRIPTION("put image in a 3D univers");
BBTK_CATEGORY("");
BBTK_INPUT(ImageActor,In,"Image input",vtkImageData*,"");
-// BBTK_INPUT(ImageActor,Type,"0 (default) vtkImageShiftScale Unsigned Char, 1 ColorTable",int,"");
BBTK_INPUT(ImageActor,Transform,"Transform",vtkLinearTransform*,"");
BBTK_INPUT(ImageActor,Renderer,"Renderer",vtkRenderer*,"");
BBTK_INPUT(ImageActor,Opacity,"Opacity [0-1]",double,"");
+ BBTK_INPUT(ImageActor,InterpolationMode,"(default 0) 0=NearestNeighbor 1=Linear 2=Cubic",int,"");
BBTK_INPUT(ImageActor,LookupTable,"LookupTable [vtkScalarsToColors]",vtkScalarsToColors*,"");
BBTK_OUTPUT(ImageActor,Out,"Output vtk actor",vtkProp3D*,"");
BBTK_END_DESCRIBE_BLACK_BOX(ImageActor);
#include "bbmaracasvisuImageChangeInformation.h"
#include "bbcreaMaracasVisuPackage.h"
+
namespace bbcreaMaracasVisu
{
//---------------------------------------------------
void PlotterView::Process()
{
-// if (firsttime==true)
-// {
-// firsttime=false;
-
- pGraphicalFunction *pGF = mwxwidget->getFunction(0);
- pGraphicalFunction *pGF2 = mwxwidget->getFunction(1);
-
- if ( (bbGetInputInY().size()!=0) && (bbGetInputInY2().size()==0) )
- {
- bbSetInputInY2( bbGetInputInY() );
- }
-
- if ( (bbGetInputInY().size()!=0) && (pGF==NULL) )
- {
- // avoid 'taking address of temporary '
- //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
-
- std::vector<double> inX;
- if (bbGetInputInX().size()==0)
+
+ double lim=1;
+
+ if (bbGetInputInX().size()==bbGetInputInY().size() )
+ {
+ pGraphicalFunction *pGF = mwxwidget->getFunction(0);
+ pGraphicalFunction *pGF2 = mwxwidget->getFunction(1);
+ // EED 2020-01-22
+ if (pGF!=NULL)
+ {
+ // -Erasing points-
+ int i,sizePoints = pGF->getSizePoints();
+ for (i=1; i<sizePoints;i++)
+ {
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
+ pGF->deletePointAt(1); // EED here NOT 0 is 1
+ #else
+ pGF->deletePointAt(0); // EED here NOT 0 is 1
+ #endif
+ } // for i
+ mwxwidget->deleteFunction(pGF);
+ pGF=NULL;
+ }
+ // EED 2020-01-22
+ if (pGF2!=NULL)
+ {
+ // -Erasing points-
+ int i,sizePoints = pGF2->getSizePoints();
+ for (i=0; i<sizePoints;i++)
+ {
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
+ pGF2->deletePointAt(1); // EED here NOT 0 is 1
+ #else
+ pGF2->deletePointAt(0); // EED here NOT 0 is 1
+ #endif
+ } // for i
+ mwxwidget->deleteFunction(pGF2);
+ pGF2=NULL;
+ }
+ if ( (bbGetInputInY().size()!=0) && (pGF==NULL) )
{
- int i,size=bbGetInputInY().size();
- for(i=0;i<size;i++)
+ // avoid 'taking address of temporary '
+ //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
+ std::vector<double> inX;
+ if (bbGetInputInX().size()==0)
{
- inX.push_back((double)i);
- } // for
- } else {
- inX = bbGetInputInX();
- } // if bbGetInputInX
- std::vector<double> inY = bbGetInputInY();
-
- /*
- std::vector<double> inX;
- std::vector<double> inY;
- inX.push_back(0); inX.push_back(200);
- inY.push_back(0); inY.push_back(1);
- */
- pGF = mwxwidget->getFunctionForVectors( &inX, &inY );
- mwxwidget->addFunction(pGF);
- } // if bbGetInputInY
-
- if ((bbGetInputInY2().size()!=0)&& (pGF2==NULL) )
- {
- // avoid 'taking address of temporary '
- //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
-
- std::vector<double> inX2;
- if (bbGetInputInX().size()==0)
+ int i,size=bbGetInputInY().size();
+ for(i=0;i<size;i++)
+ {
+ inX.push_back((double)i);
+ } // for
+ } else {
+ inX = bbGetInputInX();
+ } // if bbGetInputInX
+ std::vector<double> inY = bbGetInputInY();
+
+ bool ok=false;
+ int i, size = inY.size();
+ for ( i=0 ; i<size ; i++ )
+ {
+ if ((inY[i]>-lim) && (inY[i]<lim)) { inY[i]=0; }
+ if ((inY[i]<-lim) || (inY[i]>lim)) {ok=true;}
+ }// for
+ if (ok==true)
+ {
+ pGF = mwxwidget->getFunctionForVectors( &inX, &inY );
+ mwxwidget->addFunction(pGF);
+ } else {
+ printf("EED Warnning!! PlotterView::Process function y with CEROS ????..... \n");
+ } // if ok
+
+ } // if bbGetInputInY
+
+ if ((bbGetInputInY2().size()!=0)&& (pGF2==NULL) )
{
- int i,size=bbGetInputInY2().size();
- for(i=0;i<size;i++)
+ // avoid 'taking address of temporary '
+ //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
+ std::vector<double> inX2;
+ if (bbGetInputInX().size()==0)
{
- inX2.push_back((double)i);
- } // for
- } else {
- inX2 = bbGetInputInX();
- } // if bbGetInputInX
- std::vector<double> inY2 = bbGetInputInY();
- /*
- std::vector<double> inX2;
- std::vector<double> inY2;
- inX2.push_back(0); inX2.push_back(200);
- inY2.push_back(0); inY2.push_back(1);
- */
- pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 );
- mwxwidget->addFunction(pGF2);
- } // if bbGetInputInY
+ int i,size=bbGetInputInY2().size();
+ for(i=0;i<size;i++)
+ {
+ inX2.push_back((double)i);
+ } // for
+ } else {
+ inX2 = bbGetInputInX();
+ } // if bbGetInputInX
+ std::vector<double> inY2 = bbGetInputInY2();
+
+ bool ok2=false;
+ int i, size = inY2.size();
+ for ( i=0 ; i<size ; i++ )
+ {
+ if ((inY2[i]>-lim) && (inY2[i]<lim)) { inY2[i]=0; }
+ if ((inY2[i]<-lim) || (inY2[i]>lim)) {ok2=true;}
+ }// for
+ if (ok2==true)
+ {
+ pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 );
+ mwxwidget->addFunction(pGF2);
+ } else {
+ printf("EED Warnning!! PlotterView::Process function y2 with CEROS ????..... \n");
+ } // if ok2
+
+
+ } // if bbGetInputInY
-// } // if firsttime
+ /* EED 2020-01-22
-
- if (pGF!=NULL)
- {
- // -Erasing points-
- int i,sizePoints = pGF->getSizePoints();
- for (i=1; i<sizePoints;i++)
- {
- pGF->deletePointAt(1); // EED here NOT 0 is 1
- } // for i
- // -Add Points-
- double px;
- sizePoints=bbGetInputInY().size();
- for (i=0; i<sizePoints;i++)
+ if (pGF!=NULL)
{
- if (i<bbGetInputInX().size())
+ // -Erasing points-
+ int i,sizePoints = pGF->getSizePoints();
+ for (i=1; i<sizePoints;i++)
{
- px = bbGetInputInX()[i];
- } else {
- px = i;
- }
- pGF->AddNewPoint( px, bbGetInputInY()[i] );
- }
- }// if pGF
-
- if (pGF2!=NULL)
- {
- // -Erasing points-
- int i,sizePoints = pGF2->getSizePoints();
- for (i=0; i<sizePoints;i++)
- {
-//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
-#if wxMAJOR_VERSION <= 2
- pGF2->deletePointAt(1); // EED here NOT 0 is 1
-#else
- pGF2->deletePointAt(0); // EED here NOT 0 is 1
-#endif
- } // for i
- // -Add Points-
- double px;
- sizePoints=bbGetInputInY2().size();
- for (i=0; i<sizePoints;i++)
+ pGF->deletePointAt(1); // EED here NOT 0 is 1
+ } // for i
+ // -Add Points-
+ double px;
+ sizePoints=bbGetInputInY().size();
+ for (i=0; i<sizePoints;i++)
+ {
+ if (i<bbGetInputInX().size())
+ {
+ px = bbGetInputInX()[i];
+ } else {
+ px = i;
+ }
+ pGF->AddNewPoint( px, bbGetInputInY()[i] );
+ }
+ }// if pGF
+
+ if (pGF2!=NULL)
{
- if (i<bbGetInputInX().size())
+ // -Erasing points-
+ int i,sizePoints = pGF2->getSizePoints();
+ for (i=0; i<sizePoints;i++)
+ {
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
+ pGF2->deletePointAt(1); // EED here NOT 0 is 1
+ #else
+ pGF2->deletePointAt(0); // EED here NOT 0 is 1
+ #endif
+ } // for i
+ // -Add Points-
+ double px;
+ sizePoints=bbGetInputInY2().size();
+ for (i=0; i<sizePoints;i++)
{
- px = bbGetInputInX()[i];
- } else {
- px = i;
- }
- pGF2->AddNewPoint( px, bbGetInputInY2()[i] );
- } // for
- }// if pGF
- mwxwidget->UpdateAll();
+ if (i<bbGetInputInX().size())
+ {
+ px = bbGetInputInX()[i];
+ } else {
+ px = i;
+ }
+ pGF2->AddNewPoint( px, bbGetInputInY2()[i] );
+ } // for
+ }// if pGF
+ */
+ mwxwidget->UpdateAll();
+ } else {
+ printf("EED Warnning... PlotterView::Process() Size of vecto X and Y is not coherent.\n");
+ } // InX.size InY.size
}
void PlotterView::bbUserSetDefaultValues()
{
mwxwidget = NULL;
- firsttime=true;
}
//-----------------------------------------------------------------
private:
pPlotterWindow *mwxwidget;
- bool firsttime;
-
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlotterView,bbtk::WxBlackBox);
modBarRange = modelBarRange;
mbbtkSliderMinMax = bbParent;
Connect(modBarRange->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onBarrange );
-// Connect(modBarRange->GetId(),98765,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onActualChange_Bar );
+ // Connect(modBarRange->GetId(),98765,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onActualChange_Bar );
Connect(modBarRange->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onActualChange_Bar );
Connect(modBarRange->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onStartChange_Bar );
Connect(modBarRange->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onEndChange_Bar );
void SliderMinMax::Process()
{
if (mwxwidget!=NULL){
+ mwxwidget -> setRepresentedValues( bbGetInputInMin(), bbGetInputInMax() );
if (firsttime==true)
{
firsttime=false;
mwxwidget -> SetStart(bbGetInputInMinShow());
mwxwidget -> SetEnd(bbGetInputInMaxShow());
}
- mwxwidget -> setRepresentedValues( bbGetInputInMin(), bbGetInputInMax() );
bbSetOutputOutStart(mwxwidget->GetStart());
bbSetOutputOutEnd(mwxwidget->GetEnd());
bbSetOutputOutActual(mwxwidget->GetActual());
std::vector<int> *nTypeView)
:wxMaracas_N_ViewersWidget(parent,imagedata,nTypeView)
{
- mbbViewerNV=box;
+ mbbViewerNV = box;
+ backX = -9999;
+ backY = -9999;
+ backZ = -9999;
}
//-------------------------------------------------------------
//-------------------------------------------------------------
void bbwxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event)
{
- //printf("CPR: bbwxMaracas_N_ViewersWidget::OnRefreshView -> actualiza X, Y y Z\n");
- mbbViewerNV->_point.clear();
-
- mbbViewerNV->_point.push_back( (int)GetX() );
- mbbViewerNV->_point.push_back( (int)GetY() );
- mbbViewerNV->_point.push_back( (int)GetZ() );
- mbbViewerNV->bbSetOutputPoint( mbbViewerNV->_point );
- mbbViewerNV->bbSignalOutputModification(std::string("Point"));
-
+ if ( (backX!=(int)GetX()) || (backY!=(int)GetY()) || (backZ!=(int)GetZ()) )
+ {
+ backX = GetX();
+ backY = GetY();
+ backZ = GetZ();
+ mbbViewerNV->_point.clear();
+ mbbViewerNV->_point.push_back( (int)GetX() );
+ mbbViewerNV->_point.push_back( (int)GetY() );
+ mbbViewerNV->_point.push_back( (int)GetZ() );
+ mbbViewerNV->bbSetOutputPoint( mbbViewerNV->_point );
+ mbbViewerNV->bbSignalOutputModification(std::string("Point"));
+ } // if
wxMaracas_N_ViewersWidget::OnRefreshView(event);
}
//-------------------------------------------------------------
void ViewerNV::Process()
{
- vtkImageData* img = bbGetInputIn();
- std::vector<int> type = bbGetInputnTypeView();
+ vtkImageData* img = bbGetInputIn();
+ std::vector<int> type = bbGetInputnTypeView();
if(img != NULL && _mwxwidget != NULL)
{
if(!compareVectors(type, _currenttype))
}else if (img != _currentimg){
_mwxwidget->SetImage(img);
}
- _mwxwidget->RefreshView();
+// _mwxwidget->RefreshView();
_currenttype = type;
_currentimg = img;
_point.clear();
- _point.push_back((int)_mwxwidget->GetX());
- _point.push_back((int)_mwxwidget->GetY());
- _point.push_back((int)_mwxwidget->GetZ());
- bbSetOutputPoint(_point);
- // WxBlackBox::Process();
-// mwxwidget->SetImage(img );
- wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView(1);
- wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView(2);
- wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView(3);
- wxVtkBaseView *wvbv4 = _mwxwidget->GetwxVtkBaseView(4);
+ _point.push_back( (int)_mwxwidget->GetX() );
+ _point.push_back( (int)_mwxwidget->GetY() );
+ _point.push_back( (int)_mwxwidget->GetZ() );
+ bbSetOutputPoint( _point );
+
+ wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView( 1 );
+ wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView( 2 );
+ wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView( 3 );
+ wxVtkBaseView *wvbv4 = _mwxwidget->GetwxVtkBaseView( 4 );
//wxwidget->RefreshView();
bbSetOutputwxVtkBaseView1( wvbv1 );
bbSetOutputwxVtkBaseView2( wvbv2 );
}
}
_mwxwidget->SetInterpolate( bbGetInputInterpolate() );
+/* Borrame
+ if (wvbv1!=NULL)
+ {
+ wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
+ wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
+ #else
+ wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
+ #endif
+ }
+
+*/
}// mwxwidget != NULL
}
//-----------------------------------------------------------------
-
-
-bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> currenttype){
-
+bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> currenttype)
+{
bool ret = true;
-
- if(type.size()==currenttype.size()){
- for(int i = 0; i < (int)(type.size()) && ret; i++){
- if(type[i]!=currenttype[i]){
+ if(type.size()==currenttype.size())
+ {
+ for(int i = 0; i < (int)(type.size()) && ret; i++)
+ {
+ if(type[i]!=currenttype[i])
+ {
ret = false;
- }
- }
+ } // if
+ } // for
}else{
ret=false;
- }
+ } // type size
return ret;
}
-void ViewerNV::updateObservers(){
+void ViewerNV::updateObservers()
+{
vtkRenderWindowInteractor* interactor;
interactor = bbGetOutputInteractor1();
- if(interactor){
- if (bbGetInputObs1()!=NULL){
+ if(interactor)
+ {
+ if (bbGetInputObs1()!=NULL)
+ {
bbGetInputObs1()->SetInteractor(interactor);
bbGetInputObs1()->EnabledOn();
}
bbGetInputObs5()->SetInteractor(interactor);
bbGetInputObs5()->EnabledOn();
}
- }
+ } // if interactor
}
}
public:
bbwxMaracas_N_ViewersWidget(ViewerNV* box,wxWindow *parent, vtkImageData* imagedata=NULL, std::vector<int> *nTypeView=NULL);
~bbwxMaracas_N_ViewersWidget();
-
//if the MPR had generated the refresh event
void OnRefreshView(wxCommandEvent &event);
void OnDClickLeft(wxCommandEvent &event);
private:
+ int backX;
+ int backY;
+ int backZ;
ViewerNV *mbbViewerNV;
DECLARE_EVENT_TABLE( );
};
}
//------------------------------------------------------------------------------------------------------------------------------------------
void AutoControlPoints::ChargeSpline( )
- {
+ {
int size = _controlpointsX.size();
if(size != 0)
{
{
_mContourModel->SetCloseContour(true);
}
-
_mContourModel->DeleteAllPoints();
_mContourModel->SetNumberOfPointsSpline(_numspline);
for(int i=0; i<size; i++)
spc[2]=1;
_pathsize = _mContourModel->GetPathSize( spc );
-
//printf("\nPATH SIZE = %f",_pathsize);
-
- std::ofstream file1;
- file1.open( "4_SplinePoints.txt" );
-
- for(int i = 0; i < numspline; i++){
- file1<<"X= "<<_chargecontrolpointsX[i] << "\tY= "<<_chargecontrolpointsY[i] << "\tZ= "<<_chargecontrolpointsZ[i]<<std::endl;
- }
- file1.close();
- }
+//EED 2020-03-31
+// std::ofstream file1;
+// file1.open( "4_SplinePoints.txt" );
+// for(int i = 0; i < numspline; i++)
+// {
+// file1<<"X= "<<_chargecontrolpointsX[i] << "\tY= "<<_chargecontrolpointsY[i] << "\tZ= "<<_chargecontrolpointsZ[i]<<std::endl;
+// } // for i
+// file1.close();
+
+ } // if size
}
//Given the coordinates of two points, it calculates the slope
//DELETE!!
- std::ofstream file1;
- file1.open( "1_Intersection.txt" );
-
- for(int i = 0; i < (int)(_intercircleX.size()); i++){
- file1<<"X= "<<_intercircleX[i] << "\tY= "<<_intercircleY[i] << "\tDist= "<<_intercircleDist[i]<<std::endl;
- }
- file1.close();
+//EED 2020-03-31
+// std::ofstream file1;
+// file1.open( "1_Intersection.txt" );
+// for(int i = 0; i < (int)(_intercircleX.size()); i++)
+// {
+// file1<<"X= "<<_intercircleX[i] << "\tY= "<<_intercircleY[i] << "\tDist= "<<_intercircleDist[i]<<std::endl;
+// } // for i
+// file1.close();
-
delete vecf;
}
//-----------------------------------------------------------------------------------------------------------------------------------------
}
vecf->copyVector(&tempZ,&_controlpointsZ);
-//JCP 26-09-08
- std::ofstream file1;
- file1.open( "2_MaxMin.txt" );
+//EED 2020-03-31
+////JCP 26-09-08
+// std::ofstream file1;
+// file1.open( "2_MaxMin.txt" );
+// for(int i = 0; i < (int)(_controlpointsX.size()); i++)
+// {
+// file1<<"X= "<<_controlpointsX[i] << "\tY= "<<_controlpointsY[i] << "\tZ= "<<_controlpointsZ[i]<<std::endl;
+// } // for i
+// file1.close();
+////JCP 26-09-08
- for(int i = 0; i < (int)(_controlpointsX.size()); i++){
- file1<<"X= "<<_controlpointsX[i] << "\tY= "<<_controlpointsY[i] << "\tZ= "<<_controlpointsZ[i]<<std::endl;
- }
- file1.close();
-//JCP 26-09-08
delete vecf;
}
//-----------------------------------------------------------------------------------------------------------------------------------------
vecf->copyVector(&tempY,&_controlpointsY);
vecf->copyVector(&tempZ,&_controlpointsZ);
- std::ofstream file1;
- file1.open( "3_PointsFixed.txt" );
-
- for(int i = 0; i < (int)(_controlpointsX.size()); i++){
- file1<<"X= "<<_controlpointsX[i] << "\tY= "<<_controlpointsY[i] << "\tZ= "<<_controlpointsZ[i]<<std::endl;
- }
- file1.close();
+//EED 2020-03-31
+// std::ofstream file1;
+// file1.open( "3_PointsFixed.txt" );
+// for(int i = 0; i < (int)(_controlpointsX.size()); i++)
+// {
+// file1<<"X= "<<_controlpointsX[i] << "\tY= "<<_controlpointsY[i] << "\tZ= "<<_controlpointsZ[i]<<std::endl;
+// } // for i
+// file1.close();
delete vecf;
}
nearp = distA;
_posn = _posA;
- }
- else
- {
+ } else {
nearp = distB;
_posn = _posB;
- }
- }
+ } // if dist
+ } // if interpointsX
}
//-----------------------------------------------------------------------------------------------------------------------------------------
void AutoControlPoints::MoveControlPointInContour(std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ)
_controlpointsX.push_back( (*InX)[_contIncontpos[_posn]] );
_controlpointsY.push_back( (*InY)[_contIncontpos[_posn]] );
_controlpointsZ.push_back( (*InZ)[_contIncontpos[_posn]] );
- }
- else
- {
+ } else {
_controlpointsX.push_back( tempX[i] );
_controlpointsY.push_back( tempY[i] );
_controlpointsZ.push_back( tempZ[i] );
- }
- }
+ } // if i
+ } // for
fixBetweenPoints(5.0);
PossibleIntersections(InX,InY,InZ);
_controlpointsX.push_back( (*InX)[_contIncontpos[posact]] );
_controlpointsY.push_back( (*InY)[_contIncontpos[posact]] );
_controlpointsZ.push_back( (*InZ)[_contIncontpos[posact]] );
- }
- else
- {
+ } else {
_controlpointsX.push_back( tempX[i] );
_controlpointsY.push_back( tempY[i] );
_controlpointsZ.push_back( tempZ[i] );
- }
- }
+ } // if i
+ } // for i
if(direction == 1)
{
posact = posact+1;
ErrorBetweenContours();
promactual1 = vf->promVector(&_errorvector,false);
j--;
- }
- }
+ } // if j
+ }// for i
delete vf;
}
return 99999;
int inicontrolpoints = cpX.size();
double inipercentage = (inicontrolpoints*100)/InX->size();
int h=0;
+
if(inicontrolpoints<10)
{
int points = (int)((inipercentage*3*InX->size())/100);
_controlpointsY.push_back( (*InY)[i] );
_controlpointsZ.push_back( (*InZ)[i] );
h = 0;
- }
- }
- }
+ } // if h
+ } // for i
+ } // if initontrolpoints
+
if(inicontrolpoints>=10)
{
int points = (int)((inipercentage*2*InX->size())/100);
_controlpointsY.push_back( (*InY)[i] );
_controlpointsZ.push_back( (*InZ)[i] );
h = 0;
- }
- }
- }
+ } // if h
+ } // for int i
+ } // if inicontrolpoints
}
/*
fixBetweenPoints(5.0);
//-----------------------------------------------------------------------------------------------------------------------------------------
void AutoControlPoints::CalculeInitialControlPoints(std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ)
{
-
_controlpointsX.clear();
_controlpointsY.clear();
_controlpointsZ.clear();
//-----------------------------------------------------------------------------------------
void ExtractControlPoints2D::SetContour(std::vector<double>*InX, std::vector<double>*InY,std::vector<double>*InZ)
{
+ int i;
_InX.clear();
_InY.clear();
_InZ.clear();
int sizeZ = InZ->size();
if( (sizeX == sizeY) && (sizeY==sizeZ) )
{
- for(int i=0; i<sizeX; i++)
+ for(i=0; i<sizeX; i++)
{
_InX.push_back( (*InX)[i] );
_InY.push_back( (*InY)[i] );
_InZ.push_back( (*InZ)[i] );
- }
- }
- else
- {
+ } // for i
+ } else {
printf("\n The lists Of vectors have diferents sizes");
}
}
{
if (GetBaseColorNb() != (int)_grey_level_boundary.size()-1)
{
- std::cout << "CM ColorLayerImageView::ConfigLookupTable : ERROR!!! Inconsistency between the sizes of vectors _base_color and _grey_level_boundary. _base_color.size()/3 (=" <<_base_color.size()/3 << ") should be equal to _grey_level_boundary.size()+1 (=" << _grey_level_boundary.size()<<"+1)." << std::endl;
- std::cout << "CM The default values for the base colors and the grey level boundaries will be set." << std::endl;
+//EED std::cout << "CM ColorLayerImageView::ConfigLookupTable : ERROR!!! Inconsistency between the sizes of vectors _base_color and _grey_level_boundary. _base_color.size()/3 (=" <<_base_color.size()/3 << ") should be equal to _grey_level_boundary.size()+1 (=" << _grey_level_boundary.size()<<"+1)." << std::endl;
+//EED std::cout << "CM The default values for the base colors and the grey level boundaries will be set." << std::endl;
SetDefaultGreyLevelBoundary();
} // if
} // _color_type
{
if (GetBaseColorNb() != (int)_grey_level_boundary.size())
{
- std::cout << "CM ColorLayerImageView::ConfigLookupTable : ERROR!!! Inconsistency between the sizes of vectors _base_color and _grey_level_boundary. _base_color.size()/3 (=" <<_base_color.size()/3 << ") should be equal to _grey_level_boundary.size() (=" << _grey_level_boundary.size()<<")." << std::endl;
- std::cout << "CM The default values for the base colors and the grey level boundaries will be set." << std::endl;
+//EED std::cout << "CM ColorLayerImageView::ConfigLookupTable : ERROR!!! Inconsistency between the sizes of vectors _base_color and _grey_level_boundary. _base_color.size()/3 (=" <<_base_color.size()/3 << ") should be equal to _grey_level_boundary.size() (=" << _grey_level_boundary.size()<<")." << std::endl;
+//EED std::cout << "CM The default values for the base colors and the grey level boundaries will be set." << std::endl;
SetDefaultGreyLevelBoundary();
} // if
} // _color_type
thresholdTable_range[0]= GetGreyLevelBoundaries(0);
thresholdTable->SetTableRange(thresholdTable_range);
+
+ thresholdTable->SetBelowRangeColor(1,1,1,0); // White transparent
+ thresholdTable->SetAboveRangeColor(1,1,1,0); // White transparent
+ thresholdTable->UseBelowRangeColorOn();
+ thresholdTable->UseAboveRangeColorOn();
+
thresholdTable->SetAlphaRange( 0,1 );
thresholdTable->SetValueRange( 0,1 );
return NULL;
}
+//----------------------------------------------------------------------------
+vtkLookupTable* ColorLayerImageViewManager::GetLookupTable(int id)
+{
+ if (_colorLayerImageViewLst[id]!=NULL)
+ {
+ return _colorLayerImageViewLst[id]->GetThresholdTable( );
+ } // if
+ return NULL;
+}
+
//----------------------------------------------------------------------------
void ColorLayerImageViewManager::GetDimensionBase(int id,int *dim)
{
} // if
}
-//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void ColorLayerImageViewManager::SetNewSpacingLayer(double *spc)
{
}
-
// EOF
void GetSpcOriginalLayer (int id,double *spc);
void SetNewSpacingLayer (double *spc);
+ vtkLookupTable* GetLookupTable(int id);
private:
std::vector< ColorLayerImageView* > _colorLayerImageViewLst;
lstOptOperation[1]=_T("Keep the spacing of the Layer Image");
lstOptOperation[2]=_T("Use the same spacing of the Base Image");
-
-
wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of spacing transformation"), wxDefaultPosition, wxSize(250,160), 3 , lstOptOperation, 1, wxRA_SPECIFY_COLS);
wxString str;
**/
ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max,int opacity, int type)
//: wxPanel(parent, -1, wxDefaultPosition, wxSize(600,100), wxBORDER_SUNKEN)
-
: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
-
-
{
-
_spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
_dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
-
_cb_ShowHide = NULL;
_sl_SliceImageX = NULL;
_sl_SliceImageY = NULL;
_sl_SliceImageZ = NULL;
_histogram = NULL;
_histogramMinMaxLevel = NULL;
-
wxFlexGridSizer * sizer = NULL;
_colorLayerImageViewManager = new ColorLayerImageViewManager();
-
if (type==1)
{
sizer = new wxFlexGridSizer(1);
} // type==1
-
if (type==2)
{
sizer = new wxFlexGridSizer(2);
_interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpolate") );
_interpolationCheckBox->SetValue(true);
_opacity = new wxSlider(this, wxID_ANY, opacity, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
// sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level")) , 1, wxEXPAND );
} // type==2
-
this->SetSizer( sizer );
// this->SetAutoLayout( true );
// this->Layout();
{
}
-
//----------------------------------------------------------------------------
ColorLayerImageViewManager* ColorLayerImageViewPanel::GetColorLayerImageViewManager()
{
return _colorLayerImageViewManager;
}
-
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
{
if (img!=NULL)
- {
-
+ {
if (_histogramMinMaxLevel!=NULL)
{
_histogramMinMaxLevel->Configure( img );
}
_colorLayerImageViewManager->SetImage( img );
-
double spcOriginalLayer[3];
int dimensionOriginalLayer[3];
-
double spcBase[3];
int dimensionBase[3];
-
double newSpc[3];
-
GetColorLayerImageViewManager()->GetSpcOriginalLayer(0,spcOriginalLayer);
GetColorLayerImageViewManager()->GetDimensionOriginalLayer(0,dimensionOriginalLayer);
-
GetColorLayerImageViewManager()->GetSpcBase(0,spcBase);
GetColorLayerImageViewManager()->GetDimensionBase(0,dimensionBase);
-
if (_sl_SliceImageX!=NULL)
{
_sl_SliceImageX->SetRange( 0 , dimensionOriginalLayer[0] );
_sl_SliceImageZ->SetRange( 0 , dimensionOriginalLayer[2] );
}
-
if ( (spcOriginalLayer[0]!=spcBase[0]) ||
(spcOriginalLayer[1]!=spcBase[1]) ||
(spcOriginalLayer[2]!=spcBase[2]) ||
{
_colorLayerImageViewManager->onThreshold();
RefreshView();
- } // _ative
-
+ } // _ative
}
-
void ColorLayerImageViewPanel::RefreshView()
{
//EED01 _colorLayerImageView->Refresh();
// w.ShowModal();
printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n");
- creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog();
- SetImage( diag.getImageData() );
+ int ext[6];
+ double spc[6];
+ double origin[3];
+ origin[0] = 0;
+ origin[1] = 0;
+ origin[2] = 0;
+
+ creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog();
+ vtkImageChangeInformation *change = vtkImageChangeInformation::New();
+ vtkImageData *img = diag.getImageData();
+ img -> GetExtent( ext );
+ img -> GetSpacing( spc );
+ change -> SetInputData( img );
+ change -> SetOutputSpacing( spc[0] , spc[1] , spc [2] );
+ change -> SetOutputExtentStart(0,0,0);
+ change -> SetOutputOrigin( origin );
+ change -> Modified(); //important
+ change -> Update(); //important
+ SetImage( change->GetOutput() );
+ _colorLayerImageViewManager->onThreshold();
+ RefreshView();
}
//----------------------------------------------------------------------------
if (_thresholdGo)
{
_colorLayerImageViewManager->onThresholdChange();
- RefreshView();
+ RefreshView();
//std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl;
} // _thresholdGo
}
RefreshView();
}
+//----------------------------------------------------------------------------
+int ColorLayerImageViewPanel::GetOpacity()
+{
+ return _opacity->GetValue();
+}
+
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::ChangeOpacity()
{
ColorLayerImageViewPanel(wxWindow * parent, int min, int max,int opacity, int type);
~ColorLayerImageViewPanel();
void onThresholdStop();
- void ChangeOpacity();
+ int GetOpacity();
+ virtual void ChangeOpacity();
ColorLayerImageViewManager* GetColorLayerImageViewManager();
//EED01 ColorLayerImageView* GetColorLayerImageView();
//EED01 void SetColorLayerImageView(ColorLayerImageView* colorLayerImageView);
void SetFittingMode(int fitting_mode);
int GetFittingMode();
void SetActive(bool active);
+ void RefreshView();
private:
bool _active;
void onChangeOpacity(wxScrollEvent& event);
void onSliceFixDinamic(wxCommandEvent& event);
void onSliceImage(wxScrollEvent& event);
- void RefreshView();
};
#endif
} // if imagebase
} // if wxvtkbaseview
_image->GetScalarRange( _range );
- _thresholdTable = vtkLookupTable::New();
+// _thresholdTable = vtkLookupTable::New();
//EED 2017-01-01 Migration VTK7
_newSpcLayer[1] = spc[1];
_newSpcLayer[2] = spc[2];
_imageChangeInformation->SetOutputSpacing( _newSpcLayer );
-
+_imageChangeInformation->Update();
}
dim[2] = _dimBase[2];
}
-
//------------------------------------------------------------------------------
void LayerImageBase::SetColorBarPosition(std::vector<int> &colorbarposition)
{
_colorBarPosition=colorbarposition;
+ UpdateColorBarPosition();
}
+//------------------------------------------------------------------------------
+void LayerImageBase::UpdateColorBarPosition()
+{
+ if ( _scalarbarActor!=NULL)
+ {
+ if (_colorBarPosition.size()==2)
+ {
+ _scalarbarActor->SetDisplayPosition( _colorBarPosition[0] , _colorBarPosition[1] );
+ } else {
+ _scalarbarActor->SetDisplayPosition(0,0);
+ }
+ } // if
+}//
+
//------------------------------------------------------------------------------
void LayerImageBase::SetRangeForColorBar(std::vector<double> &range)
{
{
z = maxSize;
}
-
}
//----------------------------------------------------------------------------
{
_thresholdActor = vtkImageActor::New( );
_scalarbarActor = vtkScalarBarActor::New();
- if (_colorBarPosition.size()==2)
- {
- _scalarbarActor->SetDisplayPosition(_colorBarPosition[0],_colorBarPosition[1]);
- } else {
- _scalarbarActor->SetDisplayPosition(0,0);
- }
+ UpdateColorBarPosition();
_scalarbarActor->SetHeight(0.4); //default 0.8
- _scalarbarActor->SetWidth(0.08); //default 0.17
-
+ _scalarbarActor->SetWidth(0.10); //default 0.17
_thresholdActor->SetOpacity( 1 );
_thresholdActor->InterpolateOn( );
-
if (directionViewer==0)
{
_thresholdActor->SetPosition( 900-1,0,0 );
#else
_thresholdMapper->SetInputData( img );
#endif
-
_thresholdMapper->SetLookupTable( _thresholdTable );
wxVtkBaseView * baseView = _baseView;
baseView->GetRenderer()->RemoveActor( _thresholdActor );
baseView->GetRenderer()->RemoveActor( _scalarbarActor );
-
_actorPresent = false;
} // if _actorPresent
}
-//----------------------------------------------------------------------------
-vtkLookupTable *LayerImageBase::GetvtkLookupTable()
-{
- return _thresholdTable;
-}
-
//----------------------------------------------------------------------------
vtkImageReslice *LayerImageBase::GetvtkImageReslice()
{
_range[1]=max;
}
+vtkScalarsToColors* LayerImageBase::GetLookupTable()
+{
+ return _thresholdTable;
+}
+
// EOF
#include "InteractorStyleMaracas.h"
#include "vtkImageChangeInformation.h"
-
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
void SetRangeForColorBar(std::vector<double> &range);
void GetRangeForColorBar(double &minRange, double &maxRange);
void SetColorBarPosition(std::vector<int> &colorbarposition);
+ void UpdateColorBarPosition();
void SetwxVtkBaseView(wxVtkBaseView *baseview);
void onThreshold();
void onThresholdRemove();
wxVtkBaseView *GetwxVtkBaseView();
void Refresh();
- vtkLookupTable *GetvtkLookupTable();
+ vtkLookupTable *GetThresholdTable();
+
vtkImageReslice *GetvtkImageReslice();
virtual int GetX();
virtual int GetY();
void GetDimensionBase(int *dim);
void GetSpcOriginalLayer(double *spc);
void GetSpcBase(double *spc);
+ vtkScalarsToColors* GetLookupTable();
private:
int _X;
void CleanXYZ(double &x, double &y, double &z);
protected:
- vtkLookupTable *GetThresholdTable();
double _range[2];
std::vector<double> _rangeForColorBar;
std::vector<int> _colorBarPosition;
int minVal = floor (_minValue);
int maxVal = floor (_maxValue);
- vtkLookupTable* thresholdTable = GetThresholdTable();
- thresholdTable->SetNumberOfTableValues(maxTot+1);
- thresholdTable->SetTableRange(range);
+ vtkLookupTable *thresholdTable = GetThresholdTable();
+ thresholdTable->SetNumberOfTableValues( (maxTot-minTot) );
thresholdTable->SetAlphaRange(0, 1);
thresholdTable->SetValueRange(0, 1);
thresholdTable->SetSaturationRange(0, 0);
//Assign a fake color for the upper image, and set the white as transparent
int i;
- for(i = minTot; i <= maxTot; i++)
+ int minVal2;
+ int maxVal2;
+ int minTot2;
+ int maxTot2;
+
+ minVal2=minVal-minTot;
+ maxVal2=maxVal-minTot;
+ minTot2=minTot-minTot;
+ maxTot2=maxTot-minTot;
+
+// thresholdTable->SetTableRange(minVal,maxVal);
+//EED You need to do this loop just the first time
+// for(i = minTot2; i <= maxTot2; i++)
+// {
+// thresholdTable->SetTableValue(i,_baseColorR,_baseColorG,_baseColorB, 1);
+// } // for
+
+ thresholdTable->SetTableRange(range);
+ for(i = minTot2; i <= maxTot2; i++)
{
- if( i >= minVal && i <= maxVal )
+ if( i >= minVal2 && i <= maxVal2 )
{
thresholdTable->SetTableValue(i,_baseColorR,_baseColorG,_baseColorB, 1);
- }
- else if( i >= minTot && i < minVal )
+ } else if( i >= minTot2 && i < minVal2 )
{
thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
- }
- else if( i > maxVal && i < maxTot )
+ } else if( i > maxVal2 && i < maxTot2 )
{
thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
- }
- else
- {
+ } else {
thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
}
} // for
thresholdTable->Build( );
-
}
#include "image3DDequeUR.h"
#include <iostream>
#include <sstream>
+#include <ctime>
// ----------------------------------------------------------------------------------
Image3DDequeUR::Image3DDequeUR( )
{
-
+ const void * address = static_cast<const void*>(this);
+ std::stringstream ss;
+ ss << address;
+ m_PrivateID = ss.str();
#ifdef _WIN32
this->m_GlobalPath = std::getenv("TEMP");
#endif // MACOSX
this->m_CurrentURPos = -1;
}
+
// ----------------------------------------------------------------------------------
//virtual
Image3DDequeUR::~Image3DDequeUR( )
{
this->CleanHardDisk( );
}
+
// ----------------------------------------------------------------------------------
//virtual
void Image3DDequeUR::AddImagesToURContainer( VTKImageDataPointerType imgUndo,
imageInfo->SetImageName( this->GetImageName( this->m_ImgURDeque.size( ) ) );
imageInfo->SetImages( imgUndo, imgRedo );
imageInfo->SetImageMManager( imMManager );
+
//Adding to deque
this->m_ImgURDeque.push_back( imageInfo );
this->m_CurrentURPos = this->m_ImgURDeque.size( ) - 1;
//Managing memory
this->ManageMemory( );
}
+
// ----------------------------------------------------------------------------------
//virtual
ImageInfoUR* Image3DDequeUR::Undo( )
} //fi
return ( imgRet );
}
+
// ----------------------------------------------------------------------------------
//virtual
ImageInfoUR* Image3DDequeUR::Redo( )
&& ( this->m_CurrentURPos < imgURDequeSize ) )
{
imgRet = this->m_ImgURDeque[ m_CurrentURPos ];
- } //fi
- else
- {
+ } else {
this->m_CurrentURPos--;
}
return ( imgRet );
}
+
// ----------------------------------------------------------------------------------
//virtual
void Image3DDequeUR::CleanURContainerFromIndex( const int& index )
this->m_ImgURDeque.pop_back( );
} //rof
}
+
// ----------------------------------------------------------------------------------
//virtual
void Image3DDequeUR::ManageMemory( )
{
int imgURDequeSize = this->m_ImgURDeque.size( );
- for( int i = 0; i < imgURDequeSize; i++ )
+ int i;
+ for( i = 0; i < imgURDequeSize; i++ )
{
if( this->m_ImgURDeque[ i ]->GetStatus( ) )
{
- this->m_ImgURDeque[ i ]->RemoveImagesFromMemory(
- this->m_GlobalPath );
- } //fi
- } //rof
+ this->m_ImgURDeque[ i ]->RemoveImagesFromMemory( this->m_GlobalPath );
+ } // if Status
+ } // for i
//Adding CurrentUndoPos to memory
- if( ( this->m_CurrentURPos != -1 )
- && !( this->m_ImgURDeque[ this->m_CurrentURPos ]->GetStatus( ) ) )
+ if( ( this->m_CurrentURPos != -1 ) && !( this->m_ImgURDeque[ this->m_CurrentURPos ]->GetStatus( ) ) )
{
- this->m_ImgURDeque[ this->m_CurrentURPos ]->LoadImagesToMemory(
- this->m_GlobalPath );
+ this->m_ImgURDeque[ this->m_CurrentURPos ]->LoadImagesToMemory( this->m_GlobalPath );
}
int currentRedoPos = this->m_CurrentURPos + 1;
- if( ( currentRedoPos < imgURDequeSize )
- && !( this->m_ImgURDeque[ currentRedoPos ]->GetStatus( ) ) )
+ if( ( currentRedoPos < imgURDequeSize ) && !( this->m_ImgURDeque[ currentRedoPos ]->GetStatus( ) ) )
{
- this->m_ImgURDeque[ currentRedoPos ]->LoadImagesToMemory(
- this->m_GlobalPath );
+ this->m_ImgURDeque[ currentRedoPos ]->LoadImagesToMemory( this->m_GlobalPath );
}
}
+
// ----------------------------------------------------------------------------------
void Image3DDequeUR::SetGlobalPath( const StringType& globalPath )
{
this->m_GlobalPath = globalPath;
}
+
// ----------------------------------------------------------------------------------
void Image3DDequeUR::CleanHardDisk( )
{
this->m_ImgURDeque[ i ]->RemoveImagesFromDisk( this->m_GlobalPath );
}
}
+
// ----------------------------------------------------------------------------------
Image3DDequeUR::StringType Image3DDequeUR::GetGlobalPath( )
{
return ( this->m_GlobalPath );
}
+
// ----------------------------------------------------------------------------------
Image3DDequeUR::StringType Image3DDequeUR::GetImageName( const int & pos )
{
//Giving a name to an image using the date and time
if( this->m_IDImages.empty( ) )
{
- time_t rawtime;
- struct tm * timeinfo;
- char buffer[ 80 ];
+ time_t rawtime;
+ struct tm *timeinfo;
+ char buffer[ 80 ];
time( &rawtime );
timeinfo = localtime( &rawtime );
strftime( buffer, 80, "%H%M%S_%a_%d_%b_%y_", timeinfo );
}
std::stringstream ss; //create a stringstream
ss << pos; //add number to the stream
- StringType imageName = this->m_IDImages + ss.str( );
+ StringType imageName = this->m_IDImages + ss.str( )+ "_"+m_PrivateID;
return ( imageName );
}
+
// ----------------------------------------------------------------------------------
#ifndef IMAGE3DDEQUEUR_H_
#define IMAGE3DDEQUEUR_H_
+#include <deque>
+
#include "imageDequeUR.h"
-#include <ctime>
+
+
/*! @class Image3DDequeUR image3DDequeUR.h "image3DDequeUR.cxx"
* @brief This class contains the management of the undo/redo deque - Concrete Class
void CleanHardDisk();
// ----------------------------------------------------------------------------------
protected:
- ImageInfoDeque m_ImgURDeque; //!<This is the container of the images for undo and redo.
- int m_CurrentURPos; //!<This is the index where is located the undo and redo state.
- StringType m_GlobalPath; //!<This is the string with the global path.
- StringType m_IDImages; //!<This is the string with the ID of the images (For the filenames).
+ ImageInfoDeque m_ImgURDeque; //!<This is the container of the images for undo and redo.
+ int m_CurrentURPos; //!<This is the index where is located the undo and redo state.
+ StringType m_GlobalPath; //!<This is the string with the global path.
+ StringType m_IDImages; //!<This is the string with the ID of the images (For the filenames).
+ StringType m_PrivateID; //!<This is the string with the private ID of the images (For the filenames).
};
#endif /* IMAGE3DDEQUEUR_H_ */
#include "imageDequeUR.h"
// ----------------------------------------------------------------------------------
-ImageDequeUR::ImageDequeUR() {
-
+ImageDequeUR::ImageDequeUR()
+{
}
-// ----------------------------------------------------------------------------------
-ImageDequeUR::~ImageDequeUR() {
-}
// ----------------------------------------------------------------------------------
-void ImageDequeUR::AddImagesToURContainer(VTKImageDataPointerType imgUndo,
- VTKImageDataPointerType imgRedo, ImageMManager* imMManager) {
+ImageDequeUR::~ImageDequeUR()
+{
}
-// ----------------------------------------------------------------------------------
-void ImageDequeUR::CleanURContainerFromIndex(const int& index) {
+// ----------------------------------------------------------------------------------
+void ImageDequeUR::AddImagesToURContainer( VTKImageDataPointerType imgUndo,
+ VTKImageDataPointerType imgRedo,
+ ImageMManager* imMManager)
+{
}
+
// ----------------------------------------------------------------------------------
-void ImageDequeUR::ManageMemory() {
+void ImageDequeUR::CleanURContainerFromIndex(const int& index)
+{
+}
+// ----------------------------------------------------------------------------------
+void ImageDequeUR::ManageMemory()
+{
}
+
// ----------------------------------------------------------------------------------
-ImageInfoUR* ImageDequeUR::Undo() {
+ImageInfoUR* ImageDequeUR::Undo()
+{
return NULL;
}
+
// ----------------------------------------------------------------------------------
-ImageInfoUR* ImageDequeUR::Redo() {
+ImageInfoUR* ImageDequeUR::Redo()
+{
return NULL;
}
+
// ----------------------------------------------------------------------------------
#ifndef IMAGEDEQUE_H_
#define IMAGEDEQUE_H_
-#include <iostream>
-#include <string>
-#include <deque>
-#include <vtkImageData.h>
-#include <vtkSmartPointer.h>
#include "imageInfoUR.h"
-#include "imageModificationManager.h"
/*! @class ImageDequeUR imageDequeUR.h "imageDequeUR.cxx"
* @brief This class contains the management of the undo/redo - Abstract Class
#include "imageInfoUR.h"
// ----------------------------------------------------------------------------------
-ImageInfoUR::ImageInfoUR() {
- this->m_OnMemory = false;
- this->m_OnDisk = false;
+ImageInfoUR::ImageInfoUR()
+{
+ this->m_OnMemory = false;
+ this->m_OnDisk = false;
}
+
// ----------------------------------------------------------------------------------
-ImageInfoUR::~ImageInfoUR() {
+ImageInfoUR::~ImageInfoUR()
+{
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::SetImageName(const StringType &imgName) {
- this->m_ImageName = imgName;
+void ImageInfoUR::SetImageName(const StringType &imgName)
+{
+ this->m_ImageName = imgName;
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::SetImageMManager(ImageMManagerType* imMManager) {
- this->m_ImageMManager = imMManager;
+void ImageInfoUR::SetImageMManager(ImageMManagerType* imMManager)
+{
+ this->m_ImageMManager = imMManager;
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::SetStatus(const bool& onMemory) {
- this->m_OnMemory = onMemory;
+void ImageInfoUR::SetStatus(const bool& onMemory)
+{
+ this->m_OnMemory = onMemory;
}
+
// ----------------------------------------------------------------------------------
-ImageInfoUR::StringType ImageInfoUR::GetImageName() {
+ImageInfoUR::StringType ImageInfoUR::GetImageName()
+{
return (this->m_ImageName);
}
+
// ----------------------------------------------------------------------------------
-ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetUndoImage() {
+ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetUndoImage()
+{
return (this->m_UndoImage);
}
+
// ----------------------------------------------------------------------------------
-ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetRedoImage() {
+ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetRedoImage()
+{
return (this->m_RedoImage);
}
+
// ----------------------------------------------------------------------------------
-ImageInfoUR::ImageMManagerType* ImageInfoUR::GetImageMManager() {
+ImageInfoUR::ImageMManagerType* ImageInfoUR::GetImageMManager()
+{
return (this->m_ImageMManager);
}
+
// ----------------------------------------------------------------------------------
-bool ImageInfoUR::GetStatus() {
+bool ImageInfoUR::GetStatus()
+{
return (this->m_OnMemory);
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::SetImages(VTKImageDataPointerType imgUndo,
- VTKImageDataPointerType imgRedo) {
+void ImageInfoUR::SetImages(VTKImageDataPointerType imgUndo, VTKImageDataPointerType imgRedo)
+{
this->m_UndoImage = imgUndo;
this->m_RedoImage = imgRedo;
this->SetStatus(true);
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) {
+void ImageInfoUR::LoadImagesToMemory(const StringType& gPath)
+{
//setting paths
- StringType filename = gPath + this->m_ImageName;
- StringType undoImagePath = filename + "_Undo.mhd";
- StringType redoImagePath = filename + "_Redo.mhd";
+ StringType filename = gPath + this->m_ImageName;
+ StringType undoImagePath = filename + "_Undo.mhd";
+ StringType redoImagePath = filename + "_Redo.mhd";
//Loading Undo Image
- VTKMetaImageReaderPointerType readerUndo =
- VTKMetaImageReaderPointerType::New();
+ VTKMetaImageReaderPointerType readerUndo = VTKMetaImageReaderPointerType::New();
readerUndo->SetFileName(undoImagePath.c_str());
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ // ..
+#else
+ readerUndo->Update();
+#endif
+
this->m_UndoImage = readerUndo->GetOutput();
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
this->m_UndoImage->Update();
#else
- // ..
+ this->m_UndoImage->Modified();
#endif
//Loading Redo Image
- VTKMetaImageReaderPointerType readerRedo =
- VTKMetaImageReaderPointerType::New();
+ VTKMetaImageReaderPointerType readerRedo = VTKMetaImageReaderPointerType::New();
readerRedo->SetFileName(redoImagePath.c_str());
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
#if VTK_MAJOR_VERSION <= 5
this->m_RedoImage->Update();
#else
- // ...
+ this->m_RedoImage->Modified();
#endif
//Updating status
this->m_OnMemory = true;
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath) {
- if (!this->m_OnDisk) {
+void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath)
+{
+ if (!this->m_OnDisk)
+ {
this->SaveImagesOnDisk(gPath);
}
this->m_UndoImage = NULL;
this->m_RedoImage = NULL;
this->SetStatus(false);
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::SaveImagesOnDisk(const StringType& gPath) {
- this->m_OnDisk = true;
- StringType filename = gPath + this->m_ImageName;
- StringType undoImagePath = filename + "_Undo.mhd";
- StringType redoImagePath = filename + "_Redo.mhd";
+void ImageInfoUR::SaveImagesOnDisk(const StringType& gPath)
+{
+ printf("EED ImageInfoUR::SaveImagesOnDisk Start \n");
+ this->m_OnDisk = true;
+ StringType filename = gPath + this->m_ImageName;
+ StringType undoImagePath = filename + "_Undo.mhd";
+ StringType redoImagePath = filename + "_Redo.mhd";
this->SaveImageAsMHD(undoImagePath, this->m_UndoImage);
this->SaveImageAsMHD(redoImagePath, this->m_RedoImage);
+ printf("EED ImageInfoUR::SaveImagesOnDisk %s \n", undoImagePath.c_str() );
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::RemoveImagesFromDisk(const StringType& gPath) {
- StringType filename = gPath + this->m_ImageName;
+void ImageInfoUR::RemoveImagesFromDisk(const StringType& gPath)
+{
+ StringType filename = gPath + this->m_ImageName;
StringType undoImagePathMHD = filename + "_Undo.mhd";
StringType redoImagePathMHD = filename + "_Redo.mhd";
StringType undoImagePathRAW = filename + "_Undo.raw";
remove(undoImagePathRAW.c_str());
remove(redoImagePathRAW.c_str());
}
+
// ----------------------------------------------------------------------------------
-void ImageInfoUR::SaveImageAsMHD(const StringType& filename,
- VTKImageDataPointerType image) {
+void ImageInfoUR::SaveImageAsMHD(const StringType& filename, VTKImageDataPointerType image)
+{
VTKMetaImageWriterPointerType w = VTKMetaImageWriterPointerType::New();
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
bool GetStatus();
// ----------------------------------------------------------------------------------
private:
- VTKImageDataPointerType m_UndoImage; //!<This is the undo image.
- VTKImageDataPointerType m_RedoImage; //!<This is the redo image
- StringType m_ImageName; //!<This is the base name of the images.
- ImageMManagerType* m_ImageMManager; //!<This is the modification manager of the images.
- bool m_OnMemory; //!<This is true if the images are in memory.
- bool m_OnDisk; //!<This is true if the images are in disk.
-
+ VTKImageDataPointerType m_UndoImage; //!<This is the undo image.
+ VTKImageDataPointerType m_RedoImage; //!<This is the redo image
+ StringType m_ImageName; //!<This is the base name of the images.
+ ImageMManagerType *m_ImageMManager; //!<This is the modification manager of the images.
+ bool m_OnMemory; //!<This is true if the images are in memory.
+ bool m_OnDisk; //!<This is true if the images are in disk.
};
#endif /* IMAGEINFO_H_ */
#include "imageModificationManager.h"
// ----------------------------------------------------------------------------------
-ImageMManager::ImageMManager() {
-
+ImageMManager::ImageMManager()
+{
+ baseInitialPointX=-9999;
+ baseInitialPointY=-9999;
+ baseInitialPointZ=-9999;
}
+
// ----------------------------------------------------------------------------------
-ImageMManager::ImageMManager(ImageMManager* manager) {
- this->m_RegionStruct = manager->GetModifiedRegion();
+ImageMManager::ImageMManager(ImageMManager* manager)
+{
+ this->m_RegionStruct = manager->GetModifiedRegion();
+ this->m_ValidRegion = manager->ValidateRegion();
+ this->baseInitialPointX = manager->GetBaseInitialPointX();
+ this->baseInitialPointY = manager->GetBaseInitialPointY();
+ this->baseInitialPointZ = manager->GetBaseInitialPointZ();
}
// ----------------------------------------------------------------------------------
-ImageMManager::~ImageMManager() {
-
+ImageMManager::~ImageMManager()
+{
}
-// ----------------------------------------------------------------------------------
-void ImageMManager::CleanModifiedRegion() {
- int min = std::numeric_limits<int>::min();
- int max = std::numeric_limits<int>::max();
- this->m_RegionStruct.minX = max;
- this->m_RegionStruct.maxX = min;
- this->m_RegionStruct.minY = max;
- this->m_RegionStruct.maxY = min;
- this->m_RegionStruct.minZ = max;
- this->m_RegionStruct.maxZ = min;
- this->m_ValidRegion = false;
+// ----------------------------------------------------------------------------------
+void ImageMManager::CleanModifiedRegion()
+{
+ int min = std::numeric_limits<int>::min();
+ int max = std::numeric_limits<int>::max();
+ this->m_RegionStruct.minX = max;
+ this->m_RegionStruct.maxX = min;
+ this->m_RegionStruct.minY = max;
+ this->m_RegionStruct.maxY = min;
+ this->m_RegionStruct.minZ = max;
+ this->m_RegionStruct.maxZ = min;
+ this->m_ValidRegion = false;
}
+
// ----------------------------------------------------------------------------------
-void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j,
- const int& k) {
- if (i >= 0 && j >= 0 && k >= 0) {
- if (i <= this->m_RegionStruct.minX) {
- this->m_RegionStruct.minX = i;
- } //fi
- if (i > this->m_RegionStruct.maxX) {
- this->m_RegionStruct.maxX = i;
- } //esle
- if (j <= this->m_RegionStruct.minY) {
- this->m_RegionStruct.minY = j;
- } //fi
- if (j > this->m_RegionStruct.maxY) {
- this->m_RegionStruct.maxY = j;
- } //esle
- if (k <= this->m_RegionStruct.minZ) {
- this->m_RegionStruct.minZ = k;
- } //fi
- if (k > this->m_RegionStruct.maxZ) {
- this->m_RegionStruct.maxZ = k;
- } //esle
+void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j, const int& k)
+{
+ if (i >= 0 && j >= 0 && k >= 0)
+ {
+ if (i <= this->m_RegionStruct.minX) { this->m_RegionStruct.minX = i; } //fi
+ if (i > this->m_RegionStruct.maxX) { this->m_RegionStruct.maxX = i; } //esle
+ if (j <= this->m_RegionStruct.minY) { this->m_RegionStruct.minY = j; } //fi
+ if (j > this->m_RegionStruct.maxY) { this->m_RegionStruct.maxY = j; } //esle
+ if (k <= this->m_RegionStruct.minZ) { this->m_RegionStruct.minZ = k; } //fi
+ if (k > this->m_RegionStruct.maxZ) { this->m_RegionStruct.maxZ = k; } //esle
this->m_ValidRegion = true;
- } //fi
- else {
+ }else {
this->m_ValidRegion = false;
- } //esle
+ } // if i j k
+
+// if (m_ValidRegion ) printf(" ImageMManager::CalculateMinMaxRegion true \n");
+// if (!m_ValidRegion ) printf(" ImageMManager::CalculateMinMaxRegion false \n");
}
+
// ----------------------------------------------------------------------------------
-void ImageMManager::AddModifiedPixel(const int& i, const int& j, const int& k) {
+void ImageMManager::AddModifiedPixel(const int& i, const int& j, const int& k)
+{
this->CalculateMinMaxRegion(i, j, k);
}
// ----------------------------------------------------------------------------------
-bool ImageMManager::ValidateRegion() {
+bool ImageMManager::ValidateRegion()
+{
return (m_ValidRegion);
}
// ----------------------------------------------------------------------------------
-RegionStructUR ImageMManager::GetModifiedRegion() {
+RegionStructUR ImageMManager::GetModifiedRegion()
+{
return (this->m_RegionStruct);
}
// ----------------------------------------------------------------------------------
+
+void ImageMManager::BaseInitialPoint(int x, int y, int z)
+{
+ baseInitialPointX = x;
+ baseInitialPointY = y;
+ baseInitialPointZ = z;
+}
+
+int ImageMManager::GetBaseInitialPointX()
+{
+ return baseInitialPointX;
+}
+
+int ImageMManager::GetBaseInitialPointY()
+{
+ return baseInitialPointY;
+}
+
+int ImageMManager::GetBaseInitialPointZ()
+{
+ return baseInitialPointZ;
+}
+
* @brief This class contains the modification manager of the undo/redo
* @details This class contains the region and some information about the undo/redo
*/
-class ImageMManager {
+class ImageMManager
+{
public:
// ----------------------------------------------------------------------------------
/*! @fn ImageMManager();
*/
RegionStructUR GetModifiedRegion();
// ----------------------------------------------------------------------------------
+
+ void BaseInitialPoint(int x, int y, int z);
+ int GetBaseInitialPointX();
+ int GetBaseInitialPointY();
+ int GetBaseInitialPointZ();
+
private:
// ----------------------------------------------------------------------------------
/*! @fn
void CalculateMinMaxRegion(const int& i, const int& j, const int& k);
// ----------------------------------------------------------------------------------
private:
- RegionStructUR m_RegionStruct; //!< This is the Region structure.
- bool m_ValidRegion; //!< This is true if the region is valid.
+ RegionStructUR m_RegionStruct; //!< This is the Region structure.
+ bool m_ValidRegion; //!< This is true if the region is valid.
+ int baseInitialPointX;
+ int baseInitialPointY;
+ int baseInitialPointZ;
+
};
#endif /* IMAGEMANAGEMENT_H_ */
#include "imageUndoRedo.h"
// ----------------------------------------------------------------------------------
-ImageUndoRedo::ImageUndoRedo( )
+ImageUndoRedo::ImageUndoRedo()
{
this->m_ImagesDeque = new IDequeType( );
}
+
// ----------------------------------------------------------------------------------
//virtual
ImageUndoRedo::~ImageUndoRedo( )
{
-
}
+
// ----------------------------------------------------------------------------------
//virtual
void ImageUndoRedo::Undo( )
{
this->DrawUR( imageInfo, true );
this->UpdateUndoImage( );
- }
+ } //if imageInfo
}
// ----------------------------------------------------------------------------------
//virtual
void ImageUndoRedo::SetImage( VTKImageDataPointerType image )
{
this->m_CurrentImage = image;
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
this->m_CurrentImage->Update( );
#else
- // ..
+ this->m_CurrentImage->Modified( );
#endif
this->UpdateUndoImage( );
}
+
// ----------------------------------------------------------------------------------
//virtual
void ImageUndoRedo::SetURImages( ImageMManagerType* imMManager )
if( newImageManager->ValidateRegion( ) )
{
RegionSType region = newImageManager->GetModifiedRegion( );
- VTKImageDataPointerType imgUndo = this->GetImageRegion( region,
- this->m_UndoImage );
- VTKImageDataPointerType imgRedo = this->GetImageRegion( region,
- this->m_CurrentImage );
- this->m_ImagesDeque->AddImagesToURContainer( imgUndo, imgRedo,
- newImageManager );
+ VTKImageDataPointerType imgUndo = this->GetImageRegion( region,this->m_UndoImage );
+ VTKImageDataPointerType imgRedo = this->GetImageRegion( region,this->m_CurrentImage );
+ this->m_ImagesDeque->AddImagesToURContainer( imgUndo, imgRedo,newImageManager );
this->UpdateUndoImage( );
- }
- else
- {
+ } else {
std::cerr << "INVALID REGION" << std::endl;
}
}
+
// ----------------------------------------------------------------------------------
void ImageUndoRedo::UpdateUndoImage( )
{
#if VTK_MAJOR_VERSION <= 5
this->m_CurrentImage->Update( );
#else
- // ...
+ this->m_CurrentImage->Modified( );
#endif
this->m_UndoImage = VTKImageDataPointerType::New( );
this->m_UndoImage->DeepCopy( m_CurrentImage );
#if VTK_MAJOR_VERSION <= 5
this->m_UndoImage->Update( );
#else
- // ..
+ this->m_UndoImage->Modified( );
#endif
}
+
// ----------------------------------------------------------------------------------
-ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion(
- const RegionSType& region, VTKImageDataPointerType img )
+ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion( const RegionSType& region, VTKImageDataPointerType img )
{
VTKExtractVOIPointerType extract = VTKExtractVOIPointerType::New( );
- extract->SetVOI( region.minX, region.maxX, region.minY, region.maxY,
- region.minZ, region.maxZ );
+ extract->SetVOI( region.minX, region.maxX, region.minY, region.maxY,region.minZ, region.maxZ );
extract->SetSampleRate( 1, 1, 1 );
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
extract->SetInput( img );
#else
extract->SetInputData( img );
+ extract->Update();
#endif
VTKImageDataPointerType imgResult = extract->GetOutput( );
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
imgResult->Update( );
#else
- // ..
+ imgResult->Modified( );
#endif
-
return ( imgResult );
}
// ----------------------------------------------------------------------------------
if( undo )
{
img = imageInfo->GetUndoImage( );
- } //fi
- else
- {
+ } else {
img = imageInfo->GetRedoImage( );
} //else
- RegionSType region = imageInfo->GetImageMManager( )->GetModifiedRegion( );
+ RegionSType region = imageInfo->GetImageMManager()->GetModifiedRegion();
+ m_RestorBaseInitialPointX = imageInfo->GetImageMManager()->GetBaseInitialPointX();
+ m_RestorBaseInitialPointY = imageInfo->GetImageMManager()->GetBaseInitialPointY();
+ m_RestorBaseInitialPointZ = imageInfo->GetImageMManager()->GetBaseInitialPointZ();
+
if( img != NULL)
{
- int *dim = img->GetDimensions( );
- int sizeXImageIn = dim[ 0 ];
- size_t linesize = sizeXImageIn * sizeof(unsigned short);
+ int *dim = img->GetDimensions( );
+ int sizeXImageIn = dim[ 0 ];
+ size_t linesize = sizeXImageIn * sizeof(unsigned short);
for( int j = region.minY, y = 0; j <= region.maxY; j++, y++ )
{
for( int k = region.minZ, z = 0; k <= region.maxZ; k++, z++ )
{
- void* ptrsrc = img->GetScalarPointer( 0, y, z );
- void* ptrdest = this->m_CurrentImage->GetScalarPointer(
- region.minX, j, k );
+ void* ptrsrc = img->GetScalarPointer( 0, y, z );
+ void* ptrdest = this->m_CurrentImage->GetScalarPointer( region.minX, j, k );
memcpy( ptrdest, ptrsrc, linesize );
- }
- }
+ } // for k
+ } // for j
this->m_CurrentImage->Modified( );
- }
+ } // if img
this->m_ImagesDeque->ManageMemory( );
}
// ----------------------------------------------------------------------------------
+
+int ImageUndoRedo::GetRestorBaseInitialPointX()
+{
+ return m_RestorBaseInitialPointX;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointY()
+{
+ return m_RestorBaseInitialPointY;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointZ()
+{
+ return m_RestorBaseInitialPointZ;
+}
+
VTKImageDataPointerType img);
* @brief This method extract from an image the region of interest (In the undo/redo returns the volume of the modified or t-1 image).
*/
- VTKImageDataPointerType GetImageRegion(const RegionSType& region,
- VTKImageDataPointerType img);
+ VTKImageDataPointerType GetImageRegion(const RegionSType& region,VTKImageDataPointerType img);
+
+ int GetRestorBaseInitialPointX();
+ int GetRestorBaseInitialPointY();
+ int GetRestorBaseInitialPointZ();
+
protected:
// ----------------------------------------------------------------------------------
/*! @fn virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo);
*/
virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo);
// ----------------------------------------------------------------------------------
+
protected:
- IDequeType* m_ImagesDeque; //!<The manager of the ImagesDeque.
- VTKImageDataPointerType m_UndoImage; //!< This is the image for undo t(m_CurrentImage - 1).
- VTKImageDataPointerType m_CurrentImage; //!< This is the current image (The modification image).
+ IDequeType *m_ImagesDeque; //!<The manager of the ImagesDeque.
+ VTKImageDataPointerType m_UndoImage; //!< This is the image for undo t(m_CurrentImage - 1).
+ VTKImageDataPointerType m_CurrentImage; //!< This is the current image (The modification image).
+
+ int m_RestorBaseInitialPointX;
+ int m_RestorBaseInitialPointY;
+ int m_RestorBaseInitialPointZ;
};
#include "managerUR.h"
// ----------------------------------------------------------------------------------
-ManagerUR::ManagerUR() {
-
+ManagerUR::ManagerUR()
+{
}
-// ----------------------------------------------------------------------------------
-ManagerUR::~ManagerUR() {
-}
// ----------------------------------------------------------------------------------
-void ManagerUR::SetImage(VTKImageDataPointerType image) {
-
+ManagerUR::~ManagerUR()
+{
}
-// ----------------------------------------------------------------------------------
-void ManagerUR::Undo() {
-}
// ----------------------------------------------------------------------------------
-void ManagerUR::Redo() {
-
+void ManagerUR::SetImage(VTKImageDataPointerType image)
+{
}
+
// ----------------------------------------------------------------------------------
-void ManagerUR::SetURImages(ImageMManagerType* imMManager) {
+void ManagerUR::Undo()
+{
+}
+// ----------------------------------------------------------------------------------
+void ManagerUR::Redo()
+{
}
+
// ----------------------------------------------------------------------------------
-void ManagerUR::DrawUR(ImageInfoUR* imageInfo, const bool& undo) {
+void ManagerUR::SetURImages(ImageMManagerType* imMManager)
+{
+}
+// ----------------------------------------------------------------------------------
+void ManagerUR::DrawUR(ImageInfoUR* imageInfo, const bool& undo)
+{
}
+
// ----------------------------------------------------------------------------------
manualBaseModel::manualBaseModel()
{
//EED2017
- _sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
-
+ _sizePointsContour = 500; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
+ _label = "";
+ _label2 = "--";
}
// ----------------------------------------------------------------------------
return false;
}
//CMRU 17-08-09----------------------------------------------------------------------------
-void manualBaseModel::SetLabel(std::string newLabel)
-{
-}
void manualBaseModel::SetRealSize(double newRealSize)
{
return -1;
}
+void manualBaseModel::OpenData(FILE *ff)
+{
+}
+
+void manualBaseModel::SetLabel(std::string newLabel)
+{
+ _label = newLabel;
+}
+
std::string manualBaseModel::GetLabel()
{
- return "";
+ return _label;
}
-void manualBaseModel::OpenData(FILE *ff)
+
+void manualBaseModel::SetLabel2(std::string newLabel)
+{
+ _label2 = newLabel;
+}
+
+std::string manualBaseModel::GetLabel2()
{
+ return _label2;
}
+
+
+
//----------------------------------------------------------------------------
* Assigns the parameter value to the label
* @param newLabel New label of the contour
*/
- virtual void SetLabel(std::string newLabel);
+ void SetLabel(std::string newLabel);
+ std::string GetLabel();
+ void SetLabel2(std::string newLabel);
+ std::string GetLabel2();
/*
* Assigns the parameter value to the real size
*/
virtual void SetRealSize(double newRealSize);
- /**
- * Returns the label of the contour
- */
- virtual std::string GetLabel();
/**
* Returns the real size in milimeters of the contour
int _sizePointsContour;
std::vector<manualPoint*> _lstPoints;
+ /**
+ * Represents the label associated with the contour
+ */
+ std::string _label;
+ std::string _label2;
+
};
_cntSplineZ->SetDefaultContinuity( 0 );
//JSTG 25-02-08 -------------------------------------------------------------------------------------------------
// this parameter is reset in the VIRTUAL manualContourBaseControler::Configure
- _sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
+ _sizePointsContour = 500; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
_delta_JSTG = 0.0;
//---------------------------------------------------------------------------------------------------------------
//CMRU 17-08-09 -------------------------------------------------------------------------------------------------
_realSize = 0.0;
- _label = "";
//---------------------------------------------------------------------------------------------------------------
}
manualContourModel::~manualContourModel()
{
int i,size=_lstPoints.size();
- for (i=0;i<size; i++){
+ for (i=0;i<size; i++)
+ {
delete _lstPoints[i];
- }
+ } // for i
_lstPoints.clear();
_cntSplineX->RemoveAllPoints();
_cntSplineY->RemoveAllPoints();
{
std::string etiqueta = GetLabel();
if(etiqueta.empty())
+ {
fprintf(ff,"Label: NO_LABEL\n");
- else
+ } else {
fprintf(ff,"Label: %s\n",etiqueta.c_str());
+ } // if etiqueta
fprintf(ff,"Real_Size: %f\n",GetRealSize());
}
std::cout<<tmp<<std::endl;
//if(strcmp(tmp != "NO_LABEL") // JPR
if(strcmp(tmp,"NO_LABEL") != 0)
+ {
SetLabel(tmp);
-
+ }
fscanf(ff,"%s",tmp); // Real_size
fscanf(ff,"%s",tmp);// #
//CMRU 17-08-09----------------------------------------------------------------------------
-void manualContourModel::SetLabel(std::string newLabel)
-{
- _label = newLabel;
-}
-
void manualContourModel::SetRealSize(double newRealSize)
{
_realSize = newRealSize;
return _realSize;
}
-std::string manualContourModel::GetLabel()
-{
- return _label;
-}
//----------------------------------------------------------------------------
virtual manualContourModel * Clone();
void CopyAttributesTo( manualContourModel *cloneObject );
- void Open(FILE *ff); // virtual
- virtual void Save(FILE *ff); // virtual
+ void Open(FILE *ff); // virtual
+ virtual void Save(FILE *ff); // virtual
virtual int GetTypeModel(); // virtual
virtual int AddPoint(double x,double y,double z);
// CMRU 17-08-09 -----------------------------------------------------------------
- /*
- * Assigns the parameter value to the label
- * @param newLabel New label of the contour
- */
- void SetLabel(std::string newLabel);
/*
* Assigns the parameter value to the real size
*/
void SetRealSize(double newRealSize);
- /**
- * Returns the label of the contour
- */
- std::string GetLabel();
-
/**
* Returns the real size in milimeters of the contour
*/
vtkKochanekSpline *_cntSplineZ;
//JSTG 25-02-08 ----------------------------------------
- double _delta_JSTG;
+ double _delta_JSTG;
//------------------------------------------------------
//CMRU 17-08-09 -----------------------------------------------------------------
/**
* Represents the real size in milimeters of the contour
*/
- double _realSize;
+ double _realSize;
- /**
- * Represents the label associated with the contour
- */
- std::string _label;
//--------------------------------------------------------------------------------
};
_contourVtkActor = NULL;
_bboxMapper = NULL;
_range = 1;
- _sizePointsContour = 100;
+ _sizePointsContour = 500;
_spc[0] = 1;
_spc[1] = 1;
_spc[2] = 1;
// _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
vtkTextProperty *tprop = _textActor->GetTextProperty();
- tprop->SetFontSize(14);
+ tprop->SetFontSize(12);
tprop->SetFontFamilyToArial();
tprop->SetColor(1, 1, 0);
// _textActor2->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
vtkTextProperty *tprop2 = _textActor2->GetTextProperty();
- tprop2->SetFontSize(14);
+ tprop2->SetFontSize(12);
tprop2->SetFontFamilyToArial();
tprop2->SetColor(1, 1, 0);
double pp[3];
int i,size = _sizePointsContour;
double *vx = (double*)malloc(sizeof(double)*size);
- for (i=0;i<size;i++){
+ for (i=0;i<size;i++)
+ {
_pts->GetPoint(i,pp);
vx[i]=pp[0];
- }
+ } // for i
return vx;
}
// ----------------------------------------------------------------------------
double pp[3];
int i,size = _sizePointsContour;
double *vy = (double*)malloc(sizeof(double)*size);
- for (i=0;i<size;i++){
+ for (i=0;i<size;i++)
+ {
_pts->GetPoint(i,pp);
vy[i]=pp[1];
- }
+ } // for i
return vy;
}
// ----------------------------------------------------------------------------
double pp[3];
int i,size = _sizePointsContour;
double *vz = (double*)malloc(sizeof(double)*size);
- for (i=0;i<size;i++){
+ for (i=0;i<size;i++)
+ {
_pts->GetPoint(i,pp);
vz[i]=pp[2];
- }
+ } // for i
return vz;
}
// ----------------------------------------------------------------------------
RefreshContour();
}
int i,size=_lstViewPoints.size();
- for (i=0;i<size;i++){
+ for (i=0;i<size;i++)
+ {
UpdateViewPoint(i);
_lstViewPoints[i]->UpdateColorActor();
- }
+ } // for i
UpdateColorActor();
if (_show_text==true)
_show_text = ok;
if (_show_text==false && _textActor!=NULL)
{
- _textActor->SetInput("00");
- _textActor2->SetInput("00");
+ _textActor->SetInput("");
+ _textActor2->SetInput("");
}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void manualViewContour::RefreshText() // virtual
{
-
if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
int size = GetNumberOfPoints();
char text[50];
char resultText2[250];
strcpy(resultText2, "000");
double spcP[3];
- spcP[0]=1;
- spcP[1]=1;
- spcP[2]=1;
+ spcP[0] = 1;
+ spcP[1] = 1;
+ spcP[2] = 1;
//CMRU 19-08-09 ----------------------------------
- std::string label;
- label = _manContModel->GetLabel();
+ std::string label = _manContModel->GetLabel();
+ std::string label2 = " (" + _manContModel->GetLabel2() + "z) ";
// ------------------------------------
if (size==2)
gcvt ( this->_manContModel->GetPathSize( _spc ), 5, text );
strcat(resultText2,text);
strcat(resultText2,"u");
-
}
//CMRU 19-08-09 ----------------------------------
+ strcat(resultText,label2.c_str());
strcat(resultText,label.c_str());
//------------------------------------------------
}
_textActor->SetInput(resultText);
_textActor2->SetInput(resultText2);
- if (size>=1){
-
+ if (size>=1)
+ {
int i;
for (i=0; i<size; i++)
{
if (_lstViewPoints[i]->GetPosibleSelected()==true)
{
_id_viewPoint_for_text = i;
- }
- }
-
+ } // if
+ } // for
if (_id_viewPoint_for_text>=size)
{
- _id_viewPoint_for_text=0;
- }
-
+ _id_viewPoint_for_text = 0;
+ }// if
double px = _manContModel->GetManualPoint(_id_viewPoint_for_text)->GetX();
double py = _manContModel->GetManualPoint(_id_viewPoint_for_text)->GetY();
-
//EED 27 sep 2006
- px=px*_spc[0];
- py=py*_spc[1];
-
+ px = px*_spc[0];
+ py = py*_spc[1];
_textActor->SetPosition(px+GetRange()+1,py);
_textActor2->SetPosition(px+GetRange()+1,py+2);
- }
+ } // if size
}
}
{ // inside the boundaring box
if ( ShowLineVersion()==true )
{
- manualPoint *mpA = _manContModel->GetManualPoint(0);
- manualPoint *mpB = _manContModel->GetManualPoint(1);
_pts->GetPoint(0, ppA);
+ _pts->GetPoint(1, ppB);
double dirVec[3];
// direction of the segment
- dirVec[0] = mpB->GetX() - mpA->GetX();
- dirVec[1] = mpB->GetY() - mpA->GetY();
- dirVec[2] = mpB->GetZ() - mpA->GetZ();
+ dirVec[0] = ppB[0] - ppA[0];
+ dirVec[1] = ppB[1] - ppA[1];
+ dirVec[2] = ppB[2] - ppA[2];
// proj = mpA + k*dirVec
double num;
double den = 0.0 ;
- num = dirVec[0]*( xx-mpA->GetX() );
- num = num + dirVec[1]*( yy-mpA->GetY() );
- num = num + dirVec[2]*( zz-mpA->GetZ() );
+
+ num = dirVec[0]*( xx-ppA[0] );
+ num = num + dirVec[1]*( yy-ppA[1] );
+ num = num + dirVec[2]*( zz-ppA[2] );
+
den=dirVec[0]*dirVec[0] + dirVec[1]*dirVec[1] + dirVec[2]*dirVec[2];
double k;
if (den!=0)
k = 99999999;
}
// projection of th point xx,yy,zz in segment mpA,mpB
- double projX = mpA->GetX() + k*dirVec[0];
- double projY = mpA->GetY() + k*dirVec[1];
- double projZ = mpA->GetZ() + k*dirVec[2];
+ double projX = ppA[0] + k*dirVec[0];
+ double projY = ppA[1] + k*dirVec[1];
+ double projZ = ppA[2] + k*dirVec[2];
+
// distance [projX,projY,projZ] and (xx,yy,zz]
double d1= sqrt( (projX-xx)*(projX-xx) + (projY-yy)*(projY-yy) +(projZ-zz)*(projZ-zz) );
#include "BrushFilter.h"
-BrushFilter::BrushFilter() {
- _brushsize = 1;
+BrushFilter::BrushFilter()
+{
+ _brushsize = 5;
_brushform = 0; // 0 rectangle-cube , 1 circle-sphere
_brushtool = 0; // 0 pencil , 1 fill
}
}
//---------------------------------------------------------------------------
-void BrushFilter::FindMinMaxBrush(int &minX, int &maxX, int &minY, int &maxY,
- int &minZ, int &maxZ, int &size) {
+void BrushFilter::FindMinMaxBrush(int px, int py, int pz,int &minX, int &maxX, int &minY, int &maxY,
+ int &minZ, int &maxZ, int &size)
+{
size = _brushsize - 1;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+/*
minX = _px - size;
maxX = _px + size;
minY = _py - size;
maxY = _py + size;
minZ = _pz - size;
maxZ = _pz + size;
-
if (_2D3D == 0) //2D
- {
+ {
if (_direction == 0) // YZ
- {
+ {
minX = _px;
maxX = _px;
}
if (_direction == 1) // XZ
- {
+ {
minY = _py;
maxY = _py;
}
if (_direction == 2) // XY
- {
+ {
minZ = _pz;
maxZ = _pz;
}
- }
-
- if (_2D3D == 1) // 3D
- {
- }
-
- if (minX < _minX) {
- minX = _minX;
- }
-
- if (minY < _minY) {
- minY = _minY;
- }
-
- if (minZ < _minZ) {
- minZ = _minZ;
- }
+ } // _2D3D
+*/
+ minX = px - size;
+ maxX = px + size;
+ minY = py - size;
+ maxY = py + size;
+ minZ = pz - size;
+ maxZ = pz + size;
+ if (_2D3D == 0) //2D
+ {
+ if (_direction == 0) // YZ
+ {
+ minX = px;
+ maxX = px;
+ }
+ if (_direction == 1) // XZ
+ {
+ minY = py;
+ maxY = py;
+ }
+ if (_direction == 2) // XY
+ {
+ minZ = pz;
+ maxZ = pz;
+ }
+ } // _2D3D
- if (maxX > _maxX) {
- maxX = _maxX;
- }
+ if (_2D3D == 1) { } // 3D
- if (maxY > _maxY) {
- maxY = _maxY;
- }
+ if (minX < _minX) { minX = _minX; }
+ if (minY < _minY) { minY = _minY; }
+ if (minZ < _minZ) { minZ = _minZ; }
- if (maxZ > _maxZ) {
- maxZ = _maxZ;
- }
+ if (maxX >= _dimX) { maxX = _dimX-1; }
+ if (maxY >= _dimY) { maxY = _dimY-1; }
+ if (maxZ >= _dimZ) { maxZ = _dimZ-1; }
- //--
- SetGeneralMinMax(minX, maxX, minY, maxY, minZ, maxZ);
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// SetGeneralMinMax(minX, maxX, minY, maxY, minZ, maxZ);
}
//---------------------------------------------------------------------------
-void BrushFilter::Run() // virtual
+void BrushFilter::Run(int px, int py, int pz) // virtual
{
if (_image != NULL)
{
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
+ this->_IMManager->BaseInitialPoint(px, py ,pz);
+
float value = (float) _graylevel;
int i, j, k;
int size;
int minX, maxX, minY, maxY, minZ, maxZ;
- FindMinMaxBrush(minX, maxX, minY, maxY, minZ, maxZ, size);
+ FindMinMaxBrush(px,py,pz,minX, maxX, minY, maxY, minZ, maxZ, size);
double xx, yy, zz, rr = size * size;
float scalarComponent;
for (i = minX; i <= maxX; i++)
{
- xx = _px - i;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// xx = _px - i;
+ xx = px - i;
xx = xx * xx;
for (j = minY; j <= maxY; j++)
{
- yy = _py - j;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// yy = _py - j;
+ yy = py - j;
yy = yy * yy;
for (k = minZ; k <= maxZ; k++)
{
pixelModify=false;
scalarComponent = _image->GetScalarComponentAsFloat(i,j, k, 0);
- if ((_RangeMin <= scalarComponent)
- && (scalarComponent <= _RangeMax ))
+ if ((_RangeMin <= scalarComponent) && (scalarComponent <= _RangeMax ))
{
if (_brushform == 0)
{
} // _brushform 0
if (_brushform == 1)
{
- zz = _pz - k;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// zz = _pz - k;
+ zz = pz - k;
zz = zz * zz;
if ((xx + yy + zz) <= rr) {
pixelModify=true;
void SetBrushSize( int brushsize );
void SetBrushForm( int brushform );
void SetBrushTool( int brushtool );
- void FindMinMaxBrush(int &minxX,int &maxX,int &minY,int &maxY,int &minZ,int &maxZ,int &size);
- virtual void Run();
-
+ void FindMinMaxBrush(int px, int py, int pz,int &minxX,int &maxX,int &minY,int &maxY,int &minZ,int &maxZ,int &size);
+ virtual void Run(int px, int py, int pz);
private:
int _brushsize;
int _brushform;
int _brushtool;
-
protected:
};
#include "FillFilter.h"
#include "creaVtk_MACROS.h"
+#include <vector>
+
+
+
FillFilter::FillFilter()
{
- _tolerancefill = 50;
- _distancefill = 500;
- _limitRecursionFill = 50000;
- _auxImageFill = NULL;
- _maxXback = 0;
- _maxYback = 0;
- _maxZback = 0;
+ _tolerancefill = 125;
+ _GeneralAuxImageFill = NULL;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// _auxImageFill = NULL;
+// _maxXback = 0;
+// _maxYback = 0;
+// _maxZback = 0;
+ SetDistanceFill(5);
}
//---------------------------------------------------------------------------
FillFilter::~FillFilter()
{
+/*//EED 2020-04-28 BORRAME Change to local variables to use with openmp
if (_auxImageFill != NULL)
{
_auxImageFill->Delete();
- }
+ }//_auxImageFill
+*/
}
//---------------------------------------------------------------------------
void FillFilter::SetImages(vtkImageData *image,vtkImageData *image2) // virtual
-{
-
-
- baseFilterManualPaint::SetImages(image,image2);
-
+{
+ baseFilterManualPaint::SetImages(image,image2);
+
+/* //EED 2020-04-28 BORRAME Change to local variables to use with openmp
if ((_maxX!=_maxXback) || (_maxY!=_maxYback) || (_maxZ!=_maxZback))
{
if (_auxImageFill != NULL)
#else
_auxImageFill->AllocateScalars(VTK_UNSIGNED_CHAR,1);
#endif
- _ptrAuxImageFill = (unsigned char *)_auxImageFill->GetScalarPointer();
- memset(_ptrAuxImageFill, 0, (_maxX+1) * (_maxY+1) * (_maxZ+1) );
}
- _maxXback=_maxX;
- _maxYback=_maxY;
- _maxYback=_maxZ;
-}
+ unsigned char * ptrAuxImageFill = (unsigned char *)_auxImageFill->GetScalarPointer();
+ memset(ptrAuxImageFill, 0, (_maxX+1) * (_maxY+1) * (_maxZ+1) );
+ _maxXback = _maxX;
+ _maxYback = _maxY;
+ _maxZback = _maxZ;
+*/
+ if (_GeneralAuxImageFill != NULL)
+ {
+ _GeneralAuxImageFill->Delete();
+ }
+ _GeneralAuxImageFill = vtkImageData::New();
+ _GeneralAuxImageFill->SetDimensions(_dimX,_dimY,_dimZ );
+ _GeneralAuxImageFill->SetOrigin(0, 0, 0);
+ _GeneralAuxImageFill->SetExtent(0, _dimX-1, 0, _dimY-1, 0, _dimZ-1);
+ _GeneralAuxImageFill->AllocateScalars(VTK_UNSIGNED_CHAR,1);
+ unsigned char *ptrAuxImageFill = (unsigned char*)_GeneralAuxImageFill->GetScalarPointer();
+ memset(ptrAuxImageFill, 0, _dimX*_dimY*_dimZ*sizeof(unsigned char) );
+}
//---------------------------------------------------------------------------
-void FillFilter::Run() // virtual
+void FillFilter::Run(int px, int py, int pz) // virtual
{
long int ivi;
- if ((_px >= _minX) && (_px <= _maxX) && (_py >= _minY) && (_py <= _maxY)
- && (_pz >= _minZ) && (_pz <= _maxZ))
+
+/* //EED 2020-04-28 BORRAME Change to local variables to use with openmp
+ if ( (_px >= _minX) && (_px < _dimX) &&
+ (_py >= _minY) && (_py < _dimY) &&
+ (_pz >= _minZ) && (_pz < _dimZ) )
{
- _graylevelbasefill = _image->GetScalarComponentAsDouble(_px, _py, _pz,0);
- _pxfill = _px;
- _pyfill = _py;
- _pzfill = _pz;
- _distbasefill = _distancefill * _distancefill;
- _countRecursiveFill = 0;
- _countRecursiveFillProblem = 0;
- _countProgressingFill = 0;
- _usingAuxImageFill = false;
- ivi = _px + _py*(_maxX+1) + _pz*(_maxX+1)*(_maxY+1); // index vector image
-//EED01
-// FillToolRecursive(_px, _py, _pz);
- FillToolRecursive(_px, _py, _pz, ivi);
-
- unsigned char *pImage;
- pImage = (unsigned char *) _auxImageFill->GetScalarPointer();
- int ii, jj, kk;
- ivi = 0;
- while (_countRecursiveFillProblem != 0)
- {
- _countRecursiveFillProblem = 0;
- _usingAuxImageFill = true;
- for (kk = 0; kk <= _maxZ; kk++)
- {
- for (jj = 0; jj <= _maxY; jj++)
- {
- for (ii = 0; ii <= _maxX; ii++)
- {
- if (pImage[ivi] == 1)
- {
-//EED01
-// FillToolRecursive(ii, jj, kk);
- FillToolRecursive(ii, jj, kk, ivi);
- } // if
- ivi++;
- } // for ii
- } // for jj
- } //for kk
-// printf("-\n");
- } // while
- } //if _minX _maxX _minY _maxY _minZ _maxZ
+ this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
+ FillToolLoop(_px, _py, _pz);
+ } //if _minX _maxX _minY _maxY _minZ _maxZ
+*/
+
+ if ( (px >= _minX) && (px < _dimX) &&
+ (py >= _minY) && (py < _dimY) &&
+ (pz >= _minZ) && (pz < _dimZ) )
+ {
+ this->_IMManager->BaseInitialPoint(px, py ,pz);
+ FillToolLoop(px, py, pz);
+ } //if _minX _maxX _minY _maxY _minZ _maxZ
+
+
+
}
+
//---------------------------------------------------------------------------
-void FillFilter::FillToolRecursive(int px, int py, int pz,long int ivi)
+vtkImageData* FillFilter::CreateAuxImageFill( long int &OneColumnAux, long int &OneLineAux , long int &OnePlaneAux,
+ int px, int py, int pz,
+ int &pxAux, int &pyAux, int &pzAux,
+ int &minXAux, int &minYAux, int &minZAux )
{
-DEF_POINTER_IMAGE_VTK_CREA(v_image,ss_image,p_image,st_image,_image)
-DEF_POINTER_IMAGE_VTK_CREA(v_image2,ss_image2,p_image2,st_image2,_image2)
+ // _2D3D = 1 3D
- _countRecursiveFill++;
- _countProgressingFill++;
- if (_countProgressingFill > 200000)
- {
- printf("R %ld \n", _countRecursiveFill);
- _countProgressingFill = 0;
- }
+ minXAux = px-_distancefill; if (minXAux>=0) { pxAux=px-minXAux; } else { pxAux=px; minXAux=0; }
+ minYAux = py-_distancefill; if (minYAux>=0) { pyAux=py-minYAux; } else { pyAux=py; minYAux=0; }
+ minZAux = pz-_distancefill; if (minZAux>=0) { pzAux=pz-minZAux; } else { pzAux=pz; minZAux=0; }
- if ((px >= _minX) && (px <= _maxX) && (py >= _minY) && (py <= _maxY)
- && (pz >= _minZ) && (pz <= _maxZ))
- {
- if (_usingAuxImageFill == true)
- {
- this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
-//EED01
-// _auxImageFill->SetScalarComponentFromFloat(px, py, pz, 0, 0);
- _ptrAuxImageFill[ ivi ]=0;
- }
- _tmpDistfill = (px-_pxfill)*(px-_pxfill)
- + (py-_pyfill)*(py-_pyfill)
- + (pz-_pzfill)*(pz-_pzfill);
+ int maxXAux = px+_distancefill; if (maxXAux>_dimX) { maxXAux=_dimX; }
+ int maxYAux = py+_distancefill; if (maxYAux>_dimY) { maxYAux=_dimY; }
+ int maxZAux = pz+_distancefill; if (maxZAux>_dimZ) { maxZAux=_dimZ; }
-//if (_countRecursiveFill >1 )
-//{
-// printf(" -> %d %d %d cr=%ld r=%f\n", px,py,pz,_countRecursiveFill , _tmpDistfill);
-//}
-
-//EED01
-// _tmpiglfill = _image->GetScalarComponentAsDouble(px, py, pz, 0);
-GETVALUE2_VTK_CREA(_tmpiglfill,p_image,st_image,ivi)
+ int auxDimX = maxXAux-minXAux+1;
+ int auxDimY = maxYAux-minYAux+1;
+ int auxDimZ = maxZAux-minZAux+1;
- if (_image2!=NULL)
+ // new vtkImageData
+ if (_2D3D==0) // 2D
+ {
+ if (_direction==0) // YZ
{
-//EED01
-// _tmpiglfill2 = _image2->GetScalarComponentAsDouble(px, py, pz, 0);
-GETVALUE2_VTK_CREA(_tmpiglfill2,p_image2,st_image2,ivi)
- } else {
- _tmpiglfill2 = _tmpiglfill;
+ auxDimX = 1;
}
-
- float grayLBFMTOL = _graylevelbasefill - _tolerancefill;
- float grayLBFPTOL = _graylevelbasefill + _tolerancefill;
- bool isInRange = false;
- //DFCH
- if (_RangeMin <= grayLBFMTOL && _RangeMax >= grayLBFPTOL) {
- isInRange = true;
- } //fi esle
- else if (_RangeMin > grayLBFMTOL && _RangeMax >= grayLBFPTOL) {
- grayLBFMTOL = _RangeMin;
- isInRange = true;
- } //fi esle
- else if (_RangeMin <= grayLBFMTOL && _RangeMax < grayLBFPTOL) {
- grayLBFPTOL = _RangeMax;
- isInRange = true;
- } //fi esle
- else if ((_RangeMin <= _graylevelbasefill) && (_graylevelbasefill <= _RangeMax)) {
- grayLBFMTOL = _RangeMin;
- grayLBFPTOL = _RangeMax;
- isInRange = true;
- } //fi Range
-
- if (isInRange)
+ if (_direction==1) // XZ
{
- _auxGrayLevelValidationFill = (_tmpiglfill != _graylevel)
- && (_tmpiglfill2 != _graylevel)
- && (_tmpiglfill >= grayLBFMTOL)
- && (_tmpiglfill <= grayLBFPTOL)
- && (_tmpDistfill <= _distbasefill); //DFCH
- } else {
- _auxGrayLevelValidationFill = false;
- } // if isInRange
-
- //DFCH
- /*_auxGrayLevelValidationFill = (_tmpiglfill!=_graylevel) &&
- (_tmpiglfill>=_graylevelbasefill-_tolerancefill) &&
- (_tmpiglfill<=_graylevelbasefill+_tolerancefill) &&
- (_tmpDistfill<=_distbasefill);*/ //DFCH
-
- if (_auxGrayLevelValidationFill == true)
+ auxDimY = 1;
+ }
+ if (_direction==2) // XY
{
- this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
- if (_image2!=NULL)
- {
-//EED01
-// _image2->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
-SETVALUE2_VTK_CREA(_graylevel,p_image2,st_image2,ivi)
- } else {
-//EED01
-// _image->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
-SETVALUE2_VTK_CREA(_graylevel,p_image,st_image,ivi)
- }
-
- if (_countRecursiveFill < _limitRecursionFill)
- {
+ auxDimZ = 1;
+ }
+ } // if 2D
- if (_2D3D == 0) //2D
- {
- if (_direction == 0) // YZ
- {
- //FillToolRecursive(px+1,py,pz);
- //FillToolRecursive(px-1,py,pz);
- FillToolRecursive(px, py + 1, pz, ivi+_OneLine );
- FillToolRecursive(px, py - 1, pz, ivi-_OneLine );
- FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
- FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
- }
- if (_direction == 1) // XZ
- {
- FillToolRecursive(px + 1, py, pz, ivi+_OneColumn);
- FillToolRecursive(px - 1, py, pz, ivi-_OneColumn);
- //FillToolRecursive(px,py+1,pz);
- //FillToolRecursive(px,py-1,pz);
- FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
- FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
- }
- if (_direction == 2) // XY
- {
- FillToolRecursive(px + 1, py, pz, ivi+_OneColumn);
- FillToolRecursive(px, py + 1, pz, ivi+_OneLine);
- FillToolRecursive(px - 1, py, pz, ivi-_OneColumn);
- FillToolRecursive(px, py - 1, pz, ivi-_OneLine);
- //FillToolRecursive(px,py,pz-1);
- //FillToolRecursive(px,py,pz+1);
- }
- } else { // 3D
- FillToolRecursive(px + 1, py, pz, ivi+_OneColumn );
- FillToolRecursive(px - 1, py, pz, ivi-_OneColumn );
- FillToolRecursive(px, py + 1, pz, ivi+_OneLine );
- FillToolRecursive(px, py - 1, pz, ivi-_OneLine );
- FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
- FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
- } // 2D 3D
-
- } //_countRecursiveFill
- } // _graylevel
-
- if ((_auxGrayLevelValidationFill == true) && (_countRecursiveFill >= _limitRecursionFill))
+ OneColumnAux = 1;
+ OneLineAux = auxDimX;
+ OnePlaneAux = auxDimX*auxDimY;
+
+ vtkImageData *auxImageFill;
+ auxImageFill = vtkImageData::New();
+ auxImageFill->SetDimensions(auxDimX, auxDimY, auxDimZ);
+ auxImageFill->SetOrigin(0, 0, 0);
+ auxImageFill->SetExtent(0, auxDimX-1, 0, auxDimY-1, 0, auxDimZ-1);
+ auxImageFill->AllocateScalars(VTK_UNSIGNED_CHAR,1);
+ unsigned char * ptrAuxImageFill = (unsigned char *)auxImageFill->GetScalarPointer();
+ memset( ptrAuxImageFill, 0, auxDimX*auxDimY*auxDimZ );
+ return auxImageFill;
+}
+
+void FillFilter::Copy_AuxImageFill_To_GeneralAuxFill(int minXAux, int minYAux, int minZAux, vtkImageData *auxImageFill)
+{
+ // copy information from the litle image auxImageFill to the big image _GeneralAuxImageFill
+ DEF_POINTER_IMAGE_VTK_CREA(vAuxImageFill,ssAuxImageFill,pAuxImageFill,stAuxImageFill,auxImageFill)
+ DEF_POINTER_IMAGE_VTK_CREA(v_GeneralAuxImageFill,ss_GeneralAuxImageFill,p_GeneralAuxImageFill,st_GeneralAuxImageFill,_GeneralAuxImageFill)
+ int ext[6];
+ auxImageFill->GetExtent(ext);
+ int auxDimX = ext[1]-ext[0]+1;
+ int auxDimY = ext[3]-ext[2]+1;
+ int auxDimZ = ext[5]-ext[4]+1;
+ int i,j,k;
+ long int indexAux=0;
+ long int indexGeneralAux;
+ for (k=0;k<auxDimZ;k++)
+ {
+ for (j=0;j<auxDimY;j++)
{
- _countRecursiveFillProblem++;
- if (_2D3D == 0) //2D
+ indexGeneralAux=minXAux + (minYAux+j)*_OneLine + (minZAux+k)*_OnePlane;
+// indexAux = j*OneLineAux + k*OnePlaneAux;
+ for (i=0;i<auxDimX;i++)
{
- if (_direction == 0) // YZ
+ GETVALUE2_VTK_CREA(vAuxImageFill,pAuxImageFill,stAuxImageFill,indexAux)
+ indexAux++;
+ if (vAuxImageFill==1)
{
- //SetAuxImageFill(px+1,py,pz);
- //SetAuxImageFill(px-1,py,pz);
- SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
- SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
- SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
- SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
- }
- if (_direction == 1) // XZ
+ SETVALUE2_VTK_CREA(vAuxImageFill,p_GeneralAuxImageFill,st_GeneralAuxImageFill,indexGeneralAux)
+ } // if vAuxImageFill
+ indexGeneralAux = indexGeneralAux+_OneColumn;
+ } // for i
+ } // for j
+ } // for k
+}
+
+void FillFilter::Copy_GeneralAuxFill_to_Results()
+{
+ DEF_POINTER_IMAGE_VTK_CREA(v_GeneralAuxImageFill,ss_GeneralAuxImageFill,p_GeneralAuxImageFill,st_GeneralAuxImageFill,_GeneralAuxImageFill)
+ long int i,size = _dimX*_dimY*_dimZ;
+ if (_image2==NULL)
+ {
+ DEF_POINTER_IMAGE_VTK_CREA(v_image,ss_image,p_image,st_image,_image)
+// DEF_POINTER_IMAGE_VTK_CREA_set(v_image,ss_image,p_image,st_image,_image)
+#pragma omp parallel for
+ for (i=0;i<size;i++)
+ {
+ int value;
+ GETVALUE2_VTK_CREA(value,p_GeneralAuxImageFill,st_GeneralAuxImageFill,i)
+ if (value!=0)
{
- SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
- SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
- //SetAuxImageFill(px,py+1,pz);
- //SetAuxImageFill(px,py-1,pz);
- SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
- SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
- }
- if (_direction == 2) // XY
+ SETVALUE2_VTK_CREA(_graylevel,p_image,st_image,i)
+ } // if v_GeneralAuxImageFill
+ } // for
+ } else {
+ DEF_POINTER_IMAGE_VTK_CREA(v_image2,ss_image2,p_image2,st_image2,_image2)
+// DEF_POINTER_IMAGE_VTK_CREA_set(v_image2,ss_image2,p_image2,st_image2,_image2)
+#pragma omp parallel for
+ for (i=0;i<size;i++)
+ {
+ int value;
+ GETVALUE2_VTK_CREA(value,p_GeneralAuxImageFill,st_GeneralAuxImageFill,i)
+ if (value!=0)
{
- SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
- SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
- SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
- SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
- //SetAuxImageFill(px,py,pz-1);
- //SetAuxImageFill(px,py,pz+1);
- }
- } else { // 3D
- SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
- SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
- SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
- SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
- SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
- SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
- } // 2D 3D
-
- } // _graylevel //_limitRecursionFill
-
- } //if _minX _maxX _minY _maxY _minZ _maxZ
- _countRecursiveFill--;
+ SETVALUE2_VTK_CREA(_graylevel,p_image2,st_image2,i)
+ } // if v_GeneralAuxImageFill
+ } // for
+ }// if _image2
+
+
}
+
+
//---------------------------------------------------------------------------
-void FillFilter::SetAuxImageFill(int px, int py, int pz, long int ivi)
+void FillFilter::FillToolLoop(int px, int py, int pz)
{
- if ((px >= _minX) && (px <= _maxX) && (py >= _minY) && (py <= _maxY)
- && (pz >= _minZ) && (pz <= _maxZ))
+ double distbasefill;
+ double graylevelbasefill;
+ double tmpiglfill;
+ double tmpiglfill2;
+ bool auxGrayLevelValidationFill;
+
+
+
+ distbasefill = _distancefill * _distancefill;
+ double difX,difY,difZ,_tmpDistfill;
+ std::vector<int> lstX;
+ std::vector<int> lstY;
+ std::vector<int> lstZ;
+ lstX.push_back(px);
+ lstY.push_back(py);
+ lstZ.push_back(pz);
+ std::vector<long long int> lstivi;
+ lstivi.push_back( px + py*_OneLine+ pz*_OnePlane );
+
+ long int OneColumnAux, OneLineAux, OnePlaneAux; // how to jump in the little image auxImageFill
+ int pxAux, pyAux, pzAux; // position inside little image auxImageFill
+ int minXAux, minYAux, minZAux; // Where start the little image auxImageFill in the big image
+ vtkImageData* auxImageFill = CreateAuxImageFill( OneColumnAux,OneLineAux,OnePlaneAux,
+ px,py,pz,
+ pxAux,pyAux,pzAux,
+ minXAux,minYAux,minZAux );
+ std::vector<long long int> lstiviAux;
+ lstiviAux.push_back( pxAux + pyAux*OneLineAux + pzAux*OnePlaneAux );
+
+ DEF_POINTER_IMAGE_VTK_CREA(v_image,ss_image,p_image,st_image,_image)
+// DEF_POINTER_IMAGE_VTK_CREA_set(v_image,ss_image,p_image,st_image,_image)
+
+ double v_image2;
+ int ss_image2;
+ char *p_image2;
+ int st_image2;
+
+
+ if (_image2!=NULL)
{
- this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
-//EED01
-// _auxImageFill->SetScalarComponentFromFloat(px, py, pz, 0, 1);
- _ptrAuxImageFill[ ivi ]=1;
- } // if px py pz
+// DEF_POINTER_IMAGE_VTK_CREA(v_image2,ss_image2,p_image2,st_image2,_image2)
+ DEF_POINTER_IMAGE_VTK_CREA_set(v_image2,ss_image2,p_image2,st_image2,_image2)
+ } // if _image2
+
+ GETVALUE2_VTK_CREA(graylevelbasefill,p_image,st_image,lstivi[0])
+
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// DEF_POINTER_IMAGE_VTK_CREA(v_auxImageFill,ss_auxImageFill,p_auxImageFill,st_auxImageFill,_auxImageFill)
+ DEF_POINTER_IMAGE_VTK_CREA(vAuxImageFill,ssAuxImageFill,pAuxImageFill,stAuxImageFill,auxImageFill)
+
+ while ( lstX.size()!=0 )
+ {
+ // if point inside image
+ if ((lstX[0] >= _minX) && (lstX[0] < _dimX) && (lstY[0] >= _minY) && (lstY[0] < _dimY) && (lstZ[0] >= _minZ) && (lstZ[0] < _dimZ))
+ {
+ difX = px-lstX[0];
+ difY = py-lstY[0];
+ difZ = pz-lstZ[0];
+ _tmpDistfill = difX*difX + difY*difY + difZ*difZ;
+ // if distance of center point
+ if (_tmpDistfill<=distbasefill)
+ {
+ // if point not visited
+ GETVALUE2_VTK_CREA(vAuxImageFill,pAuxImageFill,stAuxImageFill,lstiviAux[0] );
+ if (vAuxImageFill==0)
+ {
+ // If Gray Level valid
+
+ //EED01
+ // tmpiglfill = _image->GetScalarComponentAsDouble(px, py, pz, 0);
+ GETVALUE2_VTK_CREA(tmpiglfill,p_image,st_image,lstivi[0])
+
+ if (_image2!=NULL)
+ {
+ //EED01
+ // tmpiglfill2 = _image2->GetScalarComponentAsDouble(px, py, pz, 0);
+ GETVALUE2_VTK_CREA(tmpiglfill2,p_image2,st_image2,lstivi[0])
+ } else {
+ tmpiglfill2 = tmpiglfill;
+ }
+
+ float grayLBFMTOL = graylevelbasefill - _tolerancefill;
+ float grayLBFPTOL = graylevelbasefill + _tolerancefill;
+ bool isInRange = false;
+ //DFCH
+ if (_RangeMin <= grayLBFMTOL && _RangeMax >= grayLBFPTOL) {
+ isInRange = true;
+ } //fi esle
+ else if (_RangeMin > grayLBFMTOL && _RangeMax >= grayLBFPTOL) {
+ grayLBFMTOL = _RangeMin;
+ isInRange = true;
+ } //fi esle
+ else if (_RangeMin <= grayLBFMTOL && _RangeMax < grayLBFPTOL) {
+ grayLBFPTOL = _RangeMax;
+ isInRange = true;
+ } //fi esle
+ else if ((_RangeMin <= graylevelbasefill) && (graylevelbasefill <= _RangeMax)) {
+ grayLBFMTOL = _RangeMin;
+ grayLBFPTOL = _RangeMax;
+ isInRange = true;
+ } //fi Range
+
+ if (isInRange)
+ {
+ auxGrayLevelValidationFill = (tmpiglfill != _graylevel) &&
+ (tmpiglfill2 != _graylevel) && // <<<<<<<<< xxxxxxxxxxxxxxxxxxxxxx
+ (tmpiglfill >= grayLBFMTOL) &&
+ (tmpiglfill <= grayLBFPTOL) &&
+ (_tmpDistfill <= distbasefill) ; //DFCH
+ } else {
+ auxGrayLevelValidationFill = false;
+ } // if isInRange
+
+ if (auxGrayLevelValidationFill==true)
+ {
+ this->_IMManager->AddModifiedPixel(lstX[0], lstY[0], lstZ[0]); //DFCH
+/*
+ // Modifie image
+ if (_image2!=NULL)
+ {
+ // _image2->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
+ SETVALUE2_VTK_CREA(_graylevel,p_image2,st_image2,lstivi[0])
+ } else {
+ // _image->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
+ SETVALUE2_VTK_CREA(_graylevel,p_image,st_image,lstivi[0])
+ } // if _image2
+
+*/
+ // Add point to already visited
+ SETVALUE2_VTK_CREA(1,pAuxImageFill,stAuxImageFill,lstiviAux[0]);
+
+ // Add neighborhood points in the list
+
+
+ if (_2D3D == 0) //2D
+ {
+ if (_direction == 0) // YZ
+ {
+//lstX.push_back(lstX[0]+1); lstY.push_back(lstY[0]); lstZ.push_back(lstZ[0]); lstivi.push_back(lstivi[0]+_OneColumn); lstiviAux.push_back(lstiviAux[0]+OneColumnAux);
+//lstX.push_back(lstX[0]-1); lstY.push_back(lstY[0]); lstZ.push_back(lstZ[0]); lstivi.push_back(lstivi[0]-_OneColumn); lstiviAux.push_back(lstiviAux[0]-OneColumnAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0]+1); lstZ.push_back(lstZ[0] ); lstivi.push_back(lstivi[0]+_OneLine); lstiviAux.push_back(lstiviAux[0]+OneLineAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0]-1); lstZ.push_back(lstZ[0] ); lstivi.push_back(lstivi[0]-_OneLine); lstiviAux.push_back(lstiviAux[0]-OneLineAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0] ); lstZ.push_back(lstZ[0]+1); lstivi.push_back(lstivi[0]+_OnePlane); lstiviAux.push_back(lstiviAux[0]+OnePlaneAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0] ); lstZ.push_back(lstZ[0]-1); lstivi.push_back(lstivi[0]-_OnePlane); lstiviAux.push_back(lstiviAux[0]-OnePlaneAux);
+ }
+ if (_direction == 1) // XZ
+ {
+ lstX.push_back(lstX[0]+1); lstY.push_back(lstY[0]); lstZ.push_back(lstZ[0]); lstivi.push_back(lstivi[0]+_OneColumn); lstiviAux.push_back(lstiviAux[0]+OneColumnAux);
+ lstX.push_back(lstX[0]-1); lstY.push_back(lstY[0]); lstZ.push_back(lstZ[0]); lstivi.push_back(lstivi[0]-_OneColumn); lstiviAux.push_back(lstiviAux[0]-OneColumnAux);
+// lstX.push_back(lstX[0] ); lstY.push_back(lstY[0]+1); lstZ.push_back(lstZ[0] ); lstivi.push_back(lstivi[0]+_OneLine); lstiviAux.push_back(lstiviAux[0]+OneLineAux);
+// lstX.push_back(lstX[0] ); lstY.push_back(lstY[0]-1); lstZ.push_back(lstZ[0] ); lstivi.push_back(lstivi[0]-_OneLine); lstiviAux.push_back(lstiviAux[0]-OneLineAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0] ); lstZ.push_back(lstZ[0]+1); lstivi.push_back(lstivi[0]+_OnePlane); lstiviAux.push_back(lstiviAux[0]+OnePlaneAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0] ); lstZ.push_back(lstZ[0]-1); lstivi.push_back(lstivi[0]-_OnePlane); lstiviAux.push_back(lstiviAux[0]-OnePlaneAux);
+ }
+ if (_direction == 2) // XY
+ {
+lstX.push_back(lstX[0]+1); lstY.push_back(lstY[0]); lstZ.push_back(lstZ[0]); lstivi.push_back(lstivi[0]+_OneColumn); lstiviAux.push_back(lstiviAux[0]+OneColumnAux);
+lstX.push_back(lstX[0]-1); lstY.push_back(lstY[0]); lstZ.push_back(lstZ[0]); lstivi.push_back(lstivi[0]-_OneColumn); lstiviAux.push_back(lstiviAux[0]-OneColumnAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0]+1); lstZ.push_back(lstZ[0] ); lstivi.push_back(lstivi[0]+_OneLine); lstiviAux.push_back(lstiviAux[0]+OneLineAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0]-1); lstZ.push_back(lstZ[0] ); lstivi.push_back(lstivi[0]-_OneLine); lstiviAux.push_back(lstiviAux[0]-OneLineAux);
+//lstX.push_back(lstX[0] ); lstY.push_back(lstY[0] ); lstZ.push_back(lstZ[0]+1); lstivi.push_back(lstivi[0]+_OnePlane); lstiviAux.push_back(lstiviAux[0]+OnePlaneAux);
+//lstX.push_back(lstX[0] ); lstY.push_back(lstY[0] ); lstZ.push_back(lstZ[0]-1); lstivi.push_back(lstivi[0]-_OnePlane); lstiviAux.push_back(lstiviAux[0]-OnePlaneAux);
+ }
+ } else { // 3D
+ lstX.push_back(lstX[0]+1); lstY.push_back(lstY[0]); lstZ.push_back(lstZ[0]); lstivi.push_back(lstivi[0]+_OneColumn); lstiviAux.push_back(lstiviAux[0]+OneColumnAux);
+ lstX.push_back(lstX[0]-1); lstY.push_back(lstY[0]); lstZ.push_back(lstZ[0]); lstivi.push_back(lstivi[0]-_OneColumn); lstiviAux.push_back(lstiviAux[0]-OneColumnAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0]+1); lstZ.push_back(lstZ[0] ); lstivi.push_back(lstivi[0]+_OneLine); lstiviAux.push_back(lstiviAux[0]+OneLineAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0]-1); lstZ.push_back(lstZ[0] ); lstivi.push_back(lstivi[0]-_OneLine); lstiviAux.push_back(lstiviAux[0]-OneLineAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0] ); lstZ.push_back(lstZ[0]+1); lstivi.push_back(lstivi[0]+_OnePlane); lstiviAux.push_back(lstiviAux[0]+OnePlaneAux);
+ lstX.push_back(lstX[0] ); lstY.push_back(lstY[0] ); lstZ.push_back(lstZ[0]-1); lstivi.push_back(lstivi[0]-_OnePlane); lstiviAux.push_back(lstiviAux[0]-OnePlaneAux);
+ } // 2D 3D
+ } // if gray level valid auxGrayLevelValidationFill
+ } // if point not visited
+ } // if distance of center point
+ } // if point inside image
+ // Remove point from the list
+ lstX.erase( lstX.begin() );
+ lstY.erase( lstY.begin() );
+ lstZ.erase( lstZ.begin() );
+ lstivi.erase( lstivi.begin() );
+ lstiviAux.erase( lstiviAux.begin() );
+ } // while _lstX.size
+
+ Copy_AuxImageFill_To_GeneralAuxFill( minXAux, minYAux, minZAux, auxImageFill );
+
+ auxImageFill->Delete();
}
//---------------------------------------------------------------------------
_distancefill = distancefill;
}
+/*//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+//---------------------------------------------------------------------------
+vtkImageData* FillFilter::GetAuxImageFill()
+{
+ return _auxImageFill;
+}
+*/
#include "baseFilterManualPaint.h"
+
class FillFilter : public baseFilterManualPaint {
public:
FillFilter();
virtual ~FillFilter();
-
- void Run();
- void FillToolRecursive(int px,int py, int pz, long int ivi);
-
+ void Run(int px, int py, int pz);
+ void FillToolLoop(int px, int py, int pz);
void SetToleranceFill(double tolerancefill);
void SetDistanceFill(int distancefill);
virtual void SetImages(vtkImageData *image,vtkImageData *image2);
+// vtkImageData* GetAuxImageFill();
+void Copy_GeneralAuxFill_to_Results();
+
private:
double _tolerancefill;
int _distancefill;
- double _graylevelbasefill;
-
- int _pxfill;
- int _pyfill;
- int _pzfill;
- double _distbasefill;
- double _tmpDistfill;
- double _tmpiglfill;
- double _tmpiglfill2;
- long int _countRecursiveFill;
- long int _countRecursiveFillProblem;
- vtkImageData *_auxImageFill;
-//EED01
- unsigned char *_ptrAuxImageFill;
-
- bool _usingAuxImageFill;
- bool _auxGrayLevelValidationFill;
- long int _countProgressingFill;
- long int _limitRecursionFill;
-
-
- void SetAuxImageFill(int px,int py, int pz,long int ivi);
- int _maxXback;
- int _maxYback;
- int _maxZback;
+
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// double _distbasefill;
+// double _graylevelbasefill;
+// double _tmpiglfill;
+// double _tmpiglfill2;
+// bool _auxGrayLevelValidationFill;
+
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// vtkImageData *_auxImageFill;
+// int _maxXback;
+// int _maxYback;
+// int _maxZback;
+ vtkImageData *_GeneralAuxImageFill;
+
+vtkImageData* CreateAuxImageFill( long int &OneColumnAux, long int &OneLineAux , long int &OnePlaneAux,
+ int px, int py, int pz,
+ int &pxAux, int &pyAux, int &pzAux,
+ int &minXAux, int &minYAux, int &minZAux );
+void Copy_AuxImageFill_To_GeneralAuxFill(int minXAux, int minYAux, int minZAux, vtkImageData *auxImageFill);
+
protected:
+
+
+//Change to local variables to use with openmp
+// DEF_POINTER_IMAGE_VTK_CREA_definition( v_image , ss_image , p_image , st_image )
+// double v_image;
+// int ss_image;
+// char *p_image;
+// int st_image;
+
+// //macro not working ???
+// DEF_POINTER_IMAGE_VTK_CREA_definition(v_image2,ss_image2,p_image2,st_image2)
+// double v_image2;
+// int ss_image2;
+// char *p_image2;
+// int st_image2;
+
};
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
+#include <wxMPRBaseData.h>
+
#include "ManualPaintControler.h"
#include "vtkInteractorManualPaint.h"
#include "vtkImageActor.h"
//---------------------------------------------------------------------------
-ManualPaintControler::ManualPaintControler() {
- auxZ = 0;
- _wxvtk2Dbaseview = NULL;
+ManualPaintControler::ManualPaintControler()
+{
+ auxZ = 0;
+// _wxvtk2Dbaseview = NULL;
+ _wxvtk2Dbaseview1 = NULL;
+ _wxvtk2Dbaseview2 = NULL;
+ _wxvtk2Dbaseview3 = NULL;
+ _wxvtk2Dbaseview4 = NULL;
}
//---------------------------------------------------------------------------
-ManualPaintControler::~ManualPaintControler() {
+ManualPaintControler::~ManualPaintControler()
+{
}
//---------------------------------------------------------------------------
-void ManualPaintControler::SetManualPaintModel(
- ManualPaintModel* manualPaintModel) {
- _manualPaintModel = manualPaintModel;
+void ManualPaintControler::SetManualPaintModel( ManualPaintModel* manualPaintModel )
+{
+ _manualPaintModel = manualPaintModel;
}
//---------------------------------------------------------------------------
-void ManualPaintControler::SetManualPaintPanel(
- ManualPaintPanel* manualPaintPanel) {
- _manualPaintPanel = manualPaintPanel;
+ManualPaintModel* ManualPaintControler::GetManualPaintModel( )
+{
+ return _manualPaintModel;
}
//---------------------------------------------------------------------------
-void ManualPaintControler::SetWxVtk2DBaseView(
- wxVtk2DBaseView *wxvtk2Dbaseview) {
- _wxvtk2Dbaseview = wxvtk2Dbaseview;
+void ManualPaintControler::SetWxVtk2DBaseView( int id, wxVtk2DBaseView *wxvtk2Dbaseview )
+{
+ if (id==1) { _wxvtk2Dbaseview1 = wxvtk2Dbaseview; }
+ if (id==2) { _wxvtk2Dbaseview2 = wxvtk2Dbaseview; }
+ if (id==3) { _wxvtk2Dbaseview3 = wxvtk2Dbaseview; }
+ if (id==4) { _wxvtk2Dbaseview4 = wxvtk2Dbaseview; }
}
//---------------------------------------------------------------------------
-void ManualPaintControler::Config() {
- if (_wxvtk2Dbaseview != NULL) {
- vtkInteractorStyleBaseView *isbv =
- (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview->GetInteractorStyleBaseView());
+void ManualPaintControler::Config()
+{
+ if (_wxvtk2Dbaseview1 != NULL)
+ {
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview1->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+ } // if _wxvtk2Dbaseview
+ if (_wxvtk2Dbaseview2 != NULL)
+ {
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview2->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+ } // if _wxvtk2Dbaseview
+ if (_wxvtk2Dbaseview3 != NULL)
+ {
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview3->GetInteractorStyleBaseView());
isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
- }
+ } // if _wxvtk2Dbaseview
+ if (_wxvtk2Dbaseview4 != NULL)
+ {
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview4->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+ } // if _wxvtk2Dbaseview
}
//---------------------------------------------------------------------------
-void ManualPaintControler::PaintImage(int px, int py, int pz) {
- _manualPaintModel->SetDirection(_wxvtk2Dbaseview->GetDirection());
+void ManualPaintControler::PaintImage(int px, int py, int pz,int direction)
+{
+ _manualPaintModel->SetDirection( direction );
_manualPaintModel->PaintImage(px, py, pz);
-
// The refresh mechanisme is made in the vtkInteractorManualPaint
// RefreshView();
}
{
_manualPaintModel->SetUndoImage();
}
+
+//---------------------------------------------------------------------------
+void ManualPaintControler::Undo()
+{
+ _manualPaintModel->Undo();
+ Refresh_UndoRedo();
+}
+
+void ManualPaintControler::Redo()
+{
+ _manualPaintModel->Redo();
+ Refresh_UndoRedo();
+}
+
+void ManualPaintControler::Refresh_UndoRedo()
+{
+ wxVtk2DBaseView *wxvtk2Dbaseview = NULL;
+ if (_wxvtk2Dbaseview1!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview1; }
+ if (_wxvtk2Dbaseview2!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview2; }
+ if (_wxvtk2Dbaseview3!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview3; }
+ if (_wxvtk2Dbaseview4!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview4; }
+ if (wxvtk2Dbaseview!=NULL)
+ {
+ vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (wxvtk2Dbaseview->GetVtkBaseData());
+ vtkmprbasedata->SetX( _manualPaintModel->GetRestorBaseInitialPointX() );
+ vtkmprbasedata->SetY( _manualPaintModel->GetRestorBaseInitialPointY() );
+ vtkmprbasedata->SetZ( _manualPaintModel->GetRestorBaseInitialPointZ() );
+ wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+ wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
+#else
+ wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
+#endif
+ } // _wxvtk2Dbaseview
+}
+
+
#define _MANUAL_PAINT_CONTROLER_H_
#include "ManualPaintModel.h"
-#include "ManualPaintPanel.h"
+//#include "ManualPaintPanel.h"
#include "wxVtk2DBaseView.h"
ManualPaintControler();
virtual ~ManualPaintControler();
- void SetManualPaintModel(ManualPaintModel* manualPaintModel);
- void SetManualPaintPanel(ManualPaintPanel* manualPaintPanel);
- void SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview);
- void Config();
- void PaintImage(int px,int py, int pz);
- void SetImageUndo();
+ void SetManualPaintModel(ManualPaintModel* manualPaintModel);
+ ManualPaintModel* GetManualPaintModel();
+ void SetWxVtk2DBaseView(int id, wxVtk2DBaseView *wxvtk2Dbaseview);
+ void Config();
+ void PaintImage(int px,int py, int pz, int direction);
+ void SetImageUndo();
+ void Undo();
+ void Redo();
+ void Refresh_UndoRedo();
private:
int auxZ;
ManualPaintModel *_manualPaintModel;
- ManualPaintPanel *_manualPaintPanel;
- wxVtk2DBaseView *_wxvtk2Dbaseview;
+ wxVtk2DBaseView *_wxvtk2Dbaseview1;
+ wxVtk2DBaseView *_wxvtk2Dbaseview2;
+ wxVtk2DBaseView *_wxvtk2Dbaseview3;
+ wxVtk2DBaseView *_wxvtk2Dbaseview4;
protected:
#include "ManualPaintModel.h"
-ManualPaintModel::ManualPaintModel() {
- _active = true;
- _tool = 0; // 0 pencil , 1 fill
- _brushfilter = new BrushFilter();
- _fillfilter = new FillFilter();
- _imageUndoRedo = new ImageUndoRedo();
+ManualPaintModel::ManualPaintModel()
+{
+ _active = true;
+ _tool = 0; // 0 pencil , 1 fill
+ _brushfilter = new BrushFilter();
+ _fillfilter = new FillFilter();
+ _imageUndoRedo = new ImageUndoRedo();
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// _imageUndoRedo_visited = new ImageUndoRedo();
}
//---------------------------------------------------------------------------
{
if (_active==true)
{
-
if (_tool == 0)
{
- _brushfilter->SetPoint(px, py, pz);
- _brushfilter->Run();
+// _brushfilter->SetPoint(px, py, pz);
+ _brushfilter->Run(px,py,pz);
} // _tool 2
-
if (_tool == 1)
{
- _fillfilter->SetPoint(px, py, pz);
- _fillfilter->Run();
+// _fillfilter->SetPoint(px, py, pz);
+ _fillfilter->Run(px,py,pz);
} // _tool 1
} // _active
}
//---------------------------------------------------------------------------
void ManualPaintModel::Set2D3D(int dim2D3D)
{
- _brushfilter->Set2D3D(dim2D3D);
- _fillfilter->Set2D3D(dim2D3D);
+ _brushfilter -> Set2D3D(dim2D3D);
+ _fillfilter -> Set2D3D(dim2D3D);
}
//---------------------------------------------------------------------------
{
_brushfilter -> SetImages(image,image2);
_fillfilter -> SetImages(image,image2);
- _imageUndoRedo->SetImage(image);
+ if (image2!=NULL)
+ {
+ _imageUndoRedo->SetImage(image2);
+ } else {
+ _imageUndoRedo->SetImage(image);
+ }
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// _imageUndoRedo_visited->SetImage( _fillfilter->GetAuxImageFill() );
} else {
- printf("EED Warning image=NULL in ManualPaintModel::SetImage(image)\n ");
+ printf("EED Warning image=NULL in ManualPaintModel::SetImages(image,image2)\n ");
}
}
_brushfilter->SetBrushForm(brushform);
}
-//---------------------------------------------------------------------------
+//--------------------C:\Eduardo\Creatis\C11\ct\cs\creaMaracasVisu-------------------------------------------------------
void ManualPaintModel::SetToleranceFill(double tolerancefill)
{
_fillfilter->SetToleranceFill(tolerancefill);
{
imMManager = this->_fillfilter->GetImageMManager();
} // if 1
- this->_imageUndoRedo->SetURImages(imMManager);
- this->_brushfilter->CleanImageMManager();
- this->_fillfilter->CleanImageMManager();
+ this->_imageUndoRedo -> SetURImages(imMManager);
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// this->_imageUndoRedo_visited -> SetURImages(imMManager);
+ this->_brushfilter -> CleanImageMManager();
+ this->_fillfilter -> CleanImageMManager();
}
//---------------------------------------------------------------------------
void ManualPaintModel::Undo()
{
this->_imageUndoRedo->Undo();
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// this->_imageUndoRedo_visited->Undo();
}
void ManualPaintModel::Redo()
{
this->_imageUndoRedo->Redo();
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// this->_imageUndoRedo_visited->Redo();
+}
+
+
+int ManualPaintModel::GetRestorBaseInitialPointX()
+{
+ return this->_imageUndoRedo->GetRestorBaseInitialPointX();
+}
+
+int ManualPaintModel::GetRestorBaseInitialPointY()
+{
+ return this->_imageUndoRedo->GetRestorBaseInitialPointY();
}
+
+int ManualPaintModel::GetRestorBaseInitialPointZ()
+{
+ return this->_imageUndoRedo->GetRestorBaseInitialPointZ();
+}
+
+void ManualPaintModel::Copy_GeneralAuxFill_to_Results()
+{
+ if (_tool == 0)
+ {
+ //
+ } // if 0
+ if (_tool == 1) // fillfilter
+ {
+ this->_fillfilter->Copy_GeneralAuxFill_to_Results();
+ } // if 1
+}
+
#include "BrushFilter.h"
#include "FillFilter.h"
-//#include "regionStructUR.h"
-//#include "imageUndoRedo.h"
-
#include "imageModificationManager.h"
#include "imageUndoRedo.h"
-
class ManualPaintModel {
public:
ManualPaintModel();
virtual ~ManualPaintModel();
-
void SetActive(bool active);
void SetTool(int tool);
void Set2D3D(int dim2D3D);
void SetRangeMin(int min);
void SetRangeMax(int max);
void GetScalarRange(double * range);
- void SetUndoImage(); //DFCH
- void Undo(); //DFCH
- void Redo(); //DFCH
+ void SetUndoImage(); //DFCH
+ void Undo(); //DFCH
+ void Redo(); //DFCH
-private:
- int _tool;
- bool _active;
- BrushFilter *_brushfilter;
- FillFilter *_fillfilter;
- ImageUndoRedo *_imageUndoRedo;
+ int GetRestorBaseInitialPointX();
+ int GetRestorBaseInitialPointY();
+ int GetRestorBaseInitialPointZ();
-protected:
+ void Copy_GeneralAuxFill_to_Results();
+private:
+ int _tool;
+ bool _active;
+ BrushFilter *_brushfilter;
+ FillFilter *_fillfilter;
+ ImageUndoRedo *_imageUndoRedo;
+ ImageUndoRedo *_imageUndoRedo_visited;
+protected:
};
#endif // _MANUAL_PAINT_MODEL_H_
ManualPaintPanel::ManualPaintPanel()
{
- _manualPaintModel=NULL;
+ _manualPaintControler=NULL;
}
//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
-void ManualPaintPanel::SetManualPaintModel(ManualPaintModel* manualPaintModel)
+void ManualPaintPanel::SetManualPaintControler(ManualPaintControler* manualPaintControler)
{
- _manualPaintModel = manualPaintModel;
+ _manualPaintControler = manualPaintControler;
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetBrushSize( int brushsize )
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetBrushSize( brushsize );
+ _manualPaintControler->GetManualPaintModel()->SetBrushSize( brushsize );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetRangeMin( int min )
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetRangeMin( min );
+ _manualPaintControler->GetManualPaintModel()->SetRangeMin( min );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetRangeMax( int max )
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetRangeMax( max );
+ _manualPaintControler->GetManualPaintModel()->SetRangeMax( max );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetGrayLevel( double graylevel )
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetGrayLevel( graylevel );
+ _manualPaintControler->GetManualPaintModel()->SetGrayLevel( graylevel );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetTool(int tool)
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetTool( tool );
+ _manualPaintControler->GetManualPaintModel()->SetTool( tool );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::Set2D3D(int dim2D3D)
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->Set2D3D( dim2D3D );
+ _manualPaintControler->GetManualPaintModel()->Set2D3D( dim2D3D );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetBrushForm(int brushform)
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetBrushForm( brushform );
+ _manualPaintControler->GetManualPaintModel()->SetBrushForm( brushform );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetToleranceFill(double tolerancefill)
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetToleranceFill( tolerancefill );
+ _manualPaintControler->GetManualPaintModel()->SetToleranceFill( tolerancefill );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetDistanceFill(int distancefill)
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetDistanceFill( distancefill );
+ _manualPaintControler->GetManualPaintModel()->SetDistanceFill( distancefill );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::GetScalarRange( double * range )
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->GetScalarRange( range );
+ _manualPaintControler->GetManualPaintModel()->GetScalarRange( range );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
//---------------------------------------------------------------------------
void ManualPaintPanel::SetActive( bool active )
{
- if (_manualPaintModel!=NULL)
+ if (_manualPaintControler!=NULL)
{
- _manualPaintModel->SetActive( active );
+ _manualPaintControler->GetManualPaintModel()->SetActive( active );
} else {
printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
}
#ifndef _MANUAL_PAINT_PANEL_H_
#define _MANUAL_PAINT_PANEL_H_
-#include "ManualPaintModel.h"
+#include "ManualPaintControler.h"
class ManualPaintPanel {
public:
virtual ~ManualPaintPanel();
void SetActive( bool active );
- void SetManualPaintModel(ManualPaintModel* manualPaintModel);
+ void SetManualPaintControler(ManualPaintControler* manualPaintControler);
void SetBrushSize( int brushsize );
void SetGrayLevel( double graylevel );
void SetTool(int tool);
void GetScalarRange( double * range);
protected:
- ManualPaintModel *_manualPaintModel;
+ ManualPaintControler *_manualPaintControler;
};
_minX = 0;
_minY = 0;
_minZ = 0;
- _maxX = 0;
- _maxY = 0;
- _maxZ = 0;
- _pMinX = 0;
- _pMinY = 0;
- _pMinZ = 0;
- _pMaxX = 0;
- _pMaxY = 0;
- _pMaxZ = 0;
+
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// _maxX = 0;
+// _maxY = 0;
+// _maxZ = 0;
+// _pMinX = 0;
+// _pMinY = 0;
+// _pMinZ = 0;
+// _pMaxX = 0;
+// _pMaxY = 0;
+// _pMaxZ = 0;
+
+ _dimX = 0;
+ _dimY = 0;
+ _dimZ = 0;
_RangeMin = 0;
_RangeMax = 6000;
}
}
//---------------------------------------------------------------------------
-void baseFilterManualPaint::Run() // virtual
+void baseFilterManualPaint::Run(int px, int py, int pz) // virtual
{
}
_direction = direction;
}
+/* //EED 2020-04-28 BORRAME Change to local variables to use with openmp
//---------------------------------------------------------------------------
void baseFilterManualPaint::SetPoint(int px, int py, int pz)
{
_py = py;
_pz = pz;
}
-
+*/
+
//---------------------------------------------------------------------------
void baseFilterManualPaint::SetImages(vtkImageData *image, vtkImageData *image2)
{
_image2->GetExtent(extB);
#endif
- _maxX = std::min( ext[1]-ext[0] , extB[1]-extB[0] );
- _maxY = std::min( ext[3]-ext[2] , extB[3]-extB[2] );
- _maxZ = std::min( ext[5]-ext[4] , extB[5]-extB[4] );
+ _dimX = std::min( ext[1]-ext[0]+1 , extB[1]-extB[0]+1 );
+ _dimY = std::min( ext[3]-ext[2]+1 , extB[3]-extB[2]+1 );
+ _dimZ = std::min( ext[5]-ext[4]+1 , extB[5]-extB[4]+1 );
} else {
- _maxX = ext[1]-ext[0];
- _maxY = ext[3]-ext[2];
- _maxZ = ext[5]-ext[4];
+ _dimX = ext[1]-ext[0]+1;
+ _dimY = ext[3]-ext[2]+1;
+ _dimZ = ext[5]-ext[4]+1;
} // if
_OneColumn = 1;
- _OneLine = _maxX+1;
- _OnePlane = (_maxX+1)*(_maxY+1);
+ _OneLine = _dimX;
+ _OnePlane = _dimX*_dimY;
}
+
+/*//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+
//---------------------------------------------------------------------------
void baseFilterManualPaint::ResetGeneralMinMax()
{
if (_pMaxY < maxY) { _pMaxY = maxY; }
if (_pMaxZ < maxZ) { _pMaxZ = maxZ; }
}
+*/
+
//---------------------------------------------------------------------------
void baseFilterManualPaint::GetScalarRange(double * range)
public:
baseFilterManualPaint();
virtual ~baseFilterManualPaint();
-
virtual void SetImages(vtkImageData *image,vtkImageData *image2);
void SetPoint(int px, int py, int pz);
void Set2D3D(int dim2D3D);
void SetGrayLevel(double graylevel);
void SetDirection(int direction);
- void ResetGeneralMinMax();
- void SetGeneralMinMax(int minX, int maxX, int minY, int maxY, int minZ, int maxZ);
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// void ResetGeneralMinMax();
+// void SetGeneralMinMax(int minX, int maxX, int minY, int maxY, int minZ, int maxZ);
void GetScalarRange(double * range);
-
void SetRangeMin( int min );//DFCH
void SetRangeMax( int max );//DFCH
int GetRangeMin( ); //DFCH
int GetRangeMax( ); //DFCH
-
ImageMManager* GetImageMManager(); //DFCH
void CleanImageMManager(); //DFCH
- virtual void Run();
-
+ virtual void Run(int px, int py, int pz);
private:
-
protected:
ImageMManager *_IMManager; //Saves the last modified region (MinX, MaxX, MinY, MaxY, MinZ, MaxZ).
vtkImageData *_image;
vtkImageData *_image2;
int _direction;
- int _px; // start point of the brush
- int _py;
- int _pz;
- int _pMinX; // General min max of many brush actions
- int _pMinY;
- int _pMinZ;
- int _pMaxX;
- int _pMaxY;
- int _pMaxZ;
int _minX; // min max of the image
- int _maxX;
int _minY;
- int _maxY;
int _minZ;
- int _maxZ;
- long int _OneColumn;
- long int _OneLine;
- long int _OnePlane;
+
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+// int _px; // start point of the brush
+// int _py;
+// int _pz;
+// int _maxX;
+// int _maxY;
+// int _maxZ;
+// int _pMinX; // General min max of many brush actions
+// int _pMinY;
+// int _pMinZ;
+// int _pMaxX;
+// int _pMaxY;
+// int _pMaxZ;
+
+ int _dimX;
+ int _dimY;
+ int _dimZ;
bool _2D3D;
double _graylevel;
int _RangeMin;
int _RangeMax;
+//EED 2020-04-28 BORRAME Change to local variables to use with openmp
+ long int _OneColumn;
+ long int _OneLine;
+ long int _OnePlane;
+
};
//---------------------------------------------------------------------------
bool vtkInteractorManualPaint::OnLeftButtonDown()
{
- vtkRenderWindowInteractor *interactor =
- _vtkInteractorStyleBaseView->GetInteractor();
+ vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
if (interactor->GetControlKey() == 1) {
_state = true;
-// wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
-// _Z = wxvtk2Dbaseview->GetActualSlice();
+// wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+// _Z = wxvtk2Dbaseview->GetActualSlice();
}
return true;
}
{
if((_state == true) || (_stateKey == true))
{
- _manualPaintControler->SetImageUndo();
+// _manualPaintControler->SetImageUndo();
}
_state = false;
return true;
{
if ((_state == true) || (_stateKey == true))
{
- wxVtk2DBaseView *wxvtk2Dbaseview =
- (wxVtk2DBaseView*) _vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
- crea::wxVTKRenderWindowInteractor *wxVTKiren =
- wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*) _vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ crea::wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
int px, py;
wxVTKiren->GetEventPosition(px, py);
-
-// int typeView = 1;
double X = (double) px;
double Y = (double) py;
double Z = wxvtk2Dbaseview->GetActualSlice();
-// wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,true, typeView);
wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z, true);
-
- _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z);
+ _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z, wxvtk2Dbaseview->GetDirection() );
this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
- /*
- wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->Modified();
- wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor()->Modified();
- wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor()->SetDisplayExtent(0, 50+_auxZ, 0, 50,_Z, _Z );
- wxvtk2Dbaseview->Refresh();
- wxvtk2Dbaseview->RefreshView();
- // wxvtk2Dbaseview->SetActualSlice(_Z+_auxZ);
- _auxZ=(_auxZ+1)%2;
- wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->Render();
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- */
+ _manualPaintControler->SetImageUndo();
} // if _state
return true;
}
: wxPanel( parent, -1 )
{
wxSizer *sizer = new wxFlexGridSizer( 1 );
-
// Widget interface
- wxStaticText *tittleText = new wxStaticText( this, -1,
- _T(" Manual Paint") );
+ wxStaticText *tittleText = new wxStaticText( this, -1,_T(" Manual Paint") );
//Title
sizer->Add( tittleText );
//giving some blank spaces
sizer->Add( new wxStaticText( this, -1, _T(" key A : Enable/Disable ") ) );
-
this->ConfigureActiveCBButton( );
this->ConfigureBrushToolRadioButton( );
this->Configure2D3DRadioButton( );
this->ConfigureDistanceFillSld( );
this->ConfigureTolFillSld( );
this->ConfigureEditButtons( );
-
//Buttons
- wxStaticText *editButtonsText = new wxStaticText( this, -1,
- _T("Edit Buttons") );
- this->_buttonsSizer = new wxFlexGridSizer( 4 );
+ wxStaticText *editButtonsText = new wxStaticText( this, -1,_T("Edit Buttons") );
+ this->_buttonsSizer = new wxFlexGridSizer( 4 );
this->_buttonsSizer->Add( _btnUndo, 1, wxGROW );
this->_buttonsSizer->Add( _btnRedo, 1, wxGROW );
this->_buttonsSizer->Add( _btnCopy, 1, wxGROW );
-
this->_gConfigSizer = new wxFlexGridSizer( 1 );
//BrushTool Radio Button
//giving blank space
//2D/3D Radio Button
this->_gConfigSizer->Add( _rb2D3D, 1, wxGROW );
//RangeBar
- this->_gConfigSizer->Add(
- new wxStaticText( this, -1, _T( "Select Range" ) ), 1, wxGROW );
+ this->_gConfigSizer->Add( new wxStaticText( this, -1, _T( "Select Range" ) ), 1, wxGROW );
this->_gConfigSizer->Add( _mBarSlices, 1, wxGROW );
//GrayLevel Slider
this->_gConfigSizer->Add( _txtGrayLevel );
//giving blank space
this->_brushSizer->Add( new wxStaticText( this, -1, _T(" ") ) );
//end of blank space
- this->_brushSizer->Add(
- new wxStaticText( this, -1, _T("Brush Settings") ) );
+ this->_brushSizer->Add( new wxStaticText( this, -1, _T("Brush Settings") ) );
//BrushSize Slider
this->_brushSizer->Add( _txtBrushSize );
this->_FillSizer->Add( _txtToleranceFill );
wxFlexGridSizer *sizerTolerance = new wxFlexGridSizer( 2 );
sizerTolerance->Add( _sldToleranceFill, 1, wxGROW );
- sizerTolerance->Add( _tolerancefillCtrl, 1,
- wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
+ sizerTolerance->Add( _tolerancefillCtrl, 1, wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
this->_FillSizer->Add( sizerTolerance, 1, wxGROW );
//Distance Fill
this->_FillSizer->Add( _txtDistanceFill );
wxFlexGridSizer *sizerDistance = new wxFlexGridSizer( 2 );
sizerDistance->Add( _sldDistanceFill, 1, wxGROW );
- sizerDistance->Add( _distancefillCtrl, 1,
- wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
+ sizerDistance->Add( _distancefillCtrl, 1, wxALIGN_BOTTOM | wxALIGN_LEFT | wxALL, 5 );
this->_FillSizer->Add( sizerDistance );
-
sizer->Add( _activeCB );
sizer->Add( editButtonsText );
sizer->Add( _buttonsSizer );
sizer->Add( _gConfigSizer );
sizer->Add( _brushSizer );
sizer->Add( _FillSizer );
-
this->ConnectComponents( ); //DFCH
this->_FillSizer->Show( false );
-
this->SetSizer( sizer );
this->SetAutoLayout( true );
this->Layout( );
-
}
//---------------------------------------------------------------------------
_mBarSlices->SetStart( min );
_mBarSlices->SetEnd( max );
_mBarSlices->Update( );
-
SetRangeMin( min );
SetRangeMax( max );
-
//DFCH -- End BarSlices
}
+
//--------------------------------------------------------------------------
void wxManualPaintPanel::ConfigureGrayLevelSld( )
{
_graylevelCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
}
+
//--------------------------------------------------------------------------
void wxManualPaintPanel::ConfigureBrushSizeSld( )
{
_txtBrushSize = new wxStaticText( this, -1,
wxString( _T(" Brush size ") ) );
- _sldBrushSize = new wxSlider( this, -1, 1, 1, 50, wxDefaultPosition,
+ _sldBrushSize = new wxSlider( this, -1, 5, 1, 50, wxDefaultPosition,
wxDefaultSize, wxSL_LABELS );
_BrushSizeCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
_sldBrushSize->SetMinSize( wxSize( 200, -1 ) );
_sldBrushSize->SetMaxSize( wxSize( 200, -1 ) );
}
+
//--------------------------------------------------------------------------
void wxManualPaintPanel::ConfigureDistanceFillSld( )
{
_txtDistanceFill = new wxStaticText( this, -1,
wxString( _T(" Distance fill ") ) );
- _sldDistanceFill = new wxSlider( this, -1, 50, 1, 500, wxDefaultPosition,
+ _sldDistanceFill = new wxSlider( this, -1, 5, 1, 500, wxDefaultPosition,
wxDefaultSize, wxSL_LABELS );
_sldDistanceFill->SetMinSize( wxSize( 200, -1 ) );
_sldDistanceFill->SetMaxSize( wxSize( 200, -1 ) );
_sldDistanceFill->Disable( );
_distancefillCtrl->Disable( );
}
+
//--------------------------------------------------------------------------
void wxManualPaintPanel::ConfigureTolFillSld( )
{
- _txtToleranceFill = new wxStaticText( this, -1,
- wxString( _T(" Tolerance fill ") ) );
- _sldToleranceFill = new wxSlider( this, -1, 125, 0, 255, wxDefaultPosition,
- wxDefaultSize, wxSL_LABELS );
+ _txtToleranceFill = new wxStaticText( this, -1,wxString( _T(" Tolerance fill ") ) );
+ _sldToleranceFill = new wxSlider( this, -1, 125, 0, 255, wxDefaultPosition,wxDefaultSize, wxSL_LABELS );
_sldToleranceFill->SetMinSize( wxSize( 200, -1 ) );
_sldToleranceFill->SetMaxSize( wxSize( 200, -1 ) );
- _tolerancefillCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
- wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 50 );
+ _tolerancefillCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 50 );
_txtToleranceFill->Disable( );
_sldToleranceFill->Disable( );
_tolerancefillCtrl->Disable( );
-
}
+
//--------------------------------------------------------------------------
void wxManualPaintPanel::ConfigureEditButtons( )
{
_rbBrushTool->GetId(),
wxEVT_COMMAND_RADIOBOX_SELECTED,
(wxObjectEventFunction) (void(wxPanel::*)(
- wxCommandEvent&)) &wxManualPaintPanel::OnBrushTool);this->Connect
+ wxCommandEvent&)) &wxManualPaintPanel::OnTool);this->Connect
(
_btnCopy->GetId(),
wxEVT_COMMAND_BUTTON_CLICKED,
_activeCB->GetId(),
wxEVT_COMMAND_CHECKBOX_CLICKED,
(wxObjectEventFunction) (void (wxPanel::*)(wxCommandEvent&))&wxManualPaintPanel::OnActive);
-
}
//-------------------------------------------------------------------------
void wxManualPaintPanel::OnActive(wxCommandEvent& event)
{
- printf("EED wxManualPaintPanel::OnActive \n");
SetActive( _activeCB->GetValue() );
}
void wxManualPaintPanel::OnSldGrayLevel( wxScrollEvent& event )
{
SetGrayLevel( (double) ( _sldGrayLevel->GetValue( )) );
-
wxString text;
text.Printf( wxT("%d"), _sldGrayLevel->GetValue( ) );
_graylevelCtrl->SetValue( text );
void wxManualPaintPanel::OnSldDistanceFill( wxScrollEvent& event )
{
SetDistanceFill( (double) ( _sldDistanceFill->GetValue( )) );
-
wxString text;
text.Printf( wxT("%d"), _sldDistanceFill->GetValue( ) );
_distancefillCtrl->SetValue( text );
void wxManualPaintPanel::OnSldToleranceFill( wxScrollEvent& event )
{
SetToleranceFill( (double) ( _sldToleranceFill->GetValue( )) );
-
wxString text;
text.Printf( wxT("%d"), _sldToleranceFill->GetValue( ) );
_tolerancefillCtrl->SetValue( text );
}
//---------------------------------------------------------------------------
-void wxManualPaintPanel::OnBrushTool( wxCommandEvent &event )
+void wxManualPaintPanel::OnTool( wxCommandEvent &event )
{
DisableControls( );
SetTool( _rbBrushTool->GetSelection( ) );
_txtToleranceFill->Enable( );
_sldToleranceFill->Enable( );
_tolerancefillCtrl->Enable( );
-
_txtDistanceFill->Enable( );
_sldDistanceFill->Enable( );
_distancefillCtrl->Enable( );
//---------------------------------------------------------------------------
void wxManualPaintPanel::OnUndo( wxCommandEvent &event )
{
- this->_manualPaintModel->Undo( );
+ this->_manualPaintControler->Undo( );
}
//---------------------------------------------------------------------------
void wxManualPaintPanel::OnRedo( wxCommandEvent &event )
{
- this->_manualPaintModel->Redo( );
+ this->_manualPaintControler->Redo( );
}
//--------------------------------------------------------------------------------------------------------------------------------
void wxManualPaintPanel::onBarrange( wxCommandEvent& event )
{
}
+
void wxManualPaintPanel::onActualChange_Bar( wxCommandEvent& event )
{
/*mbbtkSliderMinMax->bbSetOutputOutActual(modBarRange->GetActual());
mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutActual"));*/
}
+
void wxManualPaintPanel::onStartChange_Bar( wxCommandEvent& event )
{
SetRangeMin( _mBarSlices->GetStart( ) );
void OnCtrTxtGrayLevel( wxCommandEvent &event );
void On2D3D( wxCommandEvent &event );
void OnBrushForm( wxCommandEvent &event );
- void OnBrushTool( wxCommandEvent &event );
+ void OnTool( wxCommandEvent &event );
void OnCopy( wxCommandEvent &event );
void OnUndo( wxCommandEvent &event );
void OnRedo( wxCommandEvent &event );
void onMovedBar( wxCommandEvent& event );
private:
- wxCheckBox *_activeCB;
+ wxCheckBox *_activeCB;
wxStaticText *_txtBrushSize;
- wxSlider *_sldBrushSize;
- wxSpinCtrl *_BrushSizeCtrl;
-
+ wxSlider *_sldBrushSize;
+ wxSpinCtrl *_BrushSizeCtrl;
wxStaticText *_txtGrayLevel;
- wxSlider *_sldGrayLevel;
- wxSpinCtrl *_graylevelCtrl;
- wxRadioBox *_rbBrushForm;
- wxRadioBox *_rb2D3D;
- wxRadioBox *_rbBrushTool;
-
+ wxSlider *_sldGrayLevel;
+ wxSpinCtrl *_graylevelCtrl;
+ wxRadioBox *_rbBrushForm;
+ wxRadioBox *_rb2D3D;
+ wxRadioBox *_rbBrushTool;
wxStaticText *_txtToleranceFill;
- wxSlider *_sldToleranceFill;
- wxSpinCtrl *_tolerancefillCtrl;
-
+ wxSlider *_sldToleranceFill;
+ wxSpinCtrl *_tolerancefillCtrl;
wxStaticText *_txtDistanceFill;
- wxSlider *_sldDistanceFill;
- wxSpinCtrl *_distancefillCtrl;
-
- mBarRange *_mBarSlices; //DFCH
- wxButton *_btnCopy; //DFCH
- wxButton *_btnUndo; //DFCH
- wxButton *_btnRedo; //DFCH
-
+ wxSlider *_sldDistanceFill;
+ wxSpinCtrl *_distancefillCtrl;
+ mBarRange *_mBarSlices; //DFCH
+ wxButton *_btnCopy; //DFCH
+ wxButton *_btnUndo; //DFCH
+ wxButton *_btnRedo; //DFCH
wxFlexGridSizer *_buttonsSizer; //DFCH
wxFlexGridSizer *_FillSizer; //DFCH
wxFlexGridSizer *_gConfigSizer; //DFCH
//wxDefaultSize
mBarRange::mBarRange(wxWindow *parent, int w, int h)
-:wxScrolledWindow(parent,-1,wxDefaultPosition, wxSize(60,60) ,wxTAB_TRAVERSAL)
+//EED-2019-10-25 :wxScrolledWindow(parent,-1,wxDefaultPosition, wxSize(60,60) ,wxTAB_TRAVERSAL)
+ :wxPanel(parent,-1,wxDefaultPosition, wxSize(60,60) ,wxTAB_TRAVERSAL)
{
acceptedClick = true;
_bitmap_bar = NULL;
mBarRange::~mBarRange()
{
+ DeletePendingEvents ();
+ RemoveEventHandler ( GetEventHandler() );
}
//---------------------------------------------------------------------------
if(_orientation)
{
SetWindowStyle(wxNO_FULL_REPAINT_ON_RESIZE);
- _bitmap_bar = new wxBitmap(_w+1280,_h+100);
+ _bitmap_bar = new wxBitmap(_w+1280,_h+100);
//SIL//_bitmap_info = new wxBitmap(_w+100+1280, _h+100);
- }
- //vertical
- else
- {
+ } else {
SetWindowStyle(wxNO_FULL_REPAINT_ON_RESIZE);
- _bitmap_bar = new wxBitmap(_h+deviceStart_y+100,_w+1280);
- _bitmap_info = new wxBitmap(_h+deviceStart_y+100, _w+1280);
+ _bitmap_bar = new wxBitmap(_h+deviceStart_y+100,_w+1280);
+ _bitmap_info = new wxBitmap(_h+deviceStart_y+100, _w+1280);
}
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void mBarRange::SetInRangeProperty(bool in)
{
- _in_rangeProperty=in;
+ _in_rangeProperty = in;
}
//----------------------------------------------------------------------------
//the information about the actual triangle in range or not, true if is between start and end
void mBarRange::Refresh(bool eraseBackground, const wxRect* rect)
{
- wxScrolledWindow::Refresh(false);
+//EED2019-10-25 wxScrolledWindow::Refresh(false);
+ wxPanel::Refresh(false);
}
if (barHeight <=_h)
{
bool in_StartTri = (clickedX>=GetPixelStart()-5+ deviceStart_x) && (clickedX<=GetPixelStart()+5+ deviceStart_x);
- bool in_EndTri = (clickedX>=GetPixelEnd()-5+ deviceStart_x) && (clickedX<=GetPixelEnd()+5+ deviceStart_x);
- bool in_actualT= withActualDrawed && (clickedX>=GetPixelActual()-5+ deviceStart_x) && (clickedX<=GetPixelActual()+5+ deviceStart_x);
- bool in_movingBar = (clickedX>GetPixelStart()+5+ deviceStart_x) && (clickedX<GetPixelEnd()-5+ deviceStart_x);
+ bool in_EndTri = (clickedX>=GetPixelEnd()-5+ deviceStart_x) && (clickedX<=GetPixelEnd()+5+ deviceStart_x);
+ bool in_actualT = withActualDrawed && (clickedX>=GetPixelActual()-5+ deviceStart_x) && (clickedX<=GetPixelActual()+5+ deviceStart_x);
+ bool in_movingBar= (clickedX>GetPixelStart()+5+ deviceStart_x) && (clickedX<GetPixelEnd()-5+ deviceStart_x);
if( in_actualT )
_selectionMoveId = 3;
else if( in_movingBar )
_selectionMoveId = 4;
}
- }
- else
- {
+ } else {
if(acceptedClick)
{
//is in start triagle
*/
void mBarRange :: setRepresentedValues ( double minRealValue, double maxRealValue)
{
- _min = minRealValue;
- _max = maxRealValue;
- _start=_min;
- _end=_max;
+ _min = minRealValue;
+ _max = maxRealValue;
+ _start =_min;
+ _end =_max;
}
/*
SetPixelStart(deviceStart_x);
SetPixelEnd(_w+deviceStart_x);
SetPixelActual(deviceStart_x);
- }
- else
- {
+ } else {
SetPixelStart(deviceStart_x);
SetPixelEnd(_h+deviceStart_x);
SetPixelActual(deviceStart_x);
if (getClickedX()<=_h)
{
- bool in_StartTri = (clickedX>=GetPixelStart()-5+ deviceStart_x) && (clickedX<=GetPixelStart()+5+ deviceStart_x);
- bool in_EndTri = (clickedX>=GetPixelEnd()-5+ deviceStart_x) && (clickedX<=GetPixelEnd()+5+ deviceStart_x);
- bool in_actualT= (clickedX>=GetPixelActual()-5+ deviceStart_x) && (clickedX<=GetPixelActual()+5+ deviceStart_x);
- bool in_movingBar = (clickedX>GetPixelStart()+5+ deviceStart_x) && (clickedX<GetPixelEnd()-5+ deviceStart_x);
+ bool in_StartTri = (clickedX>=GetPixelStart()-5+ deviceStart_x) && (clickedX<=GetPixelStart()+5+ deviceStart_x);
+ bool in_EndTri = (clickedX>=GetPixelEnd()-5+ deviceStart_x) && (clickedX<=GetPixelEnd()+5+ deviceStart_x);
+ bool in_actualT = (clickedX>=GetPixelActual()-5+ deviceStart_x) && (clickedX<=GetPixelActual()+5+ deviceStart_x);
+ bool in_movingBar = (clickedX>GetPixelStart()+5+ deviceStart_x) && (clickedX<GetPixelEnd()-5+ deviceStart_x);
if(in_StartTri)
_selectionMoveId = 1;
};
-class creaMaracasVisu_EXPORT mBarRange :public wxScrolledWindow{
+class creaMaracasVisu_EXPORT mBarRange :public wxPanel{
+//EED-2019-10-25 class creaMaracasVisu_EXPORT mBarRange :public wxScrolledWindow{
public:
//------------------------------------
//Constructors & Destructors
//-------------------------------------------------------------------
vtkBaseData::vtkBaseData()
{
- _z = 0;
- _t = 0;
- _marImageData = 0;
- _interpolate = true;
- _fixAxis2D = false;
- _opacityAxis = 0.5;
- _observable = vtkObject::New();
+ _z = 0;
+ _t = 0;
+ _marImageData = 0;
+ _interpolate = true;
+ _fixAxis2D = false;
+ _opacityAxis = 1.0;
+ _observable = vtkObject::New();
+ _cameraparallelScale = 100.0;
}
//-------------------------------------------------------------------
{
_opacityAxis = value;
}
+
+//-------------------------------------------------------------------
+double vtkBaseData::GetCameraParallelScale()
+{
+ return _cameraparallelScale;
+}
+
+//-------------------------------------------------------------------
+void vtkBaseData::SetCameraParallelScale(double value)
+{
+ _cameraparallelScale=value;
+}
+
+
+
bool GetFixAxis2D();
void SetFixAxis2D(bool value);
double GetOpacityAxis();
- void SetOpacityAxis(double value);
-
+ void SetOpacityAxis(double value);
+ double GetCameraParallelScale();
+ void SetCameraParallelScale(double value);
+
protected:
marImageData *_marImageData;
double _z;
bool _fixAxis2D;
double _opacityAxis;
vtkObject* _observable;
+ double _cameraparallelScale;
private:
};
vtkClipping3DDataViewer::~vtkClipping3DDataViewer()
{
int i;
- for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
+ for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
+ {
_mCubes[i]->Delete();
_tissueStripper[i]->Delete();
_tissueMapper[i]->Delete();
_tissuePlanes[i]->Delete();
_tissueClipper[i]->Delete();
- }
+ } // for i
// Volume
_tfun->Delete();
if(_interpolation)
{
_volumeProperty->SetInterpolationTypeToLinear();
- }
- else
- {
+ } else {
_volumeProperty->SetInterpolationTypeToNearest();
- }
+ } // if _interpolation
if(_shade)
{
_volumeProperty->ShadeOn();
- }
- else
- {
+ } else {
_volumeProperty->ShadeOff();
- }
+ } // if _shade
}
#include "vtkColorTransferFunction.h"
#include "vtkVolume.h"
#include "vtkActor.h"
-#include "vtkOutlineFilter.h"
+//#include "vtkOutlineFilter.h"
#include "vtkRenderWindowInteractor.h"
int vtkClosePolyData::RequestData( vtkInformation *vtkNotUsed(request), vtkInformationVector **inputVector, vtkInformationVector *outputVector)
{
// get the info objects
- vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
- vtkInformation *outInfo = outputVector->GetInformationObject(0);
+ vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+ vtkInformation *outInfo = outputVector->GetInformationObject(0);
// get the input and output
- vtkPolyData *input = vtkPolyData::SafeDownCast( inInfo->Get(vtkDataObject::DATA_OBJECT()));
- vtkPolyData *output = vtkPolyData::SafeDownCast( outInfo->Get(vtkDataObject::DATA_OBJECT()));
+ vtkPolyData *input = vtkPolyData::SafeDownCast( inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ vtkPolyData *output = vtkPolyData::SafeDownCast( outInfo->Get(vtkDataObject::DATA_OBJECT()));
//#closing the polydata see : close.py for details
- vtkFeatureEdges *boundary = vtkFeatureEdges::New();
+
+ vtkFeatureEdges *boundary = vtkFeatureEdges::New();
boundary->SetInputData( input );
boundary->BoundaryEdgesOn ();
boundary->FeatureEdgesOff ();
boundary->NonManifoldEdgesOff ();
boundary->ManifoldEdgesOff ();
- //boundary->ColoringOff ();
+ // boundary->ColoringOff ();
+ boundary->Update();
+
vtkStripper *stripper = vtkStripper::New();
- stripper->SetInputData( boundary->GetOutput() );
+ stripper->SetInputConnection( boundary->GetOutputPort() );
stripper->Update(); //important
- boundary->Delete();
+
vtkPolyData *pd = vtkPolyData::New();
pd->SetPoints ( stripper->GetOutput()->GetPoints() );
pd->SetPolys ( stripper->GetOutput()->GetLines() );
- stripper->Delete();
//vtkGLUTesselatorTriangleFilter *triangle = vtkGLUTesselatorTriangleFilter::New();
+
vtkTriangleFilter *triangle = vtkTriangleFilter::New();
triangle->SetInputData( pd );
- pd->Delete();
+ triangle->Update( );
+
vtkAppendPolyData *append = vtkAppendPolyData::New();
append->AddInputData( input );
- append->AddInputData( triangle->GetOutput() );
- triangle->Delete();
+ append->AddInputConnection( triangle->GetOutputPort() );
+ append->Update();
+
vtkCleanPolyData *clean = vtkCleanPolyData::New();
- clean->SetInputData( append->GetOutput());
- append->Delete();
+ clean->SetInputConnection( append->GetOutputPort());
// When all optimizations are complete, this squeeze will be unecessary.
// (But it does not seem to cost much.)
clean->Update(); //important before ShallowCopy
+
output->ShallowCopy( clean->GetOutput() );
- clean->Delete();
+
+ append -> Delete();
+ clean -> Delete();
+ boundary -> Delete();
+ stripper -> Delete();
+ pd -> Delete();
+ triangle -> Delete();
+
return 1;
}
#include "vtkRenderer.h"
#include "vtkImageActor.h"
#include "vtkImageData.h"
+
+
+
+
+
//-------------------------------------------------------------------
//-------------------------------------------------------------------
//-------------------------------------------------------------------
vtkImageViewer2_XYZ::vtkImageViewer2_XYZ()
{
- _vtkimageviewer2= vtkImageViewer2::New();
+ _colortable = NULL;
+ _vtkimageviewer2 = vtkImageViewer2::New();
_vtkimageviewer2->GetRenderer()->GradientBackgroundOn();
_vtkimageviewer2->GetRenderer()->SetBackground( 0.33 , 0.33 , 0.33 );
_vtkimageviewer2->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );
- _colortable = NULL;
}
+
//-------------------------------------------------------------------
vtkImageViewer2_XYZ::~vtkImageViewer2_XYZ()
{
//_vtkimageviewer2->Delete();
}
+
//-------------------------------------------------------------------
void vtkImageViewer2_XYZ::SetExtentDimension(int x1,int x2,
int y1,int y2,
{
return _vtkimageviewer2;
}
+
//-------------------------------------------------------------------
void vtkImageViewer2_XYZ::setColorTransferFunction(vtkColorTransferFunction* colortable)
{
- vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _vtkimageviewer2->GetWindowLevel();
- if(colortable!=NULL&&colortable->GetSize()>0 && _colortable != colortable)
+ if(colortable!=NULL && colortable->GetSize()>0 && _colortable!=colortable)
{
_colortable = colortable;
- imagemaptowindowlevel->SetLookupTable(colortable);
- }
+ vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _vtkimageviewer2->GetWindowLevel();
+ imagemaptowindowlevel->SetLookupTable(_colortable);
+ } // if colortable
}
+
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::setScalarsToColors(vtkScalarsToColors* colortable, int outputformat)
+{
+/* outputformat VTK-8.1.1/Common/Core/vtkSystemIncludes.h
+ VTK_LUMINANCE 1
+ VTK_LUMINANCE_ALPHA 2
+ VTK_RGB 3 OK
+ VTK_RGBA 4
+*/
+ if( _colortable!=colortable)
+ {
+ _colortable = colortable;
+ _vtkimageviewer2->GetWindowLevel()->SetOutputFormat( outputformat );
+ _vtkimageviewer2->GetWindowLevel()->SetLookupTable(colortable);
+ _vtkimageviewer2->GetWindowLevel()->SetOutputFormatToRGB();
+// vtkLookupTableDirectionVector2 *_LutEED = vtkLookupTableDirectionVector2::New();
+// _LutEED->SetVectorModeToRGBColors();
+// _vtkimageviewer2->GetWindowLevel()->SetLookupTable(_LutEED);
+ } // if colortable
+}
+
+
#include "vtkImageMapToWindowLevelColors.h"
#include "vtkColorTransferFunction.h"
-class creaMaracasVisu_EXPORT vtkImageViewer2_XYZ{
+class creaMaracasVisu_EXPORT vtkImageViewer2_XYZ
+{
public:
vtkImageViewer2_XYZ();
~vtkImageViewer2_XYZ();
int GetXSlice();
int GetYSlice();
int GetZSlice();
- void setColorTransferFunction(vtkColorTransferFunction* colortable);
+ void setColorTransferFunction(vtkColorTransferFunction* colortable);
+ void setScalarsToColors(vtkScalarsToColors* colortable, int outputformat);
vtkImageViewer2 *GetVtkImageViewer2();
private:
- int _x1,_x2,_y1,_y2,_z1,_z2;
- vtkImageViewer2 *_vtkimageviewer2;
- vtkColorTransferFunction* _colortable;
+ int _x1,_x2,_y1,_y2,_z1,_z2;
+ vtkImageViewer2 *_vtkimageviewer2;
+ vtkScalarsToColors *_colortable;
protected:
};
#include "vtkInfoTextImage.h"
+#include "vtkProperty2D.h"
#include "vtkTextProperty.h"
#include <vtkImageMapToWindowLevelColors.h>
//-------------------------------------------------------------------
_vtkText_ColorLevel = NULL;
_vtkText_position = NULL;
_vtkText_pixelIntensity = NULL;
+ _vtkText_plane = NULL;
_marimagedata = NULL;
}
void vtkInfoTextImage::Configure()
{
if(_vtkText_WindowLevel == NULL){
- _vtkText_WindowLevel = Create_Text_Label( 10 , 55 );
- _vtkText_ColorLevel = Create_Text_Label( 10 , 40 );
- _vtkText_position = Create_Text_Label( 10 , 25 );
- _vtkText_pixelIntensity = Create_Text_Label( 10 , 10 );
- }
+ _vtkText_WindowLevel = Create_Text_Label( 10 , 60 );
+ _vtkText_ColorLevel = Create_Text_Label( 10 , 45 );
+ _vtkText_position = Create_Text_Label( 10 , 30 );
+ _vtkText_pixelIntensity = Create_Text_Label( 10 , 15 );
+ _vtkText_plane = Create_Text_Label( 10 , 0 );
+ } // if vtkText_WindowLevel
}
+void vtkInfoTextImage::SetOpacity(double opacity)
+{
+ if (_vtkText_WindowLevel!=NULL)
+ {
+ _vtkText_WindowLevel->GetProperty()->SetOpacity( opacity );
+ }
+ if (_vtkText_ColorLevel!=NULL)
+ {
+ _vtkText_ColorLevel->GetProperty()->SetOpacity( opacity );
+ }
+ if (_vtkText_position!=NULL)
+ {
+ _vtkText_position->GetProperty()->SetOpacity( opacity );
+ }
+ if (_vtkText_pixelIntensity!=NULL)
+ {
+ _vtkText_pixelIntensity->GetProperty()->SetOpacity( opacity );
+ }
+ if (_vtkText_plane!=NULL)
+ {
+ _vtkText_plane->GetProperty()->SetOpacity( opacity );
+ }
+}
//-------------------------------------------------------------------
void vtkInfoTextImage::SetMarImageData(marImageData *marimagedata)
{
- _marimagedata=marimagedata;
+ _marimagedata = marimagedata;
}
//-------------------------------------------------------------------
void vtkInfoTextImage::SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview)
{
- _wxvtk2Dbaseview=wxvtk2Dbaseview;
+ _wxvtk2Dbaseview = wxvtk2Dbaseview;
}
//-------------------------------------------------------------------
vtkTextActor *textActor = vtkTextActor::New();
textActor->SetDisplayPosition(px, py);
textActor->SetInput("0");
-
// Set coordinates to match the old vtkScaledTextActor default value
textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
-
vtkTextProperty *tprop = textActor->GetTextProperty();
tprop->SetFontSize(14);
tprop->SetFontFamilyToArial();
tprop->SetColor(1, 1, 0);
_wxvtk2Dbaseview->GetRenderer()->AddActor2D(textActor);
-
return textActor;
}
double value = _wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->GetWindow() ;
char zTzxt[20];
char resultText[50];
-
strcpy(resultText,"w:");
-
-
- //ltoa ( (long)value , zTzxt , 10 );
sprintf(zTzxt,"%3.4f",value);
-
strcat(resultText,zTzxt);
_vtkText_WindowLevel -> SetInput(resultText);
}
double value = _wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->GetLevel();
char zTzxt[20];
char resultText[50];
-
strcpy(resultText,"c:");
-
// itoa (value,zTzxt,10);
sprintf(zTzxt,"%3.2f",value);
-
strcat(resultText,zTzxt);
_vtkText_ColorLevel -> SetInput(resultText);
}
//-------------------------------------------------------------------
-
-void vtkInfoTextImage::PutPosition(int xx,int yy, int zz)
+void vtkInfoTextImage::PutPlane()
{
+ int plane = _wxvtk2Dbaseview->GetDirection();
+ char zTzxt[20];
+ char resultText[50];
+ if (plane==0) { strcpy(resultText,"plane:YZ"); }
+ if (plane==1) { strcpy(resultText,"plane:XZ"); }
+ if (plane==2) { strcpy(resultText,"plane:XY"); }
+ _vtkText_plane -> SetInput(resultText);
+}
-//EEDx7
-// double spa[3];
-// _imagedata->GetSpacing(spa);
-// xx=xx*(1/spa[0]);
-// yy=yy*(1/spa[1]);
-
+//-------------------------------------------------------------------
+void vtkInfoTextImage::PutPosition(int xx,int yy, int zz)
+{
char zTzxt[50];
char resultText[50];
strcpy(resultText,"p: ");
-// itoa ((int)xx,zTzxt,10);
sprintf(zTzxt,"%d",xx);
-
strcat(resultText,zTzxt);
strcat(resultText," , ");
-
-// itoa ((int)yy,zTzxt,10);
sprintf(zTzxt,"%d",yy);
-
strcat(resultText,zTzxt);
strcat(resultText," , ");
-
-// itoa ((int)zz,zTzxt,10);
sprintf(zTzxt,"%d",zz);
-
strcat(resultText,zTzxt);
-
-
-
int nX = _marimagedata->GetXOriginal(xx);
int nY = _marimagedata->GetYOriginal(yy);
int nZ = _marimagedata->GetZOriginal(zz);
-
strcat(resultText," (");
-// ltoa ((int)nX,zTzxt,10);
sprintf(zTzxt,"%d",nX);
-
strcat(resultText,zTzxt);
strcat(resultText,",");
-
-// ltoa ((int)nY,zTzxt,10);
sprintf(zTzxt,"%d",nY);
-
strcat(resultText,zTzxt);
strcat(resultText,",");
-
-// ltoa ((int)nZ,zTzxt,10);
sprintf(zTzxt,"%d",nZ);
-
strcat(resultText,zTzxt);
strcat(resultText,")");
-
-
-
-
_vtkText_position -> SetInput(resultText);
}
void vtkInfoTextImage::PutPixelIntensity(int xx, int yy, int zz)
{
-
-//EEDx2
bool ok=true;
-
int dim[3];
double spa[3];
vtkImageData *imagedata = _marimagedata->GetImageData();
imagedata->GetDimensions(dim);
imagedata->GetSpacing(spa);
-
-// EEDx7
-// xx=xx*(1/spa[0]);
-// yy=yy*(1/spa[1]);
-// zz=xx*spa[2];
-
if ( (xx<0) || (xx>=dim[0]) || (yy<0) || (yy>=dim[1]) || (zz<0) || (zz>=dim[2]) )
{
ok=false;
}
-
-
char zTzxt[20];
char resultText[50];
strcpy(resultText,"GL: ");
if (imagedata->GetScalarType()==VTK_BIT)
{
char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
if(*pOrg==0)
{
sprintf(zTzxt,"%d",0);
- }
- else
- {
+ } else {
sprintf(zTzxt,"%d",1);
- }
- }
-
- else if (imagedata->GetScalarType()==VTK_CHAR)
- {
+ } // if pOrg
+ } else if (imagedata->GetScalarType()==VTK_CHAR) {
char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
int tmp=*pOrg;
sprintf(zTzxt,"%d",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_SIGNED_CHAR)
- {
+ } else if (imagedata->GetScalarType()==VTK_SIGNED_CHAR) {
signed char *pOrg=(signed char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
int tmp=*pOrg;
sprintf(zTzxt,"%d",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
- {
+ } else if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR) {
unsigned char *pOrg=(unsigned char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
int tmp=*pOrg;
sprintf(zTzxt,"%d",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_SHORT)
- {
+ } else if (imagedata->GetScalarType()==VTK_SHORT) {
short *pOrg=(short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
int tmp=*pOrg;
sprintf(zTzxt,"%d",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
- {
+ } else if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT) {
unsigned short *pOrg=(unsigned short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
int tmp=*pOrg;
sprintf(zTzxt,"%d",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_INT)
- {
+ } else if (imagedata->GetScalarType()==VTK_INT) {
int *pOrg=(int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
sprintf(zTzxt,"%d",*pOrg);
- }
-
- else if (imagedata->GetScalarType()==VTK_UNSIGNED_INT)
- {
+ } else if (imagedata->GetScalarType()==VTK_UNSIGNED_INT) {
unsigned int *pOrg=(unsigned int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
int tmp=*pOrg;
sprintf(zTzxt,"%d",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_LONG)
- {
+ } else if (imagedata->GetScalarType()==VTK_LONG) {
long *pOrg=(long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
double tmp=*pOrg;
sprintf(zTzxt,"%3.4f",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG)
- {
+ } else if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG) {
unsigned long *pOrg=(unsigned long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
double tmp=*pOrg;
sprintf(zTzxt,"%3.4f",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_FLOAT)
- {
+ } else if (imagedata->GetScalarType()==VTK_FLOAT) {
float *pOrg=(float*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
double tmp=(double)*pOrg;
sprintf(zTzxt,"%3.4f",tmp);
- }
-
- else if (imagedata->GetScalarType()==VTK_DOUBLE)
- {
+ } else if (imagedata->GetScalarType()==VTK_DOUBLE) {
double *pOrg=(double*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
// itoa (*pOrg,zTzxt,10);
double tmp=*pOrg;
sprintf(zTzxt,"%3.4f",tmp);
- }
- }
- else
- {
+ } // if imagedata Type
+ } else {
strcpy(zTzxt,"---");
- }
+ } // if ok
strcat(resultText,zTzxt);
_vtkText_pixelIntensity -> SetInput(resultText);
}
void PutPosition(int x, int y, int z);
void PutColorLevel();
void PutWindowLevel();
+ void PutPlane();
+ void SetOpacity(double opacity);
protected:
vtkTextActor *_vtkText_ColorLevel;
vtkTextActor *_vtkText_position;
vtkTextActor *_vtkText_pixelIntensity;
+ vtkTextActor *_vtkText_plane;
vtkTextActor *Create_Text_Label(int px, int py);
};
GetVtkInfoTextImage()->PutWindowLevel();
GetVtkInfoTextImage()->PutColorLevel();
+ GetVtkInfoTextImage()->PutPlane();
int tempext[6];
((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetImageData()->GetExtent(tempext);
//---------------------------------------------------------------------------
bool vtkInteractorScrollZ::OnMouseMove ()
{
- if (_stateFordware==true){
- //int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0]; // JPRx
- int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- double delta = (_fordwareY - fy)/(3.0*3);
- /*JCP 14/05/2009
- _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->SetActualSlice( _sliceZ + delta);
- */
+ if (_stateFordware==true)
+ {
+ int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ double delta = (_fordwareY - fy)/(20.0);
+ int direction = ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetDirection( );
+ if ( (direction==0) || (direction==2) )
+ {
+ delta=(-1)*delta;
+ } // if direction
((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->SetActualSlice( _sliceZ + (int)delta );
-
this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
- // wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);
- // _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent);
-
-//EED 21 oct 2010
-//printf("EED vtkInteractorScrollZ::OnMouseMove \n");
-// ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->Refresh();
- }
+ } // if _stateFordware
return true;
}
//
// _vtkInteractorScrollZ = new vtkInteractorScrollZ();
// AddInteractorStyleMaracas(_vtkInteractorScrollZ);
+ //
+ //_vtkInteractorZoomCamera = interactorZoomcamera;
+ //AddInteractorStyleMaracas(_vtkInteractorZoomCamera);
+ //
+ //
////////////
}
//---------------------------------------------------------------------------
AddInteractorStyleMaracas(_manualinteractorwindowlevel);
}
+
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView2D::SetInteractorZoomCamera(vtkInteractorZoomCamera* interactorZoomcamera)
+{
+ _vtkInteractorZoomCamera = interactorZoomcamera;
+ AddInteractorStyleMaracas(_vtkInteractorZoomCamera);
+}
+
+
//---------------------------------------------------------------------------
void vtkInteractorStyleBaseView2D::OnRightButtonDown() // virtual
{
#define VTKINTERACTORSTYLEBASEVIEW2D_H_
#include "vtkInteractorScrollZ.h"
+#include "vtkInteractorZoomCamera.h"
#include "manualInteractorWindowLevel.h"
//------------------------------------------------------------------
// RaC 04-2010 Look for the description of new changes in vtkInteractorStyleBaseView2D constructor.
void SetInteractorScrollZ(vtkInteractorScrollZ* interactorScroll);
void SetInteractorWindowLevel(manualInteractorWindowLevel* interactorWindowLevel);
+ void SetInteractorZoomCamera(vtkInteractorZoomCamera* interactorZoomcamera);
+
virtual void OnMouseMove();
virtual void OnLeftButtonDown();
private:
manualInteractorWindowLevel *_manualinteractorwindowlevel;
vtkInteractorScrollZ *_vtkInteractorScrollZ;
+ vtkInteractorZoomCamera *_vtkInteractorZoomCamera;
};
--- /dev/null
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
+
+#include "vtkInteractorZoomCamera.h"
+#include "wxVtk2DBaseView.h"
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+
+vtkInteractorZoomCamera::vtkInteractorZoomCamera()
+{
+}
+
+//---------------------------------------------------------------------------
+vtkInteractorZoomCamera::~vtkInteractorZoomCamera()
+{
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorZoomCamera::OnRightButtonDown()
+{
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorZoomCamera::OnRightButtonUp()
+{
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorZoomCamera::OnMouseMove ()
+{
+ SetZoomCamera();
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorZoomCamera::OnMouseWheelForward()
+{
+ SetZoomCamera();
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorZoomCamera::OnMouseWheelBackward()
+{
+ SetZoomCamera();
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorZoomCamera::SetZoomCamera()
+{
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ vtkBaseData *vtkbasedata = wxvtk2Dbaseview->GetVtkBaseData();
+ double parallelscaling=wxvtk2Dbaseview->GetRenderer()->GetActiveCamera()->GetParallelScale();
+ vtkbasedata->SetCameraParallelScale( parallelscaling );
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+}
+
--- /dev/null
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
+#ifndef VTKINTERACTORZOOMCAMERA_H_
+#define VTKINTERACTORZOOMCAMERA_H_
+
+#include "InteractorStyleMaracas.h"
+
+class vtkInteractorZoomCamera : public InteractorStyleMaracas {
+public:
+ vtkInteractorZoomCamera();
+ virtual ~vtkInteractorZoomCamera();
+ virtual bool OnMouseMove();
+ virtual bool OnRightButtonDown();
+ virtual bool OnRightButtonUp();
+ virtual bool OnMouseWheelForward();
+ virtual bool OnMouseWheelBackward();
+
+ void SetZoomCamera();
+
+
+protected:
+private:
+
+};
+
+#endif /*VTKINTERACTORSCROLLZ_H_*/
//-------------------------------------------------------------------
vtkMPR3DDataViewer::~vtkMPR3DDataViewer()
{
- if(_outlineData) {_outlineData-> Delete();}
- if(_mapOutline) {_mapOutline-> Delete();}
- if(_outline) {_outline-> Delete();}
-
-// if (_bwLut) _bwLut->Delete();
-// if (_hueLut) _hueLut->Delete();
-// if (_satLut) _satLut->Delete();
- if (_ctfun) _ctfun->Delete();
- if (_saggitalColors) _saggitalColors ->Delete();
- if (_saggital) _saggital->Delete();
- if (_axialColors) _axialColors->Delete();
- if (_axial) _axial->Delete();
- if (_coronalColors) _coronalColors->Delete();
- if (_coronal) _coronal->Delete();
-
+ if(_outlineData) {_outlineData -> Delete();}
+ if(_mapOutline) {_mapOutline -> Delete();}
+ if(_outline) {_outline -> Delete();}
+// if (_bwLut) {_bwLut -> Delete();}
+// if (_hueLut) {_hueLut -> Delete();}
+// if (_satLut) {_satLut -> Delete();}
+ if (_ctfun) {_ctfun -> Delete();}
+ if (_saggitalColors) {_saggitalColors -> Delete();}
+ if (_saggital) {_saggital -> Delete();}
+ if (_axialColors) {_axialColors -> Delete();}
+ if (_axial) {_axial -> Delete();}
+ if (_coronalColors) {_coronalColors -> Delete();}
+ if (_coronal) {_coronal -> Delete();}
}
+
//-------------------------------------------------------------------
vtkActor* vtkMPR3DDataViewer::GetOutlineActor()
{
return _outline;
}
+
//-------------------------------------------------------------------
vtkImageActor* vtkMPR3DDataViewer::GetImageActor(int id)
{
{
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- _saggitalColors ->SetInput( _vtkmprbasedata->GetImageData() );
- _axialColors ->SetInput( _vtkmprbasedata->GetImageData() );
- _coronalColors ->SetInput( _vtkmprbasedata->GetImageData() );
- _outlineData ->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+ _saggitalColors -> SetInput( _vtkmprbasedata->GetImageData() );
+ _axialColors -> SetInput( _vtkmprbasedata->GetImageData() );
+ _coronalColors -> SetInput( _vtkmprbasedata->GetImageData() );
+ _outlineData -> SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
#else
- _saggitalColors ->SetInputData( _vtkmprbasedata->GetImageData() );
- _axialColors ->SetInputData( _vtkmprbasedata->GetImageData() );
- _coronalColors ->SetInputData( _vtkmprbasedata->GetImageData() );
- _outlineData ->SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+ _saggitalColors -> SetInputData( _vtkmprbasedata->GetImageData() );
+ _axialColors -> SetInputData( _vtkmprbasedata->GetImageData() );
+ _coronalColors -> SetInputData( _vtkmprbasedata->GetImageData() );
+
+//EED 2020-01-27 this is to slow ??? how can we accelerated
+// _saggitalColors -> Update();
+// _axialColors -> Update();
+// _coronalColors -> Update();
+
+ _outlineData -> SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() );
#endif
}
+
//-------------------------------------------------------------------
void vtkMPR3DDataViewer::Configure()
{
void SetPositionZ(int pos);
void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
vtkMPRBaseData* GetVtkMPRBaseData();
-
vtkColorTransferFunction *GetvtkColorTransferFunction();
std::vector<double > *GetctFunVectorPoint();
std::vector<double > *GetctFunVectorRed();
std::vector<double > *GetctFunVectorGreen();
std::vector<double > *GetctFunVectorBlue();
-
void setColorTransferFunction(vtkColorTransferFunction* colortable);
-
private:
-
bool _visiblePosition[3];
-
// outline
vtkOutlineFilter *_outlineData;
vtkPolyDataMapper *_mapOutline;
vtkActor *_outline;
-
//
vtkColorTransferFunction *_ctfun;
std::vector<double> _ctFunVectorPoint;
std::vector<double> _ctFunVectorRed;
std::vector<double> _ctFunVectorGreen;
std::vector<double> _ctFunVectorBlue;
-
// vtkLookupTable *_bwLut;
// vtkLookupTable *_hueLut;
// vtkLookupTable *_satLut;
-
vtkImageMapToColors *_saggitalColors;
vtkImageActor *_saggital;
vtkImageMapToColors *_axialColors;
vtkImageMapToColors *_coronalColors;
vtkImageActor *_coronal;
vtkMPRBaseData *_vtkmprbasedata;
-
-
};
#endif /*VTKMPR3DDATAVIEWER_H_*/
private:
double _x,_y;
vtkTransform *_transformOrientation;
+//EED 2020-01-21
+ double _xBack,_yBack;
};
((wxVtkMPR3DViewCntrlPanel*)controlPanelMPR3D)->SetVisibleZ(true);
((wxVtkMPR3DViewCntrlPanel*)controlPanelMPR3D)->SetVisibleXYZ(true);
- mwxvtkmpr3Dview->showOutlineActor(true);
+ mwxvtkmpr3Dview->showOutlineBoxActor(true);
mwxvtkmpr3Dview->Refresh();
}
mwxvtkmpr3Dview->VisibleImageActor( 2, valueZ );
mwxvtkmpr3Dview->VisiblePointWidget(valueXYZ);
mwxvtkmpr3Dview->VisiblePlaneWidget(valuePlane);
- mwxvtkmpr3Dview->showOutlineActor(true);
+ mwxvtkmpr3Dview->showOutlineBoxActor(true);
mwxvtkmpr3Dview->Refresh();
} else {
wxtabs->GetPage(id)->Disable();
mwxvtkmpr3Dview->VisibleImageActor(0, false );
mwxvtkmpr3Dview->VisibleImageActor(1, false );
mwxvtkmpr3Dview->VisibleImageActor(2, false );
- mwxvtkmpr3Dview->showOutlineActor(false);
+ mwxvtkmpr3Dview->showOutlineBoxActor(false);
mwxvtkmpr3Dview->Refresh();
wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
if(checkboxSB->GetValue())
{
wxtabs->GetPage(id)->Enable();
- }
- else
- {
+ } else {
wxtabs->GetPage(id)->Disable();
- }
+ } // if checkboxSB
}
catch(char* str){
std::cout << "Exception : " << str << '\n';
wxwindow4 = NULL;
_currentwxw = NULL;
mvtkmprbasedata = NULL;
-
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(sizer);
this->SetAutoLayout(true);
-
-
- if(imagedata!=NULL && nTypeView!=NULL ){
+ if(imagedata!=NULL && nTypeView!=NULL )
+ {
this->SetType(nTypeView);
this->UpdateLayout(imagedata);
}
-
-
}
/**
* @pre A wxWindow* object must be provided as a parent for the viewer and the type of layout for the viewer
void wxMaracas_N_ViewersWidget::RefreshView()
{
-
if (wxwindow1!=NULL) {wxwindow1->RefreshView(); }
if (wxwindow2!=NULL) {wxwindow2->RefreshView(); }
if (wxwindow3!=NULL) {wxwindow3->RefreshView(); }
//this->Layout();
//this->Refresh();
-
// I don't undestand how this works and not the opposite ...
if (wxwindow4!=NULL) {wxwindow4->ConfigureVTK(); }
if (wxwindow3!=NULL) {wxwindow3->ConfigureVTK(); }
if (wxwindow2!=NULL) { wxwindow2->SetImage(image); }
if (wxwindow3!=NULL) { wxwindow3->SetImage(image); }
if (wxwindow4!=NULL) { wxwindow4->SetImage(image); }
-
// ConfigureVTK();
}
wxwindow=panelClipping3D;
} else if (type==6) {
- panelClipping3D = new wxSplitterWindow( panel , -1);
- mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panelClipping3D , vtkmprbasedata);
- mwxvtkmpr3Dview = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
- vtkmpr3Ddataviewer = new vtkMPR3DDataViewer();
- wxWindow *window3D = mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
- wxPanel *panelControl = new wxPanel(panelClipping3D,-1);
- wxPanel *controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(panelControl, true);
- wxFlexGridSizer *sizerCtrol = new wxFlexGridSizer(1);
+ panelClipping3D = new wxSplitterWindow( panel , -1);
+ mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panelClipping3D , vtkmprbasedata);
+ mwxvtkmpr3Dview = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
+ vtkmpr3Ddataviewer = new vtkMPR3DDataViewer();
+ wxWindow *window3D = mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
+ wxPanel *panelControl = new wxPanel(panelClipping3D,-1);
+ wxPanel *controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(panelControl, true);
+ wxFlexGridSizer *sizerCtrol = new wxFlexGridSizer(1);
sizerCtrol->Add(controlPanelMPR3D, 1, wxALL|wxEXPAND, 2);
panelControl->SetAutoLayout(true);
//-------------------------------------------------------------------------
void wxMaracas_ViewerWidget::RefreshView()
{
- if (mwxvtk3Dbaseview_Clipping3D !=NULL ){ mwxvtk3Dbaseview_Clipping3D->Refresh(); }
- if (mwxvtkclipping3Dview !=NULL ){ mwxvtkclipping3Dview->Refresh(); }
- if (mwxvtkmpr3Dview !=NULL ){ mwxvtkmpr3Dview->RefreshView(); }
- if (mvtk2Dbaseview !=NULL ){ mvtk2Dbaseview->Refresh(); }
- if (mvtkmpr2Dview_X !=NULL ){ mvtkmpr2Dview_X->Refresh(); }
- if (mvtkmpr2Dview_Y !=NULL ){ mvtkmpr2Dview_Y->Refresh(); }
- if (mvtkmpr2Dview_Z !=NULL ){ mvtkmpr2Dview_Z->Refresh(); }
- if (mvtkplane2Dview !=NULL ){ mvtkplane2Dview->Refresh(); }
- if (mwxsphereview !=NULL ){ mwxsphereview ->RefreshView(); }
+//printf("EED wxMaracas_ViewerWidget::RefreshView %p\n", this);
+ if (mwxvtkmpr3Dview !=NULL ){ mwxvtkmpr3Dview ->RefreshView(); }
+ if (mwxvtkclipping3Dview !=NULL ){ mwxvtkclipping3Dview ->Refresh(); }
+ if (mwxvtk3Dbaseview_Clipping3D !=NULL ){ mwxvtk3Dbaseview_Clipping3D ->Refresh(); }
+ if (mvtk2Dbaseview !=NULL ){ mvtk2Dbaseview ->Refresh(); }
+ if (mvtkmpr2Dview_X !=NULL ){ mvtkmpr2Dview_X ->Refresh(); }
+ if (mvtkmpr2Dview_Y !=NULL ){ mvtkmpr2Dview_Y ->Refresh(); }
+ if (mvtkmpr2Dview_Z !=NULL ){ mvtkmpr2Dview_Z ->Refresh(); }
+ if (mvtkplane2Dview !=NULL ){ mvtkplane2Dview ->Refresh(); }
+ if (mwxsphereview !=NULL ){ mwxsphereview ->RefreshView(); }
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
- void wxMaracas_ViewerWidget::SetImage( vtkImageData *image )
+void wxMaracas_ViewerWidget::SetImage( vtkImageData *image )
+{
+ if(mvtkmprbasedata !=NULL)
+ {
+ marImageData* mar = mvtkmprbasedata->GetMarImageData();
+ mar->removeImageData(0);
+ mar->AddImageData(image);
+ }
+ if (mvtk2Dbaseview!=NULL)
{
- if(mvtkmprbasedata !=NULL)
- {
- marImageData* mar = mvtkmprbasedata->GetMarImageData();
- mar->removeImageData(0);
- mar->AddImageData(image);
- }
-
- if (mvtk2Dbaseview!=NULL)
- {
mvtk2Dbaseview->SetImageToVtkViewer(image);
- }
-
- if (mvtkmpr2Dview_X!=NULL)
- {
- mvtkmpr2Dview_X->SetImageToVtkViewer(image);
- }
- if (mvtkmpr2Dview_Y!=NULL)
- {
- mvtkmpr2Dview_Y->SetImageToVtkViewer(image);
- }
- if (mvtkmpr2Dview_Z!=NULL)
- {
- mvtkmpr2Dview_Z->SetImageToVtkViewer(image);
- }
-
- if (mvtkplane2Dview!=NULL)
- {
- // ??? EED 10 oct 2012
- }
- if (mwxsphereview!=NULL)
- {
- mwxsphereview->SetImage();
- }
- if (mwxvtkclipping3Dview!=NULL)
- {
- mwxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetImage();
- }
-
- if (mwxvtkmpr3Dview!=NULL)
- {
- mwxvtkmpr3Dview->SetImage();
- }
+ }
+ if (mvtkmpr2Dview_X!=NULL)
+ {
+ mvtkmpr2Dview_X->SetImageToVtkViewer(image);
+ mvtkmpr2Dview_X->ResetBackXYZ();
+ }
+ if (mvtkmpr2Dview_Y!=NULL)
+ {
+ mvtkmpr2Dview_Y->SetImageToVtkViewer(image);
+ mvtkmpr2Dview_Y->ResetBackXYZ();
+ }
+ if (mvtkmpr2Dview_Z!=NULL)
+ {
+ mvtkmpr2Dview_Z->SetImageToVtkViewer(image);
+ mvtkmpr2Dview_Z->ResetBackXYZ();
+ }
+ if (mvtkplane2Dview!=NULL)
+ {
+ // ??? EED 10 oct 2012
+ }
+ if (mwxsphereview!=NULL)
+ {
+ mwxsphereview->SetImage();
+ }
+ if (mwxvtkmpr3Dview!=NULL)
+ {
+ mwxvtkmpr3Dview->SetImage();
+ }
+ if (mwxvtkclipping3Dview!=NULL)
+ {
+ mwxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetImage();
+ }
//EED 26/11/2009
// ConfigureVTK();
// RefreshView();
-
- }
+}
//-------------------------------------------------------------------------
{
mvtkmprbasedata->SetColorWindow(colorWindow);
mvtkmprbasedata->SetColorLevel(colorLevel);
-//EED Borrame
-/*
- RefreshView();
- if(mvtk2Dbaseview!=NULL)
- {
- mvtk2Dbaseview->SetColorWindow(level);
- }
-
- if(mvtkmpr2Dview_X!=NULL)
- {
- mvtkmpr2Dview_X->SetColorWindow(level);
- }
-
- if(mvtkmpr2Dview_Y!=NULL)
- {
- mvtkmpr2Dview_Y->SetColorWindow(level);
- }
-
- if(mvtkmpr2Dview_Z!=NULL)
- {
- mvtkmpr2Dview_Z->SetColorWindow(level);
- }
-
- if(mwxvtkmpr3Dview!=NULL)
- {
- mwxvtkmpr3Dview->SetColorWindow(level);
- }
- */
}
//------------------------------------------------------------------------------------------------------------
void setColorTransferFunction(vtkColorTransferFunction* colortable);
-
- void SetColorWindowLevel(double colorWindow, double colorLevel);
-
+ void SetColorWindowLevel(double colorWindow, double colorLevel);
private:
int mType;
-
bool minternalVtkmprbasedata;
vtkMPRBaseData *mvtkmprbasedata;
-
-
wxVtk2DBaseView *mvtk2Dbaseview;
wxVtkMPR2DView *mvtkmpr2Dview_X;
wxVtkMPR2DView *mvtkmpr2Dview_Y;
wxWidgetMesure2D_Plane_in_MPR *mwidgetMesure;
vtkPlane2DView *mvtkplane2Dview;
wxSphereView *mwxsphereview;
-
wxVtkClipping3DView *mwxvtkclipping3Dview;
wxVtk3DBaseView *mwxvtk3Dbaseview_Clipping3D;
wxVtkMPR3DView *mwxvtkmpr3Dview;
-
-
vtkMPR3DDataViewer *vtkmpr3Ddataviewer;
-
};
#endif // __WX__MARACAS__VIEWERWIDGET__H__
//EED 24oct2010
_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
- _imageViewer2XYZ->GetVtkImageViewer2()->Render();
+//EED2120-06-23 _imageViewer2XYZ->GetVtkImageViewer2()->Render();
//////////////
//RaC 04-2010 Look for the description of new changes in vtkInteractorStyleBaseView2D constructor.
vtkInteractorScrollZ *_vtkInteractorScrollZ = new vtkInteractorScrollZ();
style2D->SetInteractorScrollZ(_vtkInteractorScrollZ);
+ vtkInteractorZoomCamera *_vtkInteractorZoomCamera = new vtkInteractorZoomCamera();
+ style2D->SetInteractorZoomCamera(_vtkInteractorZoomCamera);
+
+
+
SetInteractorStyleImage( style2D );
// RaC
vtkInteractorScrollZ *_vtkInteractorScrollZ = new vtkInteractorScrollZ();
style2D->SetInteractorScrollZ(_vtkInteractorScrollZ);
+ vtkInteractorZoomCamera *_vtkInteractorZoomCamera = new vtkInteractorZoomCamera();
+ style2D->SetInteractorZoomCamera(_vtkInteractorZoomCamera);
+
SetInteractorStyleImage( style2D );
// RaC
camera->SetClippingRange( 0.01 , 1000000 );
camera->ComputeViewPlaneNormal();
- camera->SetParallelScale( spx*(x2-x1)/3.0 );
+
+ double cameraparallelScale=spx*(x2-x1)/3.0;
+ camera->SetParallelScale( cameraparallelScale );
+ GetVtkBaseData()->SetCameraParallelScale( cameraparallelScale );
// text information over the graphic window
if(_vtkIinfoTextImage == NULL){
//EED 24oct2010
//EED 02nov2012
-// vtkImageViewer2 *vtkimageviewer2 = _imageViewer2XYZ->GetVtkImageViewer2();
-
vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel();
imagemaptowindowlevel->SetWindow( GetVtkBaseData()->GetColorWindow() );
imagemaptowindowlevel->SetLevel( GetVtkBaseData()->GetColorLevel() );
-
-// EED Borrame
-// vtkimageviewer2->SetColorWindow( GetVtkBaseData()->GetColorWindow() );
-// vtkimageviewer2->SetColorLevel( GetVtkBaseData()->GetColorLevel() );
_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
}
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::UpdateCameraParallelScale()
+{
+ vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+ camera->SetParallelScale( GetVtkBaseData()->GetCameraParallelScale() );
+}
+
//-------------------------------------------------------------------
void wxVtk2DBaseView::Refresh()
{
imageactor->SetInterpolate( GetVtkBaseData()->GetInterpolate() );
//EED 01nov2012
UpdateColorWindowLevel();
+ UpdateCameraParallelScale();
wxVtkBaseView::Refresh();
}
return 2;
}
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::SetOpacityText(double opacity)
+{
+ if (_vtkIinfoTextImage!=NULL)
+ {
+ _vtkIinfoTextImage->SetOpacity( opacity );
+ }
+}
+
+
//EED 01nov2012
void UpdateColorWindowLevel();
+ //EED 05juin2019
+ void UpdateCameraParallelScale();
+ void SetOpacityText(double opacity);
+
private:
vtkInfoTextImage *_vtkIinfoTextImage;
vtkInfoTextImageInteractor *_vtkIinfoTextImageInteractor;
//-------------------------------------------------------------------
wxVtk3DBaseView::~wxVtk3DBaseView()
{
-
if (_aCamera!=NULL) { _aCamera -> Delete(); _aCamera=NULL;}
if (_aRenderer!=NULL) { _aRenderer -> Delete(); _aRenderer=NULL;}
if (_renWin!=NULL)
// EED 27/05/2013
void wxVtk3DBaseView::ResetCamera(int* ext, double* spc)
{
-
- GetRenderer()->ResetCameraClippingRange();
-
+ GetRenderer()->ResetCameraClippingRange();
if(ext == NULL)
{
-
GetRenderer()->ResetCamera ();
GetCamera()->Dolly(1.2);
- }else{
-
+ }else{
/*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));
double y = (spc[1])*(origin[1]+(double)ext[3]);
double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/
double y1=(spc[1])*((double)ext[3]+origin[1]);
double z0=(spc[2])*((double)ext[4]+origin[2]);
double z1=(spc[2])*((double)ext[5]+origin[2]);*/
-
double x0=(spc[0])*((double)ext[0]);
double x1=(spc[0])*((double)ext[1]);
double y0=(spc[1])*((double)ext[2]);
double y1=(spc[1])*((double)ext[3]);
double z0=(spc[2])*((double)ext[4]);
double z1=(spc[2])*((double)ext[5]);
-
GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1);
//_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z);
GetCamera()->Dolly(1.5);
- }
+ }// if ext
}
//-------------------------------------------------------------------
void wxVtk3DBaseView::SetStereo(int type)
{
//EED 02/06/2012
-
if (_renWin!=NULL)
{
if (type==0)
// VTK_STEREO_ANAGLYPH 7
// VTK_STEREO_CHECKERBOARD 8
_renWin->SetStereoType(type);
-
} // if type
} // _renWin
}
GetCamera()->Yaw(180+30);
GetCamera()->Pitch(-22);
- }
+ //https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk
+ //https://itk.org/Wiki/VTK/Depth_Peeling
+ _aRenderer->SetUseDepthPeeling(1);
+ _aRenderer->SetOcclusionRatio(0.1);
+ _aRenderer->SetMaximumNumberOfPeels(100);
+ _renWin->SetMultiSamples(0);
+ _renWin->SetAlphaBitPlanes(1);
+ } // if _configure
}
//-------------------------------------------------------------------
//-------------------------------------------------------------------
crea::wxVTKRenderWindowInteractor* wxVtkBaseView::GetWxVTKRenderWindowInteractor() throw (char*)
{
-
if(_iren==NULL)
{
throw "wxVtkBaseView::GetWxVTKRenderWindowInteractor() _iren cwxVTKRenderWindowInteractorPlus =NULL";
_color = new wxButton(panel,-1,_T(""));
_visible = new wxCheckBox(panel,-1,_T("Vis"));
- _opacity = new wxSlider(panel,-1,50,0,100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
+//EED _opacity = new wxSlider(panel,-1,50,0,100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
+ _opacity = new wxSlider(panel,-1,50,0,100, wxDefaultPosition, wxSize(300,110), wxSL_HORIZONTAL | wxSL_LABELS);
wxStaticText *isoValueTitle = new wxStaticText(panel,-1,_T("isoValue"));
- _isoValue = new wxSlider(panel,-1,2000,110,2000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS);
+//EED _isoValue = new wxSlider(panel,-1,2000,110,2000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS);
+ _isoValue = new wxSlider(panel,-1,2000,110,2000, wxDefaultPosition, wxSize(300,110), wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS);
_wireFrameRep = new wxRadioButton(panel,-1,_T("WireFrame"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
_surfaceRep = new wxRadioButton(panel,-1,_T("Surface"));
double range[2];
vtkImageData *vtkimagedata = wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
vtkimagedata->GetScalarRange( range );
- _isoValue->SetRange( (int)(range[1]*0.1) , (int)(range[1]) );
+//EED 2020-11-25 _isoValue->SetRange( (int)(range[1]*0.1) , (int)(range[1]) );
+ _isoValue->SetRange( (int)(range[0]) , (int)(range[1]) );
_isoValue->SetValue( (int)(wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIsovalue(0)) );
//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
pdcf->SetInput( filtro->GetOutput() );
cpd->SetInput( pdcf->GetOutput() );
#else
- filtro->SetInputData( this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueClipper(idTissue)->GetOutput() );
- pdcf->SetInputData( filtro->GetOutput() );
- cpd->SetInputData( pdcf->GetOutput() );
+ filtro->SetInputConnection( this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueClipper(idTissue)->GetOutputPort() );
+ pdcf->SetInputConnection( filtro->GetOutputPort() );
+ cpd->SetInputConnection( pdcf->GetOutputPort() );
#endif
- // 1.2 se escribe a disco el archivo stl de la superficie interna
+ // 1.2 Write the stl file
cpd->Update();
vtkSTLWriter *writer = vtkSTLWriter::New();
#if VTK_MAJOR_VERSION <= 5
writer->SetInput( cpd->GetOutput() );
#else
- writer->SetInputData( cpd->GetOutput() );
+ writer->SetInputConnection( cpd->GetOutputPort() );
#endif
- filename =prefix;
writer->SetFileName(filename.c_str());
writer->SetFileTypeToASCII();
writer->Write();
writer->Delete();
-
filtro->Delete();
cpd->Delete();
pdcf->Delete();
void wxVtkMPR2DView::SetVisibleAxis(bool ok)
{
- if (ok!=_visibleAxis)
+ if (ok != _visibleAxis)
{
- _visibleAxis=ok;
+ _visibleAxis = ok;
if (_visibleAxis==true)
{
_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
} // ok
}
+
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::ResetBackXYZ()
+{
+ _backX = -9999;
+ _backY = -9999;
+ _backZ = -9999;
+}
+
+
//-------------------------------------------------------------------
void wxVtkMPR2DView::Refresh()
{
y2 += origin[1];
z1 += origin[2];
z2 += origin[2];
- xx1 = x1*spc[0];
- yy1 = y1*spc[1];
- zz1 = z1*spc[2];
- xx2 = x2*spc[0];
- yy2 = y2*spc[1];
- zz2 = z2*spc[2];
+ xx1 = x1*spc[0];
+ yy1 = y1*spc[1];
+ zz1 = z1*spc[2];
+ xx2 = x2*spc[0];
+ yy2 = y2*spc[1];
+ zz2 = z2*spc[2];
x1 = (int)(x1*spc[0]);
y1 = (int)(y1*spc[1]);
z1 = (int)(z1*spc[2]);
xx = (int)(GetVtkmprbasedata()->GetX());
yy = (int)(GetVtkmprbasedata()->GetY());
zz = (int)(GetVtkmprbasedata()->GetZ());
-//EED 02/08/2013
-// x = round(xx*spc[0]);
-// y = round(yy*spc[1]);
-// z = round(zz*spc[2]);
x = xx*spc[0];
y = yy*spc[1];
z = zz*spc[2];
//_ptsA->SetPoint(1, x2, y2 , z );
//_ptsB->SetPoint(0, x2, y , z1);
//_ptsB->SetPoint(1, x2, y , z2);
- _ptsA->SetPoint(0, xx2, yy1 , z );
- _ptsA->SetPoint(1, xx2, yy2 , z );
- _ptsB->SetPoint(0, xx2, y , zz1);
- _ptsB->SetPoint(1, xx2, y , zz2);
+ _ptsA->SetPoint(0, xx2+1, yy1 , z );
+ _ptsA->SetPoint(1, xx2+1, yy2 , z );
+ _ptsB->SetPoint(0, xx2+1, y , zz1);
+ _ptsB->SetPoint(1, xx2+1, y , zz2);
position[1] = y;
position[2] = z;
focalpoint[1] = y;
//_ptsA->SetPoint(1, x2 , y2 , z );
//_ptsB->SetPoint(0, x , y2 , z1);
//_ptsB->SetPoint(1, x , y2 , z2);
- _ptsA->SetPoint(0, xx1 , y1 , z );
- _ptsA->SetPoint(1, xx2 , y1 , z );
- _ptsB->SetPoint(0, x , y1 , zz1);
- _ptsB->SetPoint(1, x , y1 , zz2);
+ _ptsA->SetPoint(0, xx1 , y1-1 , z );
+ _ptsA->SetPoint(1, xx2 , y1-1 , z );
+ _ptsB->SetPoint(0, x , y1-1 , zz1);
+ _ptsB->SetPoint(1, x , y1-1 , zz2);
position[0] = x;
position[2] = z;
focalpoint[0] = x;
//_ptsA->SetPoint(1, x2 , y , z2 );
//_ptsB->SetPoint(0, x , y1, z2 );
//_ptsB->SetPoint(1, x , y2, z2 );
- _ptsA->SetPoint(0, xx1 , y , z1 );
- _ptsA->SetPoint(1, xx2 , y , z1 );
- _ptsB->SetPoint(0, x , yy1, z1 );
- _ptsB->SetPoint(1, x , yy2, z1 );
+
+ _ptsA->SetPoint(0, xx1 , y , z1-1 );
+ _ptsA->SetPoint(1, xx2 , y , z1-1 );
+ _ptsB->SetPoint(0, x , yy1, z1-1 );
+ _ptsB->SetPoint(1, x , yy2, z1-1 );
+
position[0] = x;
position[1] = y;
focalpoint[0] = x;
} // if GetFixAxis2D
_lineAActor->GetProperty()->SetOpacity( opacityAxis );
_lineBActor->GetProperty()->SetOpacity( opacityAxis );
+ SetOpacityText( opacityAxis );
_backX = xx;
_backY = yy;
_backZ = zz;
imageactor->SetInterpolate( GetVtkBaseData()->GetInterpolate() );
//EED 01nov2012
UpdateColorWindowLevel();
+//EED 05juin2019
+ UpdateCameraParallelScale();
wxVtkBaseView::Refresh();
}
}
virtual void TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection=false, int type=2);
void SetVisibleAxis(bool ok);
virtual int GetDirection();
+ void ResetBackXYZ();
private:
int _backX;
int _backY;
int _backZ;
-
bool _backFixAxis2D;
double _backOpacityAxis;
-
bool _visibleAxis;
int _direction;
vtkPoints *_ptsA;
wxVtkMPR3DView::~wxVtkMPR3DView()
{
VisiblePointWidget( false );
- VisiblePlaneWidget( false );
- if(_pointWidget!=NULL){
+// VisiblePlaneWidget( false );
+ if(_pointWidget!=NULL)
+ {
_pointWidget->Delete();
}
- if(_planeWidget!=NULL){
+ if(_planeWidget!=NULL)
+ {
_planeWidget->Delete();
}
- if(_vtkplane!=NULL){
+ if(_vtkplane!=NULL)
+ {
_vtkplane->Delete();
_probe->Delete();
_contourMapper->Delete();
// -- Plane widget
_probe->SetSource( imageData );
#else
+
+
+// double colorWindow = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow();
+// double colorLevel = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel();
+
+ double spc[3];
+ vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+ if(image)
+ {
+ image->GetSpacing(spc);
+ }else{
+ spc[0] = 0;
+ spc[1] = 0;
+ spc[2] = 0;
+ }
+ double x = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
+ double y = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
+ double z = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
+
+
+/*
+ if (mchange==NULL)
+ {
+ mchange = vtkImageChangeInformation::New();
+ mchange->SetInputData( imageData );
+ mchange->Modified(); //important
+ mchange->Update(); //important
+ _planeWidgetX->SetInputData( mchange->GetOutput() );
+ _planeWidgetY->SetInputData( mchange->GetOutput() );
+ _planeWidgetZ->SetInputData( mchange->GetOutput() );
+ } else {
+ mchange->SetInputData( imageData );
+ mchange->Modified(); //important
+ mchange->Update(); //important
+ }
+
+*/
+
+
+
+
_planeWidgetX->SetInputData( imageData );
_planeWidgetY->SetInputData( imageData );
_planeWidgetZ->SetInputData( imageData );
+//EED 2021-06-23
+// _planeWidgetX->SetWindowLevel(colorLevel,colorWindow,1);
+// _planeWidgetY->SetWindowLevel(colorLevel,colorWindow,1);
+// _planeWidgetY->SetWindowLevel(colorLevel,colorWindow,1);
+ _planeWidgetX->SetSlicePosition( x*spc[0] );
+ _planeWidgetY->SetSlicePosition( y*spc[1] );
+ _planeWidgetZ->SetSlicePosition( z*spc[2] );
+
+ _planeWidgetX->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
+ _planeWidgetY->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
+ _planeWidgetZ->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
+
+
// -- Plane widget
_probe->SetSourceData( imageData );
#endif
-
_vtkmpr3Ddataviewer->SetImage();
}
//-------------------------------------------------------------------
vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker)
{
- vtkProperty* prop1 = 0;
- vtkImagePlaneWidget* planeWidget = 0;
- planeWidget = vtkImagePlaneWidget::New();
+ vtkProperty* prop1 = NULL;
+ vtkImagePlaneWidget* planeWidget = vtkImagePlaneWidget::New();
planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
planeWidget->EnabledOff();
vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
_planeWidgetY->InteractionOff();
_planeWidgetZ->InteractionOff();
}
- } // if _planeWidgetX
+ } // if _planeWidgetXVisiblePointWidget
}
{
double spc[3];
vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-
if(image)
{
image->GetSpacing(spc);
spc[1] = 0;
spc[2] = 0;
}
-
// GetVtkMPR3DDataViewer()->Configure();
-
//double nx=1,ny=0,nz=0; // JPRx
Refresh();
- double x=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
- double y=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
- double z=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
-
- SetColorWindow( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() );
- SetColorLevel( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() );
+ double x = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
+ double y = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
+ double z = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
double normal[3];
// FreePlaneX
_planeWidgetZ->GetReslice()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
_planeWidgetZ->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
}
+
+ SetWindowColorLevel(_vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() , _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() );
+
x = x*spc[0];
y = y*spc[1];
z = z*spc[2];
#else
_probe->Update();
#endif
- }
+ } //_pointWidget
if (_wxvtkmpr3DviewCntrlPanel!=NULL)
{
//-------------------------------------------------------------------
//-------------------------------------------------------------------
-void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
+void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible)
+{
/*if(visible == false)
printf("CPR: wxVtkMPR3DView::VisibleImageActor-> visibleActor == false \n");
else
}
*/
if (visible!=_vtkmpr3Ddataviewer->GetVisiblePosition(idPosition)){
- if (visible==false){
+ if (visible==false)
+ {
_wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
} else {
//EED 21/07/2013
// This works in ViewerNV with nTymeView=6
// Because the others modules (5) generate also more actors with an OutLineFilter -> Actor
//showOutlineActor(false);
-
// step 1, step 2
vtkActorCollection *tmpCollection = vtkActorCollection::New();
vtkActorCollection *collectionActors = _wxvtk3Dbaseview->GetRenderer()->GetActors();
tmpCollection->AddItem ( (vtkActor*)collectionActors->GetItemAsObject(0) );
_wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
} // for
-
// step 3
_wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
-
// step 4
for (i=0; i<size; i++)
{
_wxvtk3Dbaseview->GetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
} // for
tmpCollection->Delete();
-
// step 5 Refresh
_wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render();
-
} // if visible
_vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible);
} // if visible
{
_planeWidget->On();
_contourPlaneActor->VisibilityOn();
-
} else {
_planeWidget->Off();
_contourPlaneActor->VisibilityOff();
}
//CPR: Method added 30 Nov 2009
-void wxVtkMPR3DView::showOutlineActor(bool value)
+void wxVtkMPR3DView::showOutlineBoxActor(bool value)
{
vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
if(value == true)
} // value
}
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::showOutlinePlaneActor(bool value)
+{
+ vtkProperty *prop1=NULL;
+ if(value == true)
+ {
+ prop1 = _planeWidgetX ->GetPlaneProperty();
+ prop1->SetOpacity(1);
+ prop1 = _planeWidgetY ->GetPlaneProperty();
+ prop1->SetOpacity(1);
+ prop1 = _planeWidgetZ ->GetPlaneProperty();
+ prop1->SetOpacity(1);
+ } else {
+ prop1 = _planeWidgetX ->GetPlaneProperty();
+ prop1->SetOpacity(0);
+ prop1 = _planeWidgetY ->GetPlaneProperty();
+ prop1->SetOpacity(0);
+ prop1 = _planeWidgetZ ->GetPlaneProperty();
+ prop1->SetOpacity(0);
+ } // value
+}
+
+
//-------------------------------------------------------------------
void wxVtkMPR3DView::SetVtkMPR3DDataViewer(vtkMPR3DDataViewer *vtkmpr3Ddataviewer)
{
}
//-------------------------------------------------------------------
-void wxVtkMPR3DView::SetColorWindow(double colorWindow)
+void wxVtkMPR3DView::SetWindowColorLevel(double colorWindow , double colorLevel)
{
- double colorLevel = _planeWidgetX->GetLevel();
_planeWidgetX->SetWindowLevel(colorWindow,colorLevel);
+ _planeWidgetY->SetWindowLevel(colorWindow,colorLevel);
+ _planeWidgetZ->SetWindowLevel(colorWindow,colorLevel);
}
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::SetColorLevel(double colorLevel)
-{
- double colorWindow = _planeWidgetX->GetWindow();
- _planeWidgetX->SetWindowLevel(colorWindow,colorLevel);
-}
//-------------------------------------------------------------------
// EED 25 Janvier 2007 testLoic
if (_wxvtk3Dbaseview!=NULL)
{
if (type==0)
+ {
+ _wxvtk3Dbaseview->GetRenderer()->GradientBackgroundOn();
+ _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.33 , 0.33 , 0.33 );
+ _wxvtk3Dbaseview->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );
+ } // if type
+ else if (type==1)
{
_wxvtk3Dbaseview->GetRenderer()->GradientBackgroundOff();
_wxvtk3Dbaseview->GetRenderer()->SetBackground( 0 , 0 , 0 );
} // if type
- if (type==1)
+ else if (type==2)
{
- _wxvtk3Dbaseview->GetRenderer()->GradientBackgroundOn();
- _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.33 , 0.33 , 0.33 );
- _wxvtk3Dbaseview->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );
+ _wxvtk3Dbaseview->GetRenderer()->GradientBackgroundOff();
+ _wxvtk3Dbaseview->GetRenderer()->SetBackground( 1 , 1 , 1 );
} // if type
_wxvtk3Dbaseview->Refresh();
}// if _wxvtk3Dbaseview
#include "vtkPlaneWidget.h"
#include "vtkPointWidget.h"
#include "vtkImagePlaneWidget.h"
+#include "vtkImageChangeInformation.h"
//class vtkmyPWCallback_3DPointWidget;
vtkMPR3DDataViewer* GetVtkMPR3DDataViewer();
wxVtk3DBaseView* GetWxvtk3Dbaseview() throw (char*);
void InitOrientationPointWidget();
- void showOutlineActor(bool value);
+ void showOutlineBoxActor(bool value);
+ void showOutlinePlaneActor(bool value);
// EED 25 Janvier 2007 testLoic
void TestLoic1();
void TestLoic2();
//Free planes
//-------------------------------------------------------------------
- void ConfigureFreePlanes();
- vtkImagePlaneWidget* GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker);
- void FreePlaneVisible(int plane, bool ok);
- void FreePlaneInteraction(bool ok);
- void SetFreePlanesOrtho();
- void SetColorWindow(double colorWindow);
- void SetColorLevel(double colorLevel);
+ void ConfigureFreePlanes();
+ vtkImagePlaneWidget* GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker);
+ void FreePlaneVisible(int plane, bool ok);
+ void FreePlaneInteraction(bool ok);
+ void SetFreePlanesOrtho();
+/*Borrame
+ void SetColorWindow(double colorWindow);
+ void SetColorLevel(double colorLevel);
+*/
+ void SetWindowColorLevel(double colorWindow , double colorLevel);
private:
wxVtk3DBaseView *_wxvtk3Dbaseview;
vtkImagePlaneWidget *_planeWidgetY;
vtkImagePlaneWidget *_planeWidgetZ;
+ vtkImageChangeInformation *mchange;
+
protected:
};
_ckBoxXYZ = new wxCheckBox(panel,-1,_T("3D Axis "));
_ckBoxFixAxis2D = new wxCheckBox(panel,-1,_T("2D Fix Axis"));
- _opacityAxis = new wxSlider(panel,-1,50,0,100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
+ _opacityAxis = new wxSlider(panel,-1,100,0,100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
_ckBoxPlane = new wxCheckBox(panel,-1,_T("Plane"));
////EED 05Nov2012 _ckBox_BW_Color_Plane = new wxCheckBox(panel,-1,_T("GL/Color"));
_ckBoxXYZ->SetValue(false);
////EED 05Nov2012 _ckBox_BW_Color_Plane->SetValue(true);
_ckBoxPlane->SetValue(false);
- _ckBoxOutline= new wxCheckBox(panel,-1,_T("Outline"));
- _ckBoxOutline->SetValue(true);
_ckBoxInterpolate= new wxCheckBox(panel,-1,_T("Interpolate"));
_ckBoxInterpolate->SetValue(true);
- _ckBoxBackGroundBlack= new wxCheckBox(panel,-1,_T("Background Black"));;
- _ckBoxBackGroundBlack->SetValue(false);
+ _ckBoxOutlineBox = new wxCheckBox(panel,-1,_T("Outline Box"));
+ _ckBoxOutlineBox->SetValue(true);
+ _ckBoxOutlinePlane = new wxCheckBox(panel,-1,_T("Outline Plane"));
+ _ckBoxOutlinePlane->SetValue(true);
+
+
+
+// _ckBoxBackGroundBlack= new wxCheckBox(panel,-1,_T("Background Black"));;
+// _ckBoxBackGroundBlack->SetValue(false);
+// EED Borrame
+// _ckBoxBackGroundBlack= new wxCheckBox(panel,-1,_T("Background Black"));;
+// _ckBoxBackGroundBlack->SetValue(false);
+
+ wxPanel *panelH7 = new wxPanel(panel);
+
+ _rdBackGroundGradient = new wxRadioButton( panelH7, -1, _T("Background Gradient"),wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+ _rdBackGroundBlack = new wxRadioButton( panelH7, -1, _T("Background Black"),wxDefaultPosition, wxDefaultSize, 0);
+ _rdBackGroundWhite = new wxRadioButton( panelH7, -1, _T("Background White"),wxDefaultPosition, wxDefaultSize, 0);
+
+ _rdBackGroundGradient->SetValue(false);
+ _rdBackGroundBlack->SetValue(false);
+ _rdBackGroundWhite->SetValue(false);
_positionX->SetSize(400,20);
_positionY->SetSize(400,20);
Connect(btnFreePlanesOrtho->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnFreePlanesOrtho );
Connect(_ckFreePlaneInteraction->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneInteraction );
Connect(_cbStereo->GetId() , wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnSetStereo );
- Connect(_ckBoxOutline->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnOutline );
- Connect(_ckBoxBackGroundBlack->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnBackGroundBlack );
+ Connect(_ckBoxOutlineBox->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnOutlineBox );
+ Connect(_ckBoxOutlinePlane->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnOutlinePlane );
+
+// EED Borrame
+// Connect(_ckBoxBackGroundBlack->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnBackGroundBlack );
+ Connect(_rdBackGroundGradient->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnBackGroundBlack );
+ Connect(_rdBackGroundBlack->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnBackGroundBlack );
+ Connect(_rdBackGroundWhite->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnBackGroundBlack );
+
+
Connect(_ckBoxInterpolate->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnInterpolate );
Connect(_ckBoxFixAxis2D->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnFixAxis2D );
Connect(_opacityAxis->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnOpacityAxis );
wxFlexGridSizer *sizerH4a;
wxFlexGridSizer *sizerH5;
wxFlexGridSizer *sizerH6;
+ wxFlexGridSizer *sizerH7;
if(align)
{
sizerH5->Add( _cbStereo , 1, wxALL|wxEXPAND , 0);
sizerH6 = new wxFlexGridSizer(1);
- sizerH6->Add( _ckBoxOutline , 1, wxALL|wxEXPAND , 0);
- sizerH6->Add( _ckBoxBackGroundBlack , 1, wxALL|wxEXPAND , 0);
+ sizerH6->Add( _ckBoxOutlineBox , 1, wxALL|wxEXPAND , 0);
+ sizerH6->Add( _ckBoxOutlinePlane , 1, wxALL|wxEXPAND , 0);
+
+
+
+ sizerH7 = new wxFlexGridSizer(1);
+ panelH7->SetSizer(sizerH7);
+ sizerH7->Add( _rdBackGroundGradient , 1, wxALL|wxEXPAND , 0);
+ sizerH7->Add( _rdBackGroundBlack , 1, wxALL|wxEXPAND , 0);
+ sizerH7->Add( _rdBackGroundWhite , 1, wxALL|wxEXPAND , 0);
+
+
+ sizerH6->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND , 0);
+ sizerH6->Add( panelH7 , 1, wxALL|wxEXPAND , 0);
sizer->Add( sizerH4, 1, wxALL|wxGROW, 2);
sizer->Add( sizerH5, 1, wxALL|wxEXPAND,2);
// sizerH5->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0);
+ panelH7->SetAutoLayout(true);
+ panelH7->Layout();
+
+
panel->ClearBackground();
// panel->SetSize(400,50);
sizer->FitInside(panel);
//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnOutline(wxCommandEvent& event)
+void wxVtkMPR3DViewCntrlPanel::OnOutlineBox(wxCommandEvent& event)
{
- _wxvtkmpr3Dview->showOutlineActor( _ckBoxOutline->GetValue() );
+ _wxvtkmpr3Dview->showOutlineBoxActor( _ckBoxOutlineBox->GetValue() );
_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->Refresh();
+}
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnOutlinePlane(wxCommandEvent& event)
+{
+ _wxvtkmpr3Dview->showOutlinePlaneActor( _ckBoxOutlinePlane->GetValue() );
+ _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->Refresh();
}
//-------------------------------------------------------------------
void wxVtkMPR3DViewCntrlPanel::OnBackGroundBlack(wxCommandEvent& event)
{
- if (_ckBoxBackGroundBlack->GetValue()==true)
- {
+//EED Borrame
+// if (_ckBoxBackGroundBlack->GetValue()==true)
+// {
+// _wxvtkmpr3Dview->SetBackGroundType(0);
+// } else {
+// _wxvtkmpr3Dview->SetBackGroundType(1);
+// }
+
+ if (_rdBackGroundGradient->GetValue()==true) {
_wxvtkmpr3Dview->SetBackGroundType(0);
- } else {
+ } else if (_rdBackGroundBlack->GetValue()==true) {
_wxvtkmpr3Dview->SetBackGroundType(1);
+ } else if (_rdBackGroundWhite->GetValue()==true) {
+ _wxvtkmpr3Dview->SetBackGroundType(2);
}
+
}
//-------------------------------------------------------------------
void OnVisibleFreePlaneInteraction(wxCommandEvent& event);
void OnSetStereo(wxCommandEvent& event);
void OnFreePlanesOrtho(wxCommandEvent& event);
- void OnOutline(wxCommandEvent& event);
+ void OnOutlineBox(wxCommandEvent& event);
+ void OnOutlinePlane(wxCommandEvent& event);
void OnBackGroundBlack(wxCommandEvent& event);
void OnInterpolate(wxCommandEvent& event);
void OnFixAxis2D(wxCommandEvent& event);
wxComboBox *_cbStereo;
- wxCheckBox *_ckBoxOutline;
- wxCheckBox *_ckBoxBackGroundBlack;
+ wxCheckBox *_ckBoxOutlineBox;
+ wxCheckBox *_ckBoxOutlinePlane;
+
+// EED Borrame
+// wxCheckBox *_ckBoxBackGroundBlack;
+ wxRadioButton *_rdBackGroundBlack;
+ wxRadioButton *_rdBackGroundWhite;
+ wxRadioButton *_rdBackGroundGradient;
+
wxCheckBox *_ckBoxInterpolate;
protected:
void marImageData::removeImageData(int index)
{
- if(index < _imagedataLST.size()){
+ if(index < _imagedataLST.size())
+ {
/*vtkImageData* img = _imagedataLST[index];
if(img->GetReferenceCount()>1){
img->SetReferenceCount(img->GetReferenceCount()-1);
//img->Delete();
}*/
- for(int i = index; i < _imagedataLST.size()-1; i++){
+ for(int i = index; i < _imagedataLST.size()-1; i++)
+ {
_imagedataLST[i] = _imagedataLST[i+1];
- }
+ }// for
_imagedataLST.pop_back();
//delete img;
- }
+ } // if
}
// ----------------------------------------------------------------------------------------------
int marImageData::GetXOriginal(int value)