 (defn simple-data-processor
   "Make a DataProcessor whose process method is implemented by
    process-function, which should accept a single image and return
-   one image or several images in a sequence."
+   one image or several images in a sequence. Passes
+   through Poison image unchanged."
   [process-function]
   (proxy [DataProcessor] []
     (process []
-             (let [result (process-function (.poll this))]
-               (if (counted? result)
-                 (doseq [image (process-function (.poll this))]
-                   (.produce this image))
-                 (.produce this result))))))
+             (let [img (.poll this)]
+               (if (.tags img)
+                 (let [result (process-function img)]
+                   (if (counted? result)
+                     (doseq [image (process-function (.poll this))]
+                       (.produce this image))
+                     (.produce this result)))
+                 (.produce this img))))))
                    
 
 ;A list of image processors that have been attached to

  "Remove all DataProcessors from the acquisition engine's list of image processors."
  []
  (doseq [proc @image-processors]
    (remove-image-processor proc)))

(def identity-proc
  "A simple data processor that passes images through, but prints out tagged image."
  (simple-data-processor #(do (println %) %)))

(ns org.micromanager.test
  (:import (java.util List)
           (mmcorej TaggedImage)
           (org.json JSONObject)
           (org.micromanager MMStudioMainFrame)
           (org.micromanager.api DataProcessor))
  (:use [org.micromanager.mm :only (load-mm gui mmc)]))
