                        (not (core isBufferOverflowed)))
              (Thread/sleep 1))
            (if (pos? (core getRemainingImageCount))
-             (when-let [img (core popNextTaggedImage)]
-               (.getDirectBuffer img))
+             (core popNextTaggedImage)
              (when (core isBufferOverflowed)
                (throw (Exception. "Circular buffer overflowed."))))))
 

           (java.nio.channels FileChannel$MapMode))
  (:require [org.micromanager.mm :as mm])
  (:use [org.micromanager.mm :only (core)]))

(defn queuify
  "Runs zero-arg function n times on another thread. Returns

  (.. ByteBuffer (allocateDirect size-bytes)
      (order (ByteOrder/nativeOrder))))

(defn pixels-to-byte-buffer
  "Store 16-bit image pixel array data in a
   pre-existing byte buffer instance."
  ([pix buffer]
