aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/vtel/getsqib.x
blob: 76e7e44d51db8fd2e23102c3785f968c9bd02a84 (plain) (blame)
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
include <mach.h>
include <imhdr.h>
include "vt.h"

# GETSQIB -- Make a new image from a solar synoptic image containing just
# the squibby brightness.

procedure t_getsqib()

char	image[SZ_FNAME]		# input image
char	sqibimage[SZ_FNAME]	# output squibby brightness image

int	i, numpix
pointer	im, lgp, lpp, sqibim

pointer	immap(), imgl2s(), impl2s()
errchk	immap, imgl2s, impl2s

begin
	# Get parameters from the CL.
	call clgstr ("image", image, SZ_FNAME)
	call clgstr ("sqibimage", sqibimage, SZ_FNAME)

	# Open image.
	im = immap (image, READ_ONLY, 0)
	sqibim = immap (sqibimage, NEW_COPY, im)

	numpix = IM_LEN(im,1)
	do i = 1, IM_LEN(im,2) {
	    lgp = imgl2s (im, i)
	    lpp = impl2s (sqibim, i)
	    call sqibline (Mems[lgp], Mems[lpp], numpix)
	}

	# Unmap images.
	call imunmap (im)
	call imunmap (sqibim)
end


# SQIBLINE -- Unpack squibby brightness from line1 and put it into line2.

procedure sqibline (line1, line2, numpix)

short	line1[numpix]	# input image line
short	line2[numpix]	# output image line
int	numpix		# number of pixels in line

int	i
int	and()

begin
	do i = 1, numpix
	    line2[i] = and(int(line1[i]),17B)
end