aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/immatch/src/xregister/rgxgpars.x
blob: 82943730fc49139ffc2d85b6cab12b9fa2411c9c (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
56
57
58
59
60
61
62
63
64
65
66
67
68
include "xregister.h"

# RG_XGPARS -- Read in the XREGISTER task algorithm parameters.

procedure rg_xgpars (xc)

pointer	xc		#I pointer to the main structure

int	xlag, ylag, xwindow, ywindow, xcbox, ycbox
pointer	sp, str
int	clgwrd(), clgeti()
real	clgetr()

begin
	# Allocate working space.
	call smark (sp)
	call salloc (str, SZ_LINE, TY_CHAR)

	# Initialize the correlation structure.
	call rg_xinit (xc, clgwrd ("correlation", Memc[str], SZ_LINE,
	    XC_CTYPES))

	# Fetch the initial shift information.
	xlag = clgeti ("xlag")
	ylag = clgeti ("ylag")
	call rg_xseti (xc, IXLAG, xlag)
	call rg_xseti (xc, IYLAG, ylag)
	call rg_xseti (xc, XLAG, xlag)
	call rg_xseti (xc, YLAG, ylag)
	call rg_xseti (xc, DXLAG, clgeti ("dxlag"))
	call rg_xseti (xc, DYLAG, clgeti ("dylag"))

	# Get the background value computation parameters.
	call rg_xseti (xc, BACKGRD, clgwrd ("background", Memc[str], SZ_LINE,
	    XC_BTYPES))
	call rg_xsets (xc, BSTRING, Memc[str])
	call rg_xseti (xc, BORDER, clgeti ("border"))
	call rg_xsetr (xc, LOREJECT, clgetr ("loreject"))
	call rg_xsetr (xc, HIREJECT, clgetr ("hireject"))
	call rg_xsetr (xc, APODIZE, clgetr ("apodize"))
	call rg_xseti (xc, FILTER, clgwrd ("filter", Memc[str], SZ_LINE,
	    XC_FTYPES))
	call rg_xsets (xc, FSTRING, Memc[str])

	# Get the window parameters and force the window size to be odd.
	xwindow = clgeti ("xwindow")
	if (mod (xwindow,2) == 0)
	    xwindow = xwindow + 1
	call rg_xseti (xc, XWINDOW, xwindow)
	ywindow = clgeti ("ywindow")
	if (mod (ywindow,2) == 0)
	    ywindow = ywindow + 1
	call rg_xseti (xc, YWINDOW, ywindow)

	# Get the peak fitting parameters.
	call rg_xseti (xc, PFUNC, clgwrd ("function", Memc[str], SZ_LINE,
	    XC_PTYPES))
	xcbox = clgeti ("xcbox")
	if (mod (xcbox,2) == 0)
	    xcbox = xcbox + 1
	call rg_xseti (xc, XCBOX, xcbox)
	ycbox = clgeti ("ycbox")
	if (mod (ycbox,2) == 0)
	    ycbox = ycbox + 1
	call rg_xseti (xc, YCBOX, ycbox)

	call sfree (sp)
end