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
|
# 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.
$for (silrd)
int procedure ima_nl$t (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 impnl$t(), imgnl$t()
begin
if (impnl$t (im[1], data[1], v[1,1]) == EOF)
return (EOF)
for (i=2; i <= nimages; i=i+1) {
if (imgnl$t (im[i], data[i], v[1,i]) == EOF) {
if (IM_NDIM(im[i]) > 1) {
call amovkl (long(1), v[1,i], IM_MAXDIM)
if (imgnl$t (im[i], data[i], v[1,i]) == EOF)
call error (0, "Error reading image line")
}
}
}
return (OK)
end
$endfor
|