1
! @(#)vertlut.prg 19.1 (ESO-DMD) 02/25/03 13:20:21
2
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
! MIDAS procedure vertlut.prg to provide a vertical LUT at the left side
5
! of the loaded image with tick marks + labels
8
! this procedure should be executed once an image is ready for hardcopy,
9
! i.e. the image is loaded and labels and graphics in the overlay are done
10
! the next step is then the COPY/DISPLAY command
12
! execute via @a vertlut LUTspecs tick_color no_ticks label_format lside
13
! with LUTspecs = xsize,ysize,xoff,yoff of LUTbar;
14
! defaulted to 20,ydisp-10,4,4
15
! tick_color = string with the color for tick marks
16
! any of the Plot Colors (defaulted to white)
17
! no_ticks = no. of tickmarks on LUT (defaulted to 6)
18
! label_format = string with format used for writing intensities at
19
! tick marks (defaulted to F4.2)
20
! lside = right or left, if intensities are written to the right or
21
! left of LUTbar (defaulted to right)
23
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25
define/local lutsiz/i/1/4 20,{ididev(3)},4,4
26
lutsiz(2) = lutsiz(2)-10
28
define/param p1 20,{lutsiz(2)},4,4 N "Enter size+offset of LUTbar: "
29
define/param p2 white C "Enter color for drawing:"
30
define/param p3 6 N "Enter no. of tick-marks:"
31
define/param p4 f4.2 C "Enter format of intensities at tick-marks:"
32
define/param p5 right C -
33
"Enter right or left, to indicate where tick-marks are drawn:"
36
define/local xypos/i/1/7 0 all
37
define/local ticki/i/1/3 0 all
38
define/local pix/r/1/5 0. all
39
pix(3) = {*,lhcuts(1)} !low cut of loaded image
40
pix(4) = {*,lhcuts(2)}-pix(3) !data interval of loaded image
41
pix(2) = pix(4)/(ididev(17)-1.) !data_interval/LUTsize
43
! build vertical LUTbar
45
write/keyw lutsiz {p1}
46
define/local fac/r/1/3 0.,{ididev(17)},{lutsiz(2)}
47
fac(1) = (fac(2)-1.)/(fac(3)-1.)
48
create/image MidVertLUT 2,{lutsiz(1)},{lutsiz(2)} ? poly 0.,0.,1
49
compute/image MidVertLUT = MidVertLUT*{fac}
51
set/midas clover=no !keep all drawings
53
! load LUTbar at left size of display in OVERWRITE mode
57
load/image MidVertLUT dirs=up,over fix=1,1,{xypos(1)},{xypos(2)}
58
xypos(3) = xypos(1)+lutsiz(1)
59
xypos(4) = xypos(2)+lutsiz(2)
60
draw/rect {xypos(1)},{xypos(2)},{xypos(3)},{xypos(4)} ? ? {p2}
62
! calculate offsets for tick marks
67
if p5(1:1) .eq. "R" then
70
xypos(5) = xypos(1)-26
72
label/disp {pix(3)} {xypos(2)},{xypos(5)} ? {p2}
77
inputr = lutsiz(1)*0.25
78
ticki(1) = m$nint(inputr)
81
inputr(2) = lutsiz(2)/inputr
82
ticki(2) = m$nint(inputr(2))
85
! draw tick marks (using keyword mode for speed)
87
if p5(1:1) .eq. "R" then
88
xypos(5) = xypos(3)-ticki(1)
92
xypos(7) = xypos(1)+ticki(1)
94
if ticki(3) .gt. 0 then
96
do inputi = 1 ticki(3)
97
xypos(6) = xypos(6)+ticki(2)
98
draw/line {xypos(5)},{xypos(6)},{xypos(7)},{xypos(6)} ? ? {p2}
104
if p5(1:1) .eq. "R" then !set x-offset for labels
105
xypos(5) = xypos(3)+3
107
xypos(5) = xypos(1)-26
110
! draw intensities at tick marks
113
do inputi = 0 ticki(3)
114
pix = pix(5)*pix(2)+pix(3)
115
label/disp {pix} {xypos(7)},{xypos(5)} ? {p2}
116
xypos(6) = xypos(6)+ticki(2)
117
xypos(7) = xypos(6)-3
118
pix(5) = ticki(2)*(inputi+1.)*fac
120
xypos(7) = xypos(4)-4
121
pix = (ididev(17)-1.)*pix(2)+pix(3) !last label
122
label/disp {pix} {xypos(7)},{xypos(5)} ? {p2}
125
if aux_mode .lt. 2 then !VMS
126
-delete MidVertLUT.bdf.*
128
-delete MidVertLUT.bdf