     :use-autofocus true :autofocus-skip 3 :relative-slices true :exposure 100
     :interval-ms 100))
 
-(def result (generate-acq-sequence null-settings))
+;(def result (generate-acq-sequence null-settings))
 
 ;(count result)
(defstruct acq-settings :frames :positions :channels :slices :slices-first
  :time-first :keep-shutter-open-slices :keep-shutter-open-channels
  :use-autofocus :autofocus-skip :relative-slices :exposure)

(declare settings)

(defn pairs [x]
  (partition 2 1 (concat x [nil])))

(defn create-loops [dimensions]
  (reduce #(apply (partial nest-loop %1) %2) [{:task :snap}] dimensions))

(defn make-main-loops [settings]
  (create-loops (make-dimensions settings)))

(defn process-skip-z-stack [events slices]
  (let [middle-slice (nth slices (int (/ (count slices) 2)))]
    (filter
      #(or
         (nil? (% :channel))
         (-> % :channel :use-z-stack)
         (= middle-slice (% :slice)))
      events)))

(defn manage-shutter [events keep-shutter-open-channels keep-shutter-open-slices]
  (for [[e1 e2] (pairs events)]
    (assoc e1 :close-shutter
      (if e2 (or
               (and
                 (not keep-shutter-open-channels)
                 (not= (e1 :channel) (e2 :channel)))
               (and
                 (not keep-shutter-open-slices)
                 (not= (e1 :slice) (e2 :slice)))
               (not= (e1 :frame) (e2 :frame))
               (not= (e1 :position) (e2 :position)))
        true))))

(defn process-channel-skip-frames [events]
  (filter
