         tags (parse-core-metadata md)]
     {:pix pix :tags (dissoc tags "StartTime-ms")}))
     
-(defn make-multicamera-events [event]
-  (let [num-camera-channels (long (core getNumberOfCameraChannels))]
-    (for [camera-channel (range num-camera-channels)]
-      (let [super-channel-index (+ camera-channel (* num-camera-channels (event :channel-index)))]
-        (assoc event :channel-index super-channel-index
-                     :camera-channel-index camera-channel)))))
-
 (defn collect-burst-images [event out-queue]
   (when (first-trigger-missing?) (pop-burst-image)) ; drop first image if first trigger doesn't happen
   (swap! state assoc :burst-time-offset nil)

(def live-mode-running (ref false))

(defn enable-live-mode [^Boolean on]
  (if on
    (let [event (create-basic-event)
          state (create-basic-state)
          start-time (jvm-time-ms)]
      (dosync (ref-set live-mode-running true))
      (core startContinuousSequenceAcquisition 0)
      (log "started sequence acquisition")
      (.start (Thread.
                #(dorun (loop [last-time 0
                               first-image true]
                          (when @live-mode-running
                            (let [raw-image {:pix (core getLastImage) :tags nil}
                                  elapsed-time-ms (- (jvm-time-ms) start-time)
                                  img (annotate-image raw-image event state elapsed-time-ms)
                                  this-time (System/currentTimeMillis)
                                  dt (- 33 (- this-time last-time))]                      
                              (if first-image (reset-snap-window img)  )             
                              (Thread/sleep (max 0 dt))                                     
                              (if (.windowClosed @snap-window) 
                                (edt (.enableLiveMode gui false))  
                                (show-image @snap-window img first-image)  )
                              (recur this-time false))))
                        (core stopSequenceAcquisition))
                "Live mode (clojure)")))
    (dosync (ref-set live-mode-running false))))

;; java interop


                (swap! state assoc
                       :burst-time-offset (- (elapsed-time @state)
                                             (core-time-from-tags (image :tags)))))
             ; (println (image+ :tags))
              (.put out-queue (make-TaggedImage (annotate-image image+ evt @state
                                                                (burst-time (:tags image) @state)))))
            (when (core isBufferOverflowed)
              (swap! state assoc :stop true)
              (ReportingUtils/showError "Circular buffer overflowed."))))
        (flatten (map make-multicamera-events) (event :burst-data)))))
  (while (and (not (@state :stop)) (. mmc isSequenceRunning))
    (Thread/sleep 5)))

(defn collect-snap-image [event out-queue]
  (let [image
         {:pix (core getImage)
          :tags nil}]
    (do (log "collect-snap-image: "
               (select-keys event [:position-index :frame-index
                                   :slice-index :channel-index]))
      (when out-queue
          (.put out-queue
                (make-TaggedImage (annotate-image image event @state (elapsed-time @state))))))
    image))

(defn return-config []
