This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow9.cl
128 lines (116 loc) · 3.25 KB
/
show9.cl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# SHOW9: 05OCT93 KMM
# SHOW9 - display 3x3 grid of (sky-subtracted) sqiid frames
# Assumes imt800 for proper operation
procedure show9 (first_image, frame, path_pos)
string first_image {"",prompt="First image in sequentially numbered images"}
int frame {prompt="Display frame #"}
string path_pos {prompt="Path position in grid (1-9)?"}
bool dithered {yes, prompt="Dithered image pairs?"}
string sky {"null", prompt="sky frame"}
bool orient {no, prompt="Orient N up and E left?"}
bool zscale {yes, prompt="automatic zcale on each frame?"}
string ztrans {"linear", prompt="intensity transform: log|linear|none"}
real z1 {0.0, prompt="minimum intensity"}
real z2 {1000.0, prompt="maximum intensity"}
struct *l_list
begin
file l_log, simg, nimlist
int i, nim, maxnim, stat, npos
real x,y,x1,x2,x3,y1,y2,y3
bool erase
string first, img, uniq, pathpos
uniq = mktemp ("_Tsh9")
simg = uniq // ".img"
l_log = mktemp ("tmp$sh9")
nimlist = mktemp ("tmp$sh9")
# Get positional parameters
first = first_image
nim = frame
pathpos = path_pos
expandnim (pathpos,ref_nim=-1,max_nim=9,>> nimlist)
count (nimlist,>> l_log)
l_list = l_log
stat = fscan(l_list, maxnim)
if (maxnim < 1 || maxnim > 9) {
print ("Wrong number of images:",maxnim)
goto skip
}
x1 = 0.18
x2 = 0.50
x3 = 0.82
if (orient) {
y1 = 0.82
y2 = 0.50
y3 = 0.18
} else {
y1 = 0.18
y2 = 0.50
y3 = 0.82
}
l_list = nimlist
for (i=1; (fscan(l_list, npos) != EOF); i += 1) {
if (dithered)
img = first + (2 * (npos - 1))
else
img = first + (npos - 1)
if ((! access(img)) && (! access(img//".imh"))) next
switch (npos) {
case 1: {
x = x1; y = y1
erase = yes
}
case 2: {
x = x2; y = y1
erase = no
}
case 3: {
x = x3; y = y1
erase = no
}
case 4: {
x = x1; y = y2
erase = no
}
case 5: {
x = x2; y = y2
erase = no
}
case 6: {
x = x3; y = y2
erase = no
}
case 7: {
x = x1; y = y3
erase = no
}
case 8: {
x = x2; y = y3
erase = no
}
case 9: {
x = x3; y = y3
erase = no
}
}
if (sky == "" || sky == " " || sky == "null")
imcopy (img, simg, verbose-)
else {
if ((! access(sky)) && (! access(sky//".imh")))
print ("Sky image: ",sky," not found!")
else
imarith (img,"-",sky,simg,pix="real",calc="real",hpar="")
}
if (orient)
imcopy (simg//"[*,-*]", simg, verbose-)
if (zscale) {
display(simg,nim,xc=x,yc=y,erase=erase,zs+,zr-,fill-,ztrans=ztrans)
} else {
display(simg,nim,xc=x,yc=y,erase=erase,zs-,zr-,fill-,ztrans=ztrans,
z1=z1,z2=z2)
}
imdelete (simg,verify-,>& "dev$null")
}
skip:
delete (l_log//","//nimlist,ver-,>& "dev$null")
imdelete (simg,verify-,>& "dev$null")
end