src/Visualise.jl

changeset 24
f6630036e588
parent 16
9b0cfc67d6cb
child 26
863711a498fe
equal deleted inserted replaced
23:64a3f09e5fa7 24:f6630036e588
80 80
81 function do_visualise(imgs; refresh=true) 81 function do_visualise(imgs; refresh=true)
82 n = length(imgs) 82 n = length(imgs)
83 # Get device dimensions in metres and pixels 83 # Get device dimensions in metres and pixels
84 scrw, scrh, pw, ph = GR.inqdspsize() 84 scrw, scrh, pw, ph = GR.inqdspsize()
85 aspect = n > 0 ? Float64(size(imgs[1], 1))/Float64(size(imgs[1], 2)) : 1
85 # Scaling to maximums ize window 86 # Scaling to maximums ize window
86 sc=0.7 87 sc=0.7
87 # Set up window and transformations 88 # Set up window and transformations
88 GR.clearws() 89 GR.clearws()
89 GR.setscale(0); 90 GR.setscale(0);
90 GR.selntran(1) 91 GR.selntran(1)
91 # - First OS window size 92 # - First OS window size
92 if scrw/n>scrh 93 if scrw/n>scrh
93 GR.setwsviewport(0, sc*scrh*n, 0, sc*scrh) 94 GR.setwsviewport(0, sc*scrh*n, 0, sc*scrh*aspect)
94 else 95 else
95 GR.setwsviewport(0, sc*scrw, 0, sc*scrw/n) 96 GR.setwsviewport(0, sc*scrw, 0, sc*scrw/n*aspect)
96 end 97 end
97 # - Part of normalised window shown 98 # - Part of normalised window shown
98 GR.setwswindow(0, 1, 0, 1/n); 99 GR.setwswindow(0, 1, 0, 1/n*aspect);
99 GR.setviewport(0, 1, 0, 1/n); 100 GR.setviewport(0, 1, 0, 1/n*aspect);
100 # Workd coordinates 101 # World coordinates
101 GR.setwindow(0, n, 0, 1) 102 GR.setwindow(0, n, 0, aspect)
102 # Plot images 103 # Plot images
103 for i=1:n 104 for i=1:n
104 im = imgs[i]' 105 im = imgs[i]'
105 sz = size(im) 106 sz = size(im)
106 GR.drawimage(i-1, i, 0, 1, sz[1], sz[2], grayGR.(im)) 107 GR.drawimage(i-1, i, 0, aspect, sz[1], sz[2], grayGR.(im))
107 end 108 end
108 if refresh 109 if refresh
109 GR.updatews() 110 GR.updatews()
110 end 111 end
111 end 112 end

mercurial