            [org.json JSONObject JSONArray]
            [java.util Date UUID]
            [java.text SimpleDateFormat]
-           [ij ImagePlus]
-           )
+           [ij ImagePlus])
    (:gen-class
      :name org.micromanager.AcqEngine
      :implements [org.micromanager.api.Pipeline]

  (if (pos? (count stage)) (core getPosition stage) 0))
  
(defn set-z-stage-position [stage pos]
  (if (pos? (count stage)) (core setPosition stage pos)))

(defn set-stage-position
  ([stage-dev z] (log "setting z position to " z)
     (core setPosition stage-dev z)
     (state-assoc! :last-z-position z))
  ([stage-dev x y] (log "setting x,y position to " x "," y)
                   (when (and x y) (core setXYPosition stage-dev x y))))

      (set (@state :init-system-state))
      (set (get-system-config-cached))))))

(defn cleanup []
  (log "cleanup")
  (do-when #(.update %) (:display @state))
