	subroutine get_size_pos(size,posrow,poscol,ip)
	integer*4 size,posrow,poscol,ip
c
c		gets size and position of picture from operator
c
	integer*4 isize(3)
	data isize/512,256,128/
c
c
10	continue
	if(size .ne. 0) goto 17 !if called from over_ride
	write(6,101)
101	format(' Enter size of picture:'/
     1		'     1 - 512x512'/
     2		'     2 - 256x256'/
     3		'     3 - 128x128')
	read(5,102)jsize
102	format(i)
c		filter the input
	if (jsize.lt.1  .or. jsize.gt.3) then
	   type *,' Size must be between 1 and 3'
	   goto 10
	endif
c
	size=isize(jsize)
c
c
17	continue
c		Get the desired position
	posrow=1
	poscol=1
	if(size.eq.512)return
c
c		size=2
20	continue
	if(size.eq.256) then
	   write(6,104),ip
104	   format('    11  |  12'/
     1            '    ----|----'/
     2            '    21  |  22'/
     3            ' Enter posit as a SINGLE 2 digit nmbr <',i2,'>: ',$)
	   read(5,102)ipq
	   if (ipq.ne.0) ip = ipq
	   posrow= ip/10
	   poscol= jmod(ip,10)
	   if ( (posrow.lt.1) .or. (posrow.gt.2) .or. (poscol.lt.1)
     1                   .or. (poscol.gt.2)) then
	        type *, ' Row or column out of range'
	        goto 20
	        endif
	   return
	   endif
c
c		size=3
30	continue
	if (size.ne.128) stop ' get_siz_pos...logic error'
	   write(6,105)ip
105	   format('   11 | 12 | 13 | 14'/
     1		  '   ------------------'/
     2		  '   21 | 22 | 23 | 24'/
     3		  '   ------------------'/
     4  	  '   31 | 32 | 33 | 34'/
     5		  '   -----------------'/
     6		  '   41 | 42 | 43 | 44'/
     7		  ' Enter a SINGLE 2 digit number <',i2,'>: ',$)
	   read(5,102)ipq
	   if (ipq.ne.0) ip = ipq
	   posrow=ip/10
	   poscol=jmod(ip,10)
	   if ( (posrow.lt.1) .or. (posrow.gt.4) .or. (poscol.lt.1)
     1			.or. (poscol.gt. 4) ) then
	           type *,' Row or column out of range'
	           goto 30
	           endif
	return
	end
c
	subroutine open_head(error,header,headfile)
	character headfile*35
	integer*2 header(256)
	logical error
c
c		Opens and reads the header file of an image
c		Current header format is an ascii file  
c			line   format		variable
c			1	I4		size (128,256,512)
c			2	I2		posrow
c			3	I2		poscol
c			4	I2		0=pixel form, 1=word form
c
	open(unit=1, name=headfile, 
     1		access='SEQUENTIAL', status='OLD', err=900)
	read(1,102)(header(i),i=1,4)
102	format(i4/i2/i2/i2)
	close(unit=1)
c	write(6,101)headfile
101	format(x,a35,' opened ok')
	error = .false.
	return
c
900	continue
	error=.true.
	write(6,103)headfile
103	format(x,a35,' not found')
	return
	end
c
	subroutine over_ride(size,posrow,poscol,header)
c
c		allows operator to override default size and
c		position of where image is placed on the adage
c
	integer*4 posrow,poscol,size
	integer*2 header(256)
	logical error
	integer*2 isize,row,col,ptype
c
c
	integer*4 ip
c
	size = header(1)
	row = header(2)
	col = header(3)
	ip = row*10 + col
	call get_size_pos(size,posrow,poscol,ip)
	return
	end
