--- a/src/Visualise.jl Fri Dec 06 21:19:21 2019 +0200 +++ b/src/Visualise.jl Fri Dec 06 23:12:39 2019 +0200 @@ -8,8 +8,9 @@ using FileIO using Setfield using ColorTypes: Gray -using Plots -using Measures +#using Plots +#using Measures +import GR using AlgTools.Util using AlgTools.StructTools @@ -78,9 +79,44 @@ return end +# function do_visualise(imgs) +# plt = im -> plot(grayimg(im), showaxis=false, grid=false, aspect_ratio=:equal, margin=2mm) +# display(plot([plt(imgs[i]) for i =1:length(imgs)]..., reuse=true, margin=0mm)) +# end + +grayGR = x -> begin + y = round(UInt32, 0xff*clip(x)) + return 0x010101*y + 0xff000000 +end + function do_visualise(imgs) - plt = im -> plot(grayimg(im), showaxis=false, grid=false, aspect_ratio=:equal, margin=2mm) - display(plot([plt(imgs[i]) for i =1:length(imgs)]..., reuse=true, margin=0mm)) + n = length(imgs) + # Get device dimensions in metres and pixels + scrw, scrh, pw, ph = GR.inqdspsize() + # Scaling to maximums ize window + sc=0.7 + # Set up window and transformations + GR.clearws() + GR.setscale(0); + GR.selntran(1) + # - First OS window size + if scrw/n>scrh + GR.setwsviewport(0, sc*scrh*n, 0, sc*scrh) + else + GR.setwsviewport(0, sc*scrw, 0, sc*scrw/n) + end + # - Part of normalised window shown + GR.setwswindow(0, 1, 0, 1/n); + GR.setviewport(0, 1, 0, 1/n); + # Workd coordinates + GR.setwindow(0, n, 0, 1) + # Plot images + for i=1:n + im = imgs[i]' + sz = size(im) + GR.drawimage(i-1, i, 0, 1, sz[1], sz[2], grayGR.(im)) + end + GR.updatews() end function visualise(channel_or_toggle, imgs)