~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to applic/proc/gammacorr.prg

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
! @(#)gammacorr.prg     19.1 (ESO-DMD) 02/25/03 13:20:11
 
2
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
3
 
4
!  MIDAS procedure gammacorr.prg to produce ITTs for gamma correction
 
5
!  K. Banse  970623
 
6
 
7
!  use via @@ gammacorr itt_name [gamma]
 
8
!  with  itt_name = name of ITT, defaulted to gammacorr
 
9
!        gamma = gamma value of display
 
10
!  
 
11
!  an ITT is created according to the formula
 
12
!  itt = k ** (1.0/gamma)     (k=0,1,...,256)
 
13
!
 
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.
 
18
 
19
!  if a graphics window does exist, the resulting ITT is plotted there
 
20
!  if the template file is loaded, the ITT is applied
 
21
!  
 
22
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
23
 
24
define/par p1 gammacorr ? "Enter name of resulting ITT: "
 
25
define/par p2 + n "Enter gamma of display:"
 
26
 
27
define/local rr/r/1/1 0.0
 
28
 
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
 
32
    endif
 
33
    load/image MID_TEST:gammacorr.fits
 
34
    load/lut ramp
 
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
 
39
    rr = 0.6 + 0.2*inputi
 
40
    set/format f3.1
 
41
    write/out selected gamma = {rr}
 
42
else
 
43
   rr = {p2}
 
44
endif
 
45
rr = 1./rr
 
46
 
47
crea/ima &s 1,256 ? sequence 0.,1
 
48
comp/ima &b = &s**{rr}
 
49
 
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
 
54
   overplot &b  
 
55
endif
 
56
 
57
copy/it &b middumma 
 
58
write/descr middumma.tbl history/c/1/80 "y = x**{rr}"
 
59
name/col middumma #1 :ITT
 
60
 
61
$cp middumma.tbl {p1}.itt
 
62
if p2(1:1) .eq. "+" load/itt {p1}