37 time :: Float64 |
36 time :: Float64 |
38 function_value :: Float64 |
37 function_value :: Float64 |
39 end |
38 end |
40 |
39 |
41 struct State |
40 struct State |
42 vis :: Union{Distributed.RemoteChannel,Bool,Nothing} |
41 vis :: Union{Channel,Bool,Nothing} |
43 visproc :: Union{Nothing,Future} |
42 visproc :: Union{Nothing,Task} |
44 start_time :: Union{Real,Nothing} |
43 start_time :: Union{Real,Nothing} |
45 wasted_time :: Real |
44 wasted_time :: Real |
46 log :: LinkedList{LogEntry} |
45 log :: LinkedList{LogEntry} |
47 end |
46 end |
48 |
47 |
80 function do_visualise(imgs) |
79 function do_visualise(imgs) |
81 plt = im -> plot(grayimg(im), showaxis=false, grid=false, aspect_ratio=:equal, margin=2mm) |
80 plt = im -> plot(grayimg(im), showaxis=false, grid=false, aspect_ratio=:equal, margin=2mm) |
82 display(plot([plt(imgs[i]) for i =1:length(imgs)]..., reuse=true, margin=0mm)) |
81 display(plot([plt(imgs[i]) for i =1:length(imgs)]..., reuse=true, margin=0mm)) |
83 end |
82 end |
84 |
83 |
85 function visualise(rc_or_vis, imgs) |
84 function visualise(channel_or_toggle, imgs) |
86 if isa(rc_or_vis, RemoteChannel) |
85 if isa(channel_or_toggle, Channel) |
87 rc = rc_or_vis |
86 rc = channel_or_toggle |
88 while isready(rc) |
87 while isready(rc) |
89 take!(rc) |
88 take!(rc) |
90 end |
89 end |
91 put!(rc, imgs) |
90 put!(rc, imgs) |
92 elseif isa(rc_or_vis, Bool) && rc_or_vis |
91 elseif isa(channel_or_toggle, Bool) && channel_or_toggle |
93 do_visualise(imgs) |
92 do_visualise(imgs) |
94 end |
93 end |
95 end |
94 end |
96 |
95 |
97 ###################################################### |
96 ###################################################### |