# HG changeset patch # User Robert McIntyre # Date 1326613249 25200 # Node ID 53fb379ac67824b306bffbaa54a8782df1172726 # Parent 40e72c6943d8e8191cdb30792e62bd601f8fe9cc saving progress diff -r 40e72c6943d8 -r 53fb379ac678 org/test-creature.org --- a/org/test-creature.org Sun Jan 15 00:33:06 2012 -0700 +++ b/org/test-creature.org Sun Jan 15 00:40:49 2012 -0700 @@ -463,32 +463,6 @@ (import ij.process.ImageProcessor) (import java.awt.image.BufferedImage) -(defprotocol Frame - (frame [this])) - -(extend-type BufferedImage - Frame - (frame [image] - (merge - (apply - hash-map - (interleave - (doall (for [x (range (.getWidth image)) y (range (.getHeight image))] - (vector x y))) - (doall (for [x (range (.getWidth image)) y (range (.getHeight image))] - (let [data (.getRGB image x y)] - (hash-map :r (bit-shift-right (bit-and 0xff0000 data) 16) - :g (bit-shift-right (bit-and 0x00ff00 data) 8) - :b (bit-and 0x0000ff data))))))) - {:width (.getWidth image) :height (.getHeight image)}))) - - -(extend-type ImagePlus - Frame - (frame [image+] - (frame (.getBufferedImage image+)))) - - (def white -1) (defn filter-pixels @@ -627,8 +601,15 @@ (defn sensors-in-triangle - "find the locations of the sensors within a triangle" - [image tri] + "Find the locations of the touch sensors within a triangle in both + UV and gemoetry relative coordinates." + [image mesh tri-index] + (let [width (.getWidth image) + height (.getHeight image)] + + + + ) @@ -1090,6 +1071,32 @@ +(defprotocol Frame + (frame [this])) + +(extend-type BufferedImage + Frame + (frame [image] + (merge + (apply + hash-map + (interleave + (doall (for [x (range (.getWidth image)) y (range (.getHeight image))] + (vector x y))) + (doall (for [x (range (.getWidth image)) y (range (.getHeight image))] + (let [data (.getRGB image x y)] + (hash-map :r (bit-shift-right (bit-and 0xff0000 data) 16) + :g (bit-shift-right (bit-and 0x00ff00 data) 8) + :b (bit-and 0x0000ff data))))))) + {:width (.getWidth image) :height (.getHeight image)}))) + + +(extend-type ImagePlus + Frame + (frame [image+] + (frame (.getBufferedImage image+)))) + + #+end_src