changeset 107:53fb379ac678

saving progress
author Robert McIntyre <rlm@mit.edu>
date Sun, 15 Jan 2012 00:40:49 -0700
parents 40e72c6943d8
children 92b857b6145d
files org/test-creature.org
diffstat 1 files changed, 35 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/test-creature.org	Sun Jan 15 00:33:06 2012 -0700
     1.2 +++ b/org/test-creature.org	Sun Jan 15 00:40:49 2012 -0700
     1.3 @@ -463,32 +463,6 @@
     1.4  (import ij.process.ImageProcessor)
     1.5  (import java.awt.image.BufferedImage)
     1.6  
     1.7 -(defprotocol Frame
     1.8 -  (frame [this]))
     1.9 -
    1.10 -(extend-type BufferedImage
    1.11 -  Frame
    1.12 -  (frame [image]
    1.13 -    (merge  
    1.14 -     (apply
    1.15 -      hash-map 
    1.16 -      (interleave 
    1.17 -       (doall (for [x (range (.getWidth image)) y (range (.getHeight image))]
    1.18 -                (vector x y)))
    1.19 -       (doall (for [x (range (.getWidth image)) y (range (.getHeight image))]
    1.20 -                (let [data (.getRGB image x y)] 
    1.21 -                  (hash-map :r (bit-shift-right (bit-and 0xff0000 data) 16)
    1.22 -                            :g (bit-shift-right (bit-and 0x00ff00 data) 8)
    1.23 -                            :b (bit-and 0x0000ff data)))))))
    1.24 -     {:width  (.getWidth image) :height (.getHeight image)})))
    1.25 -
    1.26 -
    1.27 -(extend-type ImagePlus
    1.28 -  Frame
    1.29 -  (frame [image+]
    1.30 -    (frame (.getBufferedImage image+))))
    1.31 -
    1.32 -
    1.33  (def white -1)
    1.34    
    1.35  (defn filter-pixels
    1.36 @@ -627,8 +601,15 @@
    1.37    
    1.38  
    1.39  (defn sensors-in-triangle
    1.40 -  "find the locations of the sensors within a triangle"
    1.41 -  [image tri]
    1.42 +  "Find the locations of the touch sensors within a triangle in both
    1.43 +   UV and gemoetry relative coordinates."
    1.44 +  [image mesh tri-index]
    1.45 +  (let [width (.getWidth image)
    1.46 +        height (.getHeight image)]
    1.47 +
    1.48 +
    1.49 +
    1.50 +
    1.51    )
    1.52  
    1.53  
    1.54 @@ -1090,6 +1071,32 @@
    1.55  
    1.56  
    1.57  
    1.58 +(defprotocol Frame
    1.59 +  (frame [this]))
    1.60 +
    1.61 +(extend-type BufferedImage
    1.62 +  Frame
    1.63 +  (frame [image]
    1.64 +    (merge  
    1.65 +     (apply
    1.66 +      hash-map 
    1.67 +      (interleave 
    1.68 +       (doall (for [x (range (.getWidth image)) y (range (.getHeight image))]
    1.69 +                (vector x y)))
    1.70 +       (doall (for [x (range (.getWidth image)) y (range (.getHeight image))]
    1.71 +                (let [data (.getRGB image x y)] 
    1.72 +                  (hash-map :r (bit-shift-right (bit-and 0xff0000 data) 16)
    1.73 +                            :g (bit-shift-right (bit-and 0x00ff00 data) 8)
    1.74 +                            :b (bit-and 0x0000ff data)))))))
    1.75 +     {:width  (.getWidth image) :height (.getHeight image)})))
    1.76 +
    1.77 +
    1.78 +(extend-type ImagePlus
    1.79 +  Frame
    1.80 +  (frame [image+]
    1.81 +    (frame (.getBufferedImage image+))))
    1.82 +
    1.83 +
    1.84  #+end_src
    1.85  
    1.86