           (slide-explorer.disk/write-tile dir {:i i} (first images0)))
         (when-let [more (next images0)]
           (recur more (inc i)))))))
-  )+)
(ns slide-explorer.flatfield
  (:require [slide-explorer.tile-cache :as tile-cache]
            [slide-explorer.image :as image]))


(defn map-vals [f m]

      (image/gaussian-blur 50)
      image/normalize-to-max))

(defn flat-field-by-channel [cache]
  (->> @cache
       (unzoomed-indices-by-channel)
       (map-vals (partial images-in-cache cache))
       (map-vals flat-field)))

       
; TODO: (defn re-flatten [in-cache])
  

;; testing

(defn test-generate []
  (->> slide-explorer.view/mt
       flat-field-by-channel
       (map-vals image/show)))

                      
                      

