Skip to content

Instantly share code, notes, and snippets.

@duncanmak
Created June 28, 2010 17:30
Show Gist options
  • Select an option

  • Save duncanmak/456132 to your computer and use it in GitHub Desktop.

Select an option

Save duncanmak/456132 to your computer and use it in GitHub Desktop.
(ns edu.harvard.connectome.convert-tiff-to-png
(:gen-class)
(:import [edu.harvard.connectome Dataset IterationCallback]
[ij IJ]))
(defn only-tiff (proxy [java.io.FilenameFilter] []
(accept [file name] (.endsWith name "tif"))))
(defn replace-extension [file old-ext new-ext]
(.replace (str file) old-ext new-ext))
(defn convert-dataset [dataset section]
(doseq [tiles (-> dataset (.get section))]
(println tiles)))
(def convert-callback
(proxy [IterationCallback.Adapter] []
(invoke [dataset result section level r file]
(convert-dataset dataset section))))
(defn convert-dataset [file]
(let [dataset (Dataset/fromFile file)]
(-> iterate convert-callback)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment