aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/imutil/src/generic/imanl.x
blob: 8ec958c47fece73642e74000d503a712cdc5721a (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<imhdr.h>

# IMA_NL -- For each line in the output image lines from the input images
# are returned.  The input images are repeated as necessary.  EOF is returned
# when the last line of the output image has been reached.  One dimensional
# images are read only once and the data pointers are assumed to be unchanged
# from previous calls.  The image line vectors must be initialized externally
# and then left untouched.
# 
# This procedure is typically used when operations upon lines or pixels
# make sense in mixed dimensioned images.  For example to add a one dimensional
# image to all lines of a higher dimensional image or to subtract a
# two dimensional image from all bands of three dimensional image.
# The lengths of the common dimensions should generally be checked
# for equality with xt_imleneq.


int procedure ima_nls (im, data, v, nimages)

pointer	im[nimages]		# IMIO pointers; the first one is the output
pointer	data[nimages]		# Returned data pointers
long	v[IM_MAXDIM, nimages]	# Line vectors
int	nimages			# Number of images

int	i

int	impnls(), imgnls()

begin
	if (impnls (im[1], data[1], v[1,1]) == EOF)
	    return (EOF)

	for (i=2; i <= nimages; i=i+1) {
	    if (imgnls (im[i], data[i], v[1,i]) == EOF) {
	        if (IM_NDIM(im[i]) > 1) {
	            call amovkl (long(1), v[1,i], IM_MAXDIM)
                    if (imgnls (im[i], data[i], v[1,i]) == EOF)
			call error (0, "Error reading image line")
	        }
	    }
	}

	return (OK)
end

int procedure ima_nli (im, data, v, nimages)

pointer	im[nimages]		# IMIO pointers; the first one is the output
pointer	data[nimages]		# Returned data pointers
long	v[IM_MAXDIM, nimages]	# Line vectors
int	nimages			# Number of images

int	i

int	impnli(), imgnli()

begin
	if (impnli (im[1], data[1], v[1,1]) == EOF)
	    return (EOF)

	for (i=2; i <= nimages; i=i+1) {
	    if (imgnli (im[i], data[i], v[1,i]) == EOF) {
	        if (IM_NDIM(im[i]) > 1) {
	            call amovkl (long(1), v[1,i], IM_MAXDIM)
                    if (imgnli (im[i], data[i], v[1,i]) == EOF)
			call error (0, "Error reading image line")
	        }
	    }
	}

	return (OK)
end

int procedure ima_nll (im, data, v, nimages)

pointer	im[nimages]		# IMIO pointers; the first one is the output
pointer	data[nimages]		# Returned data pointers
long	v[IM_MAXDIM, nimages]	# Line vectors
int	nimages			# Number of images

int	i

int	impnll(), imgnll()

begin
	if (impnll (im[1], data[1], v[1,1]) == EOF)
	    return (EOF)

	for (i=2; i <= nimages; i=i+1) {
	    if (imgnll (im[i], data[i], v[1,i]) == EOF) {
	        if (IM_NDIM(im[i]) > 1) {
	            call amovkl (long(1), v[1,i], IM_MAXDIM)
                    if (imgnll (im[i], data[i], v[1,i]) == EOF)
			call error (0, "Error reading image line")
	        }
	    }
	}

	return (OK)
end

int procedure ima_nlr (im, data, v, nimages)

pointer	im[nimages]		# IMIO pointers; the first one is the output
pointer	data[nimages]		# Returned data pointers
long	v[IM_MAXDIM, nimages]	# Line vectors
int	nimages			# Number of images

int	i

int	impnlr(), imgnlr()

begin
	if (impnlr (im[1], data[1], v[1,1]) == EOF)
	    return (EOF)

	for (i=2; i <= nimages; i=i+1) {
	    if (imgnlr (im[i], data[i], v[1,i]) == EOF) {
	        if (IM_NDIM(im[i]) > 1) {
	            call amovkl (long(1), v[1,i], IM_MAXDIM)
                    if (imgnlr (im[i], data[i], v[1,i]) == EOF)
			call error (0, "Error reading image line")
	        }
	    }
	}

	return (OK)
end

int procedure ima_nld (im, data, v, nimages)

pointer	im[nimages]		# IMIO pointers; the first one is the output
pointer	data[nimages]		# Returned data pointers
long	v[IM_MAXDIM, nimages]	# Line vectors
int	nimages			# Number of images

int	i

int	impnld(), imgnld()

begin
	if (impnld (im[1], data[1], v[1,1]) == EOF)
	    return (EOF)

	for (i=2; i <= nimages; i=i+1) {
	    if (imgnld (im[i], data[i], v[1,i]) == EOF) {
	        if (IM_NDIM(im[i]) > 1) {
	            call amovkl (long(1), v[1,i], IM_MAXDIM)
                    if (imgnld (im[i], data[i], v[1,i]) == EOF)
			call error (0, "Error reading image line")
	        }
	    }
	}

	return (OK)
end