aboutsummaryrefslogtreecommitdiff
path: root/sys/imfort/tasks/readim.f
blob: 466da0e0d01304d58c599fd2b0c16798f812ac3a (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
c READIM -- Read through an image and count the lines (used for timing tests).
c Tests line sequential i/o.
c
c	usage:  readim image
c ----------------------------------------------------------------------------

	program readim

	character*80	image, errmsg
	integer		ncols, nlines, nbands, j, k
	integer		im, ier, axlen(7), naxis, dtype
	integer*2	pix(8192)

c --- Get image name.
	call clargc (1, image, ier)
	if (ier .ne. 0) then
	    write (*, '('' enter image name: '',$)')
	    read (*,*) image
	endif

c --- Open the image.
	call imopen (image, 1, im, ier)
	if (ier .ne. 0) goto 91
	call imgsiz (im, axlen, naxis, dtype, ier)
	if (ier .ne. 0) goto 91

	ncols  = axlen(1)
	nlines = axlen(2)
	nbands = axlen(3)

c --- Read through the image.
	do 20 k = 1, nbands
	    do 10 j = 1, nlines
		call imgl3s (im, pix, j, k, ier)
		if (ier .ne. 0) goto 91
 10	    continue
 20	continue

c --- Clean up.
	call imclos (im, ier)
	if (ier .ne. 0) goto 91

	print 81, nlines, image
 81	format (' read ', i4, ' lines from image ', a64)

	stop

c --- Error exit.
 91	call imemsg (ier, errmsg)
	write (*, '('' Error: '', a80)') errmsg

	stop
	end