aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/stxtools/grmimy.x
blob: bd30f93ebe061f0902d4f94a287de1c75308c3e1 (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 <imhdr.h>

#---------------------------------------------------------------------------
.help grm_imcopy Oct92 source
.ih
NAME
grm_imcopy -- Copy images given their image descriptors.
.endhelp
#---------------------------------------------------------------------------
procedure grm_imcopy (in, out)

pointer in                      # I:  Input image descriptor of image to copy.
pointer out                     # I:  Output image descriptor of resultant image.

# Declarations.
long    v1[IM_MAXDIM], v2[IM_MAXDIM]    # Line and section counters.

int     junk                            # Generic.
int     npix                            # Length of a line of data.

pointer buf1, buf2                      # Data buffers.

# Function Prototypes.
int	imgnls(), imgnll(), imgnlr(), imgnld(), imgnlx()
int	impnls(), impnll(), impnlr(), impnld(), impnlx()

begin
        
	# Setup start vector for sequential reads and writes.
	call amovkl (long(1), v1, IM_MAXDIM)
	call amovkl (long(1), v2, IM_MAXDIM)
        
	# Copy the image.
	npix = IM_LEN(in, 1)
	switch (IM_PIXTYPE(in)) {
	case TY_SHORT:
	    while (imgnls (in, buf1, v1) != EOF) {
		junk = impnls (out, buf2, v2)
		call amovs (Mems[buf1], Mems[buf2], npix)
	    }
	case TY_USHORT, TY_INT, TY_LONG:
	    while (imgnll (in, buf1, v1) != EOF) {
		junk = impnll (out, buf2, v2)
		call amovl (Meml[buf1], Meml[buf2], npix)
	    }
	case TY_REAL:
	    while (imgnlr (in, buf1, v1) != EOF) {
		junk = impnlr (out, buf2, v2)
		call amovr (Memr[buf1], Memr[buf2], npix)
	    }
	case TY_DOUBLE:
	    while (imgnld (in, buf1, v1) != EOF) {
		junk = impnld (out, buf2, v2)
		call amovd (Memd[buf1], Memd[buf2], npix)
	    }
	case TY_COMPLEX:
	    while (imgnlx (in, buf1, v1) != EOF) {
	        junk = impnlx (out, buf2, v2)
		call amovx (Memx[buf1], Memx[buf2], npix)
	    }
	default:
	    call error (1, "unknown pixel datatype")
	}
        
end
#---------------------------------------------------------------------------
# End of grm_imcopy
#---------------------------------------------------------------------------