aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/immatch/src/xregister/rgxtools.x
blob: e1fb921eda34a8dfdd2b8fa3e8739b6c6541e06c (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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
include "xregister.h"

#  RG_XINIT -- Initialize the cross-correlation code fitting structure. 

procedure rg_xinit (xc, cfunc)

pointer	xc		#O pointer to the cross-correlation structure
int	cfunc		#I the input cross-correlation function

begin
	call malloc (xc, LEN_XCSTRUCT, TY_STRUCT)

	# Initialize the regions pointers.
	XC_RC1(xc) = NULL
	XC_RC2(xc) = NULL
	XC_RL1(xc) = NULL
	XC_RL2(xc) = NULL
	XC_RZERO(xc) = NULL
	XC_RXSLOPE(xc) = NULL
	XC_RYSLOPE(xc) = NULL
	XC_XSHIFTS(xc) = NULL
	XC_YSHIFTS(xc) = NULL
	XC_TXSHIFT(xc) = 0.0
	XC_TYSHIFT(xc) = 0.0
	XC_NREGIONS(xc) = 0
	XC_CREGION(xc) = 1

	# Set up transformation parameters.
	XC_NREFPTS(xc) = 0
	call malloc (XC_XREF(xc), MAX_NREF, TY_REAL)
	call malloc (XC_YREF(xc), MAX_NREF, TY_REAL)
	call malloc (XC_TRANSFORM(xc), MAX_NTRANSFORM, TY_REAL)

	# Initialize the region offsets
	XC_IXLAG(xc) = DEF_IXLAG
	XC_IYLAG(xc) = DEF_IYLAG
	XC_XLAG(xc) = DEF_IXLAG
	XC_YLAG(xc) = DEF_IYLAG
	XC_DXLAG(xc) = DEF_DXLAG
	XC_DYLAG(xc) = DEF_DYLAG
		
	# Define the background fitting parameters.
	XC_BACKGRD(xc) = XC_BNONE
	call strcpy ("none", XC_BSTRING(xc), SZ_FNAME)
	XC_BVALUER(xc) = 0.0
	XC_BVALUE(xc) = 0.0
	XC_BORDER(xc) = DEF_BORDER
	XC_LOREJECT(xc) = DEF_LOREJECT
	XC_HIREJECT(xc) = DEF_HIREJECT
	XC_APODIZE(xc) = 0.0
	XC_FILTER(xc) = XC_FNONE
	call strcpy ("none", XC_FSTRING(xc), SZ_FNAME)

	# Get the correlation parameters.
	XC_CFUNC(xc) = cfunc
	switch (cfunc) {
	case XC_DISCRETE:
	    call strcpy ("discrete", XC_CSTRING(xc), SZ_FNAME)
	case XC_FOURIER:
	    call strcpy ("fourier", XC_CSTRING(xc), SZ_FNAME)
	case XC_FILE:
	    call strcpy ("file", XC_CSTRING(xc), SZ_FNAME)
	case XC_DIFFERENCE:
	    call strcpy ("difference", XC_CSTRING(xc), SZ_FNAME)
	default:
	    call strcpy ("unknown", XC_CSTRING(xc), SZ_FNAME)
	}
	XC_XWINDOW(xc) = DEF_XWINDOW
	XC_YWINDOW(xc) = DEF_YWINDOW
	XC_XCOR(xc) = NULL

	# Define the peak fitting function.
	XC_PFUNC(xc) = DEF_PFUNC
	call sprintf (XC_PSTRING(xc), SZ_FNAME, "%s")
	    call pargstr ("centroid")
	XC_XCBOX(xc) = DEF_XCBOX
	XC_YCBOX(xc) = DEF_YCBOX

	# Initialize the strings.
	XC_IMAGE(xc) = EOS
	XC_REFIMAGE(xc) = EOS
	XC_REGIONS(xc) = EOS
	XC_DATABASE(xc) = EOS
	XC_OUTIMAGE(xc) = EOS
	XC_REFFILE(xc) = EOS
	XC_RECORD(xc) = EOS

	# Initialize the buffers.
	call rg_xrinit (xc)

end


#  RG_XRINIT -- Initialize the regions definition portion of the 
# cross correlation code fitting structure. 

procedure rg_xrinit (xc)

pointer	xc		#I pointer to crosscor structure

begin
	call rg_xrfree (xc)

	XC_NREGIONS(xc) = 0
	XC_CREGION(xc) = 1

	call malloc (XC_RC1(xc), MAX_NREGIONS, TY_INT)
	call malloc (XC_RC2(xc), MAX_NREGIONS, TY_INT)
	call malloc (XC_RL1(xc), MAX_NREGIONS, TY_INT)
	call malloc (XC_RL2(xc), MAX_NREGIONS, TY_INT)
	call malloc (XC_RZERO(xc), MAX_NREGIONS, TY_REAL)
	call malloc (XC_RXSLOPE(xc), MAX_NREGIONS, TY_REAL)
	call malloc (XC_RYSLOPE(xc), MAX_NREGIONS, TY_REAL)
	call malloc (XC_XSHIFTS(xc), MAX_NREGIONS, TY_REAL)
	call malloc (XC_YSHIFTS(xc), MAX_NREGIONS, TY_REAL)

	call amovki (INDEFI, Memi[XC_RC1(xc)], MAX_NREGIONS)
	call amovki (INDEFI, Memi[XC_RC2(xc)], MAX_NREGIONS)
	call amovki (INDEFI, Memi[XC_RL1(xc)], MAX_NREGIONS)
	call amovki (INDEFI, Memi[XC_RL2(xc)], MAX_NREGIONS)
	call amovkr (INDEFR, Memr[XC_RZERO(xc)], MAX_NREGIONS)
	call amovkr (INDEFR, Memr[XC_RXSLOPE(xc)], MAX_NREGIONS)
	call amovkr (INDEFR, Memr[XC_RYSLOPE(xc)], MAX_NREGIONS)
	call amovkr (INDEFR, Memr[XC_XSHIFTS(xc)], MAX_NREGIONS)
	call amovkr (INDEFR, Memr[XC_YSHIFTS(xc)], MAX_NREGIONS)

	XC_TXSHIFT(xc) = 0.0
	XC_TYSHIFT(xc) = 0.0
end


# RG_XCINDEFR -- Re-initialize the background and answers regions portion of
# the cross-correlation fitting structure

procedure rg_xcindefr (xc, creg)

pointer	xc		#I pointer to the cross-correlation structure
int     creg            #I the current region

int	nregions
int	rg_xstati()

begin
	nregions = rg_xstati (xc, NREGIONS)
	if (creg < 1 || creg > nregions)
	    return

	if (nregions > 0) {
	    Memr[XC_RZERO(xc)+creg-1] = INDEFR
	    Memr[XC_RXSLOPE(xc)+creg-1] = INDEFR
	    Memr[XC_RYSLOPE(xc)+creg-1] = INDEFR
	    Memr[XC_XSHIFTS(xc)+creg-1] = INDEFR
	    Memr[XC_YSHIFTS(xc)+creg-1] = INDEFR
	}

	XC_TXSHIFT(xc) = 0.0
	XC_TYSHIFT(xc) = 0.0
end


# RG_XINDEFR -- Re-initialize the background and answers regions portion of
# the cross-correlation fitting structure for all regions and reset the
# current region to 1.

procedure rg_xindefr (xc)

pointer xc              #I pointer to the cross-correlation structure

int     nregions
int     rg_xstati()

begin
        nregions = rg_xstati (xc, NREGIONS)

        if (nregions > 0) {
            call amovkr (INDEFR, Memr[XC_RZERO(xc)], nregions)
            call amovkr (INDEFR, Memr[XC_RXSLOPE(xc)], nregions)
            call amovkr (INDEFR, Memr[XC_RYSLOPE(xc)], nregions)
            call amovkr (INDEFR, Memr[XC_XSHIFTS(xc)], nregions)
            call amovkr (INDEFR, Memr[XC_YSHIFTS(xc)], nregions)
        }

        XC_CREGION(xc) = 1
        XC_TXSHIFT(xc) = 0.0
        XC_TYSHIFT(xc) = 0.0
end


#  RG_XREALLOC -- Reallocate the regions bufffers and initialize if necessary.

procedure rg_xrealloc (xc, nregions)

pointer	xc		#I pointer to crosscor structure
int	nregions	#I number of regions

int	nr
int	rg_xstati()

begin
	nr = rg_xstati (xc, NREGIONS)

	call realloc (XC_RC1(xc), nregions, TY_INT)
	call realloc (XC_RC2(xc), nregions, TY_INT)
	call realloc (XC_RL1(xc), nregions, TY_INT)
	call realloc (XC_RL2(xc), nregions, TY_INT)
	call realloc (XC_RZERO(xc), nregions, TY_REAL)
	call realloc (XC_RXSLOPE(xc), nregions, TY_REAL)
	call realloc (XC_RYSLOPE(xc), nregions, TY_REAL)
	call realloc (XC_XSHIFTS(xc), nregions, TY_REAL)
	call realloc (XC_YSHIFTS(xc), nregions, TY_REAL)

	call amovki (INDEFI, Memi[XC_RC1(xc)+nr], nregions - nr)
	call amovki (INDEFI, Memi[XC_RC2(xc)+nr], nregions - nr)
	call amovki (INDEFI, Memi[XC_RL1(xc)+nr], nregions - nr)
	call amovki (INDEFI, Memi[XC_RL2(xc)+nr], nregions - nr)
	call amovkr (INDEFR, Memr[XC_RZERO(xc)+nr], nregions - nr)
	call amovkr (INDEFR, Memr[XC_RXSLOPE(xc)+nr], nregions - nr)
	call amovkr (INDEFR, Memr[XC_RYSLOPE(xc)+nr], nregions - nr)
	call amovkr (INDEFR, Memr[XC_XSHIFTS(xc)+nr], nregions - nr)
	call amovkr (INDEFR, Memr[XC_YSHIFTS(xc)+nr], nregions - nr)
end


# RG_XFREE -- Free the cross-correlation fitting structure.

procedure rg_xfree (xc)

pointer	xc		#I pointer to the cross-correlation structure

begin
	# Free the region descriptors.
	call rg_xrfree (xc)

	# Free the transformation descriptors.
	if (XC_XREF(xc) != NULL)
	    call mfree (XC_XREF(xc), TY_REAL)
	if (XC_YREF(xc) != NULL)
	    call mfree (XC_YREF(xc), TY_REAL)
	if (XC_TRANSFORM(xc) != NULL)
	    call mfree (XC_TRANSFORM(xc), TY_REAL)

	# Free the correlation function.
	if (XC_XCOR(xc) != NULL)
	    call mfree (XC_XCOR(xc), TY_REAL)

	call mfree (xc, TY_STRUCT)
end


# RG_XRFREE -- Free the regions portion of the cross-correlation structure.

procedure rg_xrfree (xc)

pointer	xc		#I pointer to the cross-correlation structure

begin
	call rg_xseti (xc, NREGIONS, 0)
	if (XC_RC1(xc) != NULL)
	    call mfree (XC_RC1(xc), TY_INT)
	XC_RC1(xc) = NULL
	if (XC_RC2(xc) != NULL)
	    call mfree (XC_RC2(xc), TY_INT)
	XC_RC2(xc) = NULL
	if (XC_RL1(xc) != NULL)
	    call mfree (XC_RL1(xc), TY_INT)
	XC_RL1(xc) = NULL
	if (XC_RL2(xc) != NULL)
	    call mfree (XC_RL2(xc), TY_INT)
	XC_RL2(xc) = NULL
	if (XC_RZERO(xc) != NULL)
	    call mfree (XC_RZERO(xc), TY_REAL)
	XC_RZERO(xc) = NULL
	if (XC_RXSLOPE(xc) != NULL)
	    call mfree (XC_RXSLOPE(xc), TY_REAL)
	XC_RXSLOPE(xc) = NULL
	if (XC_RYSLOPE(xc) != NULL)
	    call mfree (XC_RYSLOPE(xc), TY_REAL)
	XC_RYSLOPE(xc) = NULL
	if (XC_XSHIFTS(xc) != NULL)
	    call mfree (XC_XSHIFTS(xc), TY_REAL)
	XC_XSHIFTS(xc) = NULL
	if (XC_YSHIFTS(xc) != NULL)
	    call mfree (XC_YSHIFTS(xc), TY_REAL)
	XC_YSHIFTS(xc) = NULL
end


# RG_XSTATI -- Fetch the value of a cross-correlation fitting structure
# integer parameter.

int procedure rg_xstati (xc, param)

pointer	xc		#I pointer to the cross-correlation fitting structure
int	param		#I parameter to be fetched

begin
	switch (param) {
	case CFUNC:
	    return (XC_CFUNC(xc))
	case IXLAG:
	    return (XC_IXLAG(xc))
	case IYLAG:
	    return (XC_IYLAG(xc))
	case XLAG:
	    return (XC_XLAG(xc))
	case YLAG:
	    return (XC_YLAG(xc))
	case DXLAG:
	    return (XC_DXLAG(xc))
	case DYLAG:
	    return (XC_DYLAG(xc))
	case XWINDOW:
	    return (XC_XWINDOW(xc))
	case YWINDOW:
	    return (XC_YWINDOW(xc))
	case CREGION:
	    return (XC_CREGION(xc))
	case NREGIONS:
	    return (XC_NREGIONS(xc))
	case BACKGRD:
	    return (XC_BACKGRD(xc))
	case BORDER:
	    return (XC_BORDER(xc))
	case FILTER:
	    return (XC_FILTER(xc))
	case XCBOX:
	    return (XC_XCBOX(xc))
	case YCBOX:
	    return (XC_YCBOX(xc))
	case PFUNC:
	    return (XC_PFUNC(xc))
	case NREFPTS:
	    return (XC_NREFPTS(xc))
	default:
	    call error (0, "RG_XSTATI: Undefined integer parameter.")
	}
end


# RG_XSTATP -- Fetch the value of a pointer parameter.

pointer procedure rg_xstatp (xc, param)

pointer	xc		#I pointer to the cross-correlation structure
int	param		#I parameter to be fetched

begin
	switch (param) {
	case RC1:
	    return (XC_RC1(xc))
	case RC2:
	    return (XC_RC2(xc))
	case RL1:
	    return (XC_RL1(xc))
	case RL2:
	    return (XC_RL2(xc))
	case RZERO:
	    return (XC_RZERO(xc))
	case RXSLOPE:
	    return (XC_RXSLOPE(xc))
	case RYSLOPE:
	    return (XC_RYSLOPE(xc))
	case XSHIFTS:
	    return (XC_XSHIFTS(xc))
	case YSHIFTS:
	    return (XC_YSHIFTS(xc))
	case XCOR:
	    return (XC_XCOR(xc))
	case XREF:
	    return (XC_XREF(xc))
	case YREF:
	    return (XC_YREF(xc))
#	case CORAPODIZE:
#	    return (XC_CORAPODIZE(xc))
	case TRANSFORM:
	    return (XC_TRANSFORM(xc))
	default:
	    call error (0, "RG_XSTATP: Undefined pointer parameter.")
	}
end


# RG_XSTATR -- Fetch the value of a real parameter.

real procedure rg_xstatr (xc, param)

pointer	xc		#I pointer to the cross-correlation structure
int	param		#I parameter to be fetched

begin
	switch (param) {
	case BVALUER:
	    return (XC_BVALUER(xc))
	case BVALUE:
	    return (XC_BVALUE(xc))
	case LOREJECT:
	    return (XC_LOREJECT(xc))
	case HIREJECT:
	    return (XC_HIREJECT(xc))
	case APODIZE:
	    return (XC_APODIZE(xc))
	case TXSHIFT:
	    return (XC_TXSHIFT(xc))
	case TYSHIFT:
	    return (XC_TYSHIFT(xc))
	default:
	    call error (0, "RG_XSTATR: Undefined real parameter.")
	}
end


# RG_XSTATS -- Fetch the value of a string parameter.

procedure rg_xstats (xc, param, str, maxch)

pointer	xc		#I pointer to the cross-correlation structure
int	param		#I parameter to be fetched
char	str[ARB]	#O output value of string parameter
int	maxch		#I maximum number of characters in output string

begin
	switch (param) {
	case BSTRING:
	    call strcpy (XC_BSTRING(xc), str, maxch)
	case FSTRING:
	    call strcpy (XC_FSTRING(xc), str, maxch)
	case CSTRING:
	    call strcpy (XC_CSTRING(xc), str, maxch)
	case PSTRING:
	    call strcpy (XC_PSTRING(xc), str, maxch)
	case REFIMAGE:
	    call strcpy (XC_REFIMAGE(xc), str, maxch)
	case IMAGE:
	    call strcpy (XC_IMAGE(xc), str, maxch)
	case OUTIMAGE:
	    call strcpy (XC_OUTIMAGE(xc), str, maxch)
	case REGIONS:
	    call strcpy (XC_REGIONS(xc), str, maxch)
	case DATABASE:
	    call strcpy (XC_DATABASE(xc), str, maxch)
	case RECORD:
	    call strcpy (XC_RECORD(xc), str, maxch)
	case REFFILE:
	    call strcpy (XC_REFFILE(xc), str, maxch)
	default:
	    call error (0, "RG_XSTATS: Undefined string parameter.")
	}
end


# RG_XSETI -- Set the value of an integer parameter.

procedure rg_xseti (xc, param, value)

pointer	xc		#I pointer to the cross-correlation structure
int	param		#I parameter to be set
int	value		#O value of the integer parameter

begin
	switch (param) {
	case CFUNC:
	    XC_CFUNC(xc) = value
	    switch (value) {
	    case XC_DISCRETE:
		call strcpy ("discrete", XC_CSTRING(xc), SZ_FNAME)
	    case XC_FOURIER:
		call strcpy ("fourier", XC_CSTRING(xc), SZ_FNAME)
	    case XC_FILE:
		call strcpy ("file", XC_CSTRING(xc), SZ_FNAME)
	    case XC_DIFFERENCE:
		call strcpy ("difference", XC_CSTRING(xc), SZ_FNAME)
	    default:
		call strcpy ("unknown", XC_CSTRING(xc), SZ_FNAME)
	    }
	case IXLAG:
	    XC_IXLAG(xc) = value
	case IYLAG:
	    XC_IYLAG(xc) = value
	case XLAG:
	    XC_XLAG(xc) = value
	case YLAG:
	    XC_YLAG(xc) = value
	case DXLAG:
	    XC_DXLAG(xc) = value
	case DYLAG:
	    XC_DYLAG(xc) = value
	case XWINDOW:
	    XC_XWINDOW(xc) = value
	case YWINDOW:
	    XC_YWINDOW(xc) = value
	case BACKGRD:
	    XC_BACKGRD(xc) = value
	    switch (value) {
	    case XC_BNONE:
		call strcpy ("none", XC_BSTRING(xc), SZ_FNAME)
	    case XC_MEAN:
		call strcpy ("mean", XC_BSTRING(xc), SZ_FNAME)
	    case XC_MEDIAN:
		call strcpy ("median", XC_BSTRING(xc), SZ_FNAME)
	    case XC_SLOPE:
		call strcpy ("plane", XC_BSTRING(xc), SZ_FNAME)
	    default:
		call strcpy ("none", XC_BSTRING(xc), SZ_FNAME)
	    }
	case BORDER:
	    XC_BORDER(xc) = value
	case FILTER:
	    XC_FILTER(xc) = value
	    switch (value) {
	    case XC_FNONE:
		call strcpy ("none", XC_FSTRING(xc), SZ_FNAME)
	    case XC_LAPLACE:
		call strcpy ("laplace", XC_FSTRING(xc), SZ_FNAME)
	    default:
		call strcpy ("none", XC_FSTRING(xc), SZ_FNAME)
	    }
	case XCBOX:
	    XC_XCBOX(xc) = value
	case YCBOX:
	    XC_YCBOX(xc) = value
	case PFUNC:
	    XC_PFUNC(xc) = value
	    switch (value) {
	    case XC_PNONE:
		call strcpy ("none", XC_PSTRING(xc), SZ_FNAME)
	    case XC_CENTROID:
		call strcpy ("centroid", XC_PSTRING(xc), SZ_FNAME)
	    case XC_PARABOLA:
		call strcpy ("parabolic", XC_PSTRING(xc), SZ_FNAME)
	    case XC_SAWTOOTH:
		call strcpy ("sawtooth", XC_PSTRING(xc), SZ_FNAME)
#	    case XC_MARK:
#		call strcpy ("mark", XC_PSTRING(xc), SZ_FNAME)
	    default:
		;
	    }
	case NREFPTS:
	    XC_NREFPTS(xc) = value
	case CREGION:
	    XC_CREGION(xc) = value
	case NREGIONS:
	    XC_NREGIONS(xc) = value
	default:
	    call error (0, "RG_XSETI: Undefined integer parameter.")
	}
end


# RG_XSETP -- Set the value of a pointer parameter.

procedure rg_xsetp (xc, param, value)

pointer	xc		#I pointer to the cross-correlation structure
int	param		#I parameter to be set
pointer value		#O value of the pointer parameter

begin
	switch (param) {
	case RC1:
	    XC_RC1(xc) = value
	case RC2:
	    XC_RC2(xc) = value
	case RL1:
	    XC_RL1(xc) = value
	case RL2:
	    XC_RL2(xc) = value
	case RZERO:
	    XC_RZERO(xc) = value
	case RXSLOPE:
	    XC_RXSLOPE(xc) = value
	case RYSLOPE:
	    XC_RYSLOPE(xc) = value
	case XSHIFTS:
	    XC_XSHIFTS(xc) = value
	case YSHIFTS:
	    XC_YSHIFTS(xc) = value
	case XCOR:
	    XC_XCOR(xc) = value
	case XREF:
	    XC_XREF(xc) = value
	case YREF:
	    XC_YREF(xc) = value
	case TRANSFORM:
	    XC_TRANSFORM(xc) = value
#	case CORAPODIZE:
#	    XC_CORAPODIZE(xc) = value
	default:
	    call error (0, "RG_XSETP: Undefined pointer parameter.")
	}
end


# RG_XSETR -- Set the value of a real parameter.

procedure rg_xsetr (xc, param, value)

pointer	xc		#I pointer to the cross-correlation structure
int	param		#I parameter to be set
real	value		#O value of real parameter

begin
	switch (param) {
	case BVALUER:
	    XC_BVALUER(xc) = value
	case BVALUE:
	    XC_BVALUE(xc) = value
	case LOREJECT:
	    XC_LOREJECT(xc) = value
	case HIREJECT:
	    XC_HIREJECT(xc) = value
	case APODIZE:
	    XC_APODIZE(xc) = value
	case TXSHIFT:
	    XC_TXSHIFT(xc) = value
	case TYSHIFT:
	    XC_TYSHIFT(xc) = value
	default:
	    call error (0, "RG_XSETR: Undefined real parameter.")
	}
end


# RG_XSETS -- Set the value of a string parameter.

procedure rg_xsets (xc, param, str)

pointer	xc		#I pointer to the cross-correlation structure
int	param		#I parameter to be set
char	str[ARB]	#O value of string parameter

int	index
pointer	sp, temp
int	strdic(), fnldir()

begin
	call smark (sp)
	call salloc (temp, SZ_FNAME, TY_CHAR)

	switch (param) {
	case BSTRING:
	    index = strdic (str, str, SZ_LINE, XC_BTYPES)
	    if (index > 0) {
	    	call strcpy (str, XC_BSTRING(xc), SZ_FNAME)
		call rg_xseti (xc, BACKGRD, index)
	    }
	case FSTRING:
	    index = strdic (str, str, SZ_LINE, XC_FTYPES)
	    if (index > 0) {
	        call strcpy (str, XC_FSTRING(xc), SZ_FNAME)
		call rg_xseti (xc, FILTER, index)
	    }
	case CSTRING:
	    index = strdic (str, str, SZ_LINE, XC_CTYPES)
	    if (index > 0) {
	        call strcpy (str, XC_CSTRING(xc), SZ_FNAME)
		call rg_xseti (xc, CFUNC, index)
	    }
	case PSTRING:
	    call strcpy (str, XC_PSTRING(xc), SZ_FNAME)
	case REFIMAGE:
	    call imgcluster (str, Memc[temp], SZ_FNAME)
	    index = fnldir (Memc[temp], XC_REFIMAGE(xc), SZ_FNAME)
	    call strcpy (Memc[temp+index], XC_REFIMAGE(xc), SZ_FNAME)
	case IMAGE:
	    call imgcluster (str, Memc[temp], SZ_FNAME)
	    index = fnldir (Memc[temp], XC_IMAGE(xc), SZ_FNAME)
	    call strcpy (Memc[temp+index], XC_IMAGE(xc), SZ_FNAME)
	case OUTIMAGE:
	    call strcpy (str, XC_OUTIMAGE(xc), SZ_FNAME)
	case REGIONS:
	    call strcpy (str, XC_REGIONS(xc), SZ_FNAME)
	case DATABASE:
	    index = fnldir (str, XC_DATABASE(xc), SZ_FNAME)
	    call strcpy (str[index+1], XC_DATABASE(xc), SZ_FNAME)
	case RECORD:
	    call strcpy (str, XC_RECORD(xc), SZ_FNAME)
	case REFFILE:
	    index = fnldir (str, XC_REFFILE(xc), SZ_FNAME)
	    call strcpy (str[index+1], XC_REFFILE(xc), SZ_FNAME)
	default:
	    call error (0, "RG_XSETS: Undefined string parameter.")
	}

	call sfree (sp)
end