       rt (.getResultsTable tp)
       ;tmp (println (clojure.string/join "\t" (.getHeadings rt)))
       line (.getLine tp 0)
-      [image-name num-intersections] (clojure.string/split line #"\t") 
+      [image-name num-intersections] (clojure.string/split line #"\t")
       ;image-name (.getValue rt "Image name" 0)
       ;num-intersections (.getValue rt "Num of intersections" 0)
       ]

;(println "saving as" (str (string/replace (string/replace orig-name ".tif" "") " " "_") "_labeled_branches.tif"))
;(ij.IJ/saveAsTiff imp (str directory "/" (string/replace orig-name ".tif" "") "_labeled_branches.tif"))

;(ij.IJ/run "Close All")
(def directory (ij.IJ/getDirectory "image"))

; Requires the plugin from:
; morphology update site
; and
; http://jvsmicroscope.uta.fi/?q=skeleton_intersections


(if (= (.getType imp) ij.ImagePlus/COLOR_RGB)
  (do (ij.IJ/run imp "8-bit" "")
    (def mask imp))
  (do (def channels (ij.plugin.ChannelSplitter/split imp))

    (def mask (second channels))
    (.setTitle mask (str "C2-" orig-name ))))

(ij.IJ/run mask "Subtract Background..." "rolling=25")

(dotimes [step smoothing-steps]
  (ij.IJ/run mask "Smooth" ""))
