1
! @(#)gammacorr.prg 19.1 (ESO-DMD) 02/25/03 13:20:11
2
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
! MIDAS procedure gammacorr.prg to produce ITTs for gamma correction
7
! use via @@ gammacorr itt_name [gamma]
8
! with itt_name = name of ITT, defaulted to gammacorr
9
! gamma = gamma value of display
11
! an ITT is created according to the formula
12
! itt = k ** (1.0/gamma) (k=0,1,...,256)
14
! If gamma is omitted a template file is loaded and the gamma value
15
! can be determined interactively by clicking in sub-window where the
16
! right and left background match most closely. The gamma value printed
17
! in that sub-window is then used as input to the procedure.
19
! if a graphics window does exist, the resulting ITT is plotted there
20
! if the template file is loaded, the ITT is applied
22
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24
define/par p1 gammacorr ? "Enter name of resulting ITT: "
25
define/par p2 + n "Enter gamma of display:"
27
define/local rr/r/1/1 0.0
29
if p2(1:1) .eq. "+" then
30
if mid$sess(6:6) .ne. "3" then
31
create/disp 3 300,832,400,40 ? no
33
load/image MID_TEST:gammacorr.fits
35
write/out "choose (with cursor) sub-window where right/left" -
36
background match most closely
37
get/cursor ? ? ? 1,1 >Null
38
inputi = (outputr(11)-1)/64
41
write/out selected gamma = {rr}
47
crea/ima &s 1,256 ? sequence 0.,1
48
comp/ima &b = &s**{rr}
50
if mid$sess(7:7) .ne. " " .and. mid$sess(7:7) .ne. "-" then
51
set/graph colo=1 ltype=1 stype=0 lwidth=1
52
plot/axes 0,255 -0.1,1.1 ? ITT:{p1} Intensity
53
set/graph colo=4 !use blue colour
58
write/descr middumma.tbl history/c/1/80 "y = x**{rr}"
59
name/col middumma #1 :ITT
61
$cp middumma.tbl {p1}.itt
62
if p2(1:1) .eq. "+" load/itt {p1}