;; This file was used to do some simple testing by extracting max values
;; of a stream and/or image

; Helper procedure for determining the maximum value of a stream
; (useful for debugging)
(define (max-stream-value stream)
  (if (null? stream) 
      -9999999 
      (max (stream-car stream) (max-stream-value (stream-cdr stream)))))

; Helper procedure for determining the maximum grayscale value of an image
; (useful for debugging)
(define (max-image-value img)
  (if (null? img) 
      -9999999
      (max (max-stream-value (stream-car img))
           (max-image-value (stream-cdr img)))))
  
(define img (pgm-file->image "hitchhiker-orig.pgm"))
(max-image-value img)
(max-image-value (img-horiz-smooth img))
(max-image-value (image-map (lambda (x) (min 1. x)) (img-horiz-smooth img)))