pro checkcrop,ci,ri,cl,line_errs,total_errs
;
; This procedure compares a cropped image to a raw image and
; returns total error count and an array containing the error count
; one each line.
;
; Call checkcrop,ci,ri,cl,line_errs,total_errs
;	where:	ci is the cropped array
;		ri is the raw array
;		cl is the cropping list
;		line_errs is a returned array with one entry for each entry
;			  in cl, each of which contains number of erros on
;			  on that line.
;		total_errs: total number of pixels in error
;
;l=n_elements(cl)
l = cl(2)
j = 0L
total_errs = 0
line_errs = intarr((l-16)/3)
for i= 16, cl(2) - 1, 3  do begin
  ix = long(cl(i) and 65535) + long(cl(i+1) * 65536L)
  len = long(cl(i+2))
  if (len lt 3) then goto,listdone
  xxx = where(ci(j:j+len) ne ri(ix:ix+len),errs) 
  if (errs ne 0)then begin 
         print," Error on row ",i
         line_errs(i) = errs
         total_errs = total_errs + errs
  end
  j = j+len+1
end
listdone:
return
end
