extract_curves 0.0.1-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/bin/ec_rect2polar.rb +22 -0
  2. data/bin/ec_rev_lines.rb +5 -0
  3. data/bin/ec_sph_area.rb +30 -0
  4. data/bin/extract_curves.rb +2145 -0
  5. data/ruby_ext/pav/extconf.rb +22 -0
  6. data/ruby_ext/pav/pav.dll +0 -0
  7. data/ruby_libs/pav/attr_cache.rb +211 -0
  8. data/ruby_libs/pav/attr_cache.t1.rb +32 -0
  9. data/ruby_libs/pav/cache.rb +31 -0
  10. data/ruby_libs/pav/dbg_log.rb +458 -0
  11. data/ruby_libs/pav/floatsio.rb +53 -0
  12. data/ruby_libs/pav/generator_cache.rb +165 -0
  13. data/ruby_libs/pav/gtk/button.rb +130 -0
  14. data/ruby_libs/pav/gtk/icons.rb +87 -0
  15. data/ruby_libs/pav/gtk/toolbar.rb +192 -0
  16. data/ruby_libs/pav/heap.rb +54 -0
  17. data/ruby_libs/pav/icons/alt_handle.xpm +3832 -0
  18. data/ruby_libs/pav/icons/alt_handle_hover.xpm +3368 -0
  19. data/ruby_libs/pav/icons/alt_handle_pressed.xpm +3828 -0
  20. data/ruby_libs/pav/icons/extract_curves/extract_curves-icon-rgb.ppm +14 -0
  21. data/ruby_libs/pav/icons/extract_curves/extract_curves-logo-rgb.gif +0 -0
  22. data/ruby_libs/pav/icons/extract_curves/trace_mark.xpm +38 -0
  23. data/ruby_libs/pav/icons/handle.xpm +213 -0
  24. data/ruby_libs/pav/icons/next.xpm +29 -0
  25. data/ruby_libs/pav/icons/next_hover.xpm +315 -0
  26. data/ruby_libs/pav/icons/next_pressed.xpm +144 -0
  27. data/ruby_libs/pav/icons/prev.xpm +29 -0
  28. data/ruby_libs/pav/icons/prev_hover.xpm +315 -0
  29. data/ruby_libs/pav/icons/prev_pressed.xpm +144 -0
  30. data/ruby_libs/pav/icons/vnext.xpm +29 -0
  31. data/ruby_libs/pav/icons/vprev.xpm +29 -0
  32. data/ruby_libs/pav/numeric/ext.rb +13 -0
  33. data/ruby_libs/pav/pav_find.rb +90 -0
  34. data/ruby_libs/pav/pix/aapix.rb +378 -0
  35. data/ruby_libs/pav/pix/blob.rb +543 -0
  36. data/ruby_libs/pav/pix/circle.rb +73 -0
  37. data/ruby_libs/pav/pix/contour/calc_situations.rb +9 -0
  38. data/ruby_libs/pav/pix/contour/carp_calc.rb +212 -0
  39. data/ruby_libs/pav/pix/contour/situations.dmp +0 -0
  40. data/ruby_libs/pav/pix/contour/situations.rb +21 -0
  41. data/ruby_libs/pav/pix/contour.rb +644 -0
  42. data/ruby_libs/pav/pix/curve.rb +1508 -0
  43. data/ruby_libs/pav/pix/img_obj.rb +751 -0
  44. data/ruby_libs/pav/pix/node.rb +712 -0
  45. data/ruby_libs/pav/pix/node_grp.rb +853 -0
  46. data/ruby_libs/pav/pix/shaved_core.rb +534 -0
  47. data/ruby_libs/pav/pix/subpix.rb +212 -0
  48. data/ruby_libs/pav/pix.rb +402 -0
  49. data/ruby_libs/pav/rand_accessible.rb +16 -0
  50. data/ruby_libs/pav/rangeset.rb +63 -0
  51. data/ruby_libs/pav/search.rb +210 -0
  52. data/ruby_libs/pav/set.rb +20 -0
  53. data/ruby_libs/pav/string/bits.rb +523 -0
  54. data/ruby_libs/pav/string/ext.rb +58 -0
  55. data/ruby_libs/pav/string/observable.rb +155 -0
  56. data/ruby_libs/pav/string/text.rb +79 -0
  57. data/ruby_libs/pav/string/words.rb +42 -0
  58. data/ruby_libs/pav/sub_arr.rb +55 -0
  59. data/ruby_libs/pav/traced_obj.rb +79 -0
  60. metadata +112 -0
@@ -0,0 +1,79 @@
1
+ require 'pav/string/ext'
2
+ require 'pav/string/observable'
3
+
4
+ class StringLns
5
+ attr_reader :ln_start_idxs, :str
6
+
7
+ include Enumerable
8
+
9
+ def initialize(str)
10
+ @str = str
11
+ @ln_start_idxs = []
12
+ i = 0
13
+ str.each_line { |ln|
14
+ @ln_start_idxs << i
15
+ i += ln.length
16
+ }
17
+ @ln_start_idxs << i
18
+ end
19
+
20
+ def [](*args)
21
+ if args.length == 1
22
+ is = args
23
+ elsif args.length == 2
24
+ is = args[0]..args[0]+args[1]-1
25
+ else
26
+ raise ArgumentError, "Unknown number of arguments"
27
+ end
28
+ res = is.collect{ |i|
29
+ if i < 0
30
+ if i <= -@ln_start_idxs.length
31
+ nil
32
+ else
33
+ @str[@ln_start_idxs[i-1]...
34
+ @ln_start_idxs[i]]
35
+ end
36
+ else
37
+ if i+1 >= @ln_start_idxs.length
38
+ nil
39
+ else
40
+ @str[@ln_start_idxs[i]...
41
+ @ln_start_idxs[i+1]]
42
+ end
43
+ end
44
+ }
45
+ if args.length == 1 && args[0].kind_of?(Numeric) then res[0]
46
+ else res end
47
+ end
48
+
49
+ def each
50
+ [0..@ln_start_idxs-1].each { |i|
51
+ yield @str[@ln_start_idxs[i]..@ln_start_idxs[i+1]]
52
+ }
53
+ end
54
+
55
+ def length
56
+ @ln_start_idxs.length - 1
57
+ end
58
+ end
59
+
60
+ class StringLnsObserver
61
+ def self.update(str, meth, args, block)
62
+ str.kill_lns
63
+ end
64
+ end
65
+
66
+ class String
67
+ def lns
68
+ self.add_observer(StringLnsObserver)
69
+ def lns
70
+ @lns = StringLns.new(self) unless @lns
71
+ @lns
72
+ end
73
+ self.lns
74
+ end
75
+
76
+ def kill_lns
77
+ @lns = nil
78
+ end
79
+ end
@@ -0,0 +1,42 @@
1
+ require 'pav/string/ext'
2
+
3
+ class String
4
+ PLURAL_ES = %w[tomatoes potatoes branches ses zes xes]
5
+ PLURAL_EN = %w[oxen]
6
+ PLURAL_VES_F = %w[dwarves shelves elves]
7
+ PLURAL_VES_FE = %w[lives knives]
8
+ PLURAL_ICES_EX = %w[indices vertices vortices]
9
+
10
+ PLURAL_TRANSFORMS = self.constants.find_all { |c|
11
+ c.starts_with("PLURAL_") }.collect { |c|
12
+ to, from = *c["PLURAL_".length...c.length].split("_")
13
+ to.downcase!
14
+ if from then from.downcase! else from = ""; end
15
+ [to, from, self.const_get(c)]
16
+ }
17
+ SINGULAR_TRANSFORMS = PLURAL_TRANSFORMS.collect { |pl_t|
18
+ [pl_t[1], pl_t[0], pl_t[2].collect{|w| w[0,w.length-pl_t[0].length].
19
+ concat(pl_t[1])}]
20
+ }
21
+
22
+ def singular
23
+ dn_case = self.downcase
24
+ PLURAL_TRANSFORMS.each { |t| t[2].each { |word|
25
+ return self[0, self.length-t[0].length].concat(t[1]) if
26
+ dn_case.ends_with(word)
27
+ }}
28
+ if dn_case.ends_with("s")
29
+ return self[0, self.length-1]
30
+ end
31
+ self.dup
32
+ end
33
+
34
+ def plural
35
+ dn_case = self.downcase
36
+ SINGULAR_TRANSFORMS.each { |t| t[2].each { |word|
37
+ return self[0, self.length-t[0].length].concat(t[1]) if
38
+ dn_case.ends_with(word)
39
+ }}
40
+ self + "s"
41
+ end
42
+ end
@@ -0,0 +1,55 @@
1
+ require 'pav/dbg_log'
2
+ require 'pav/rand_accessible'
3
+
4
+ class SubArr
5
+ include RandomlyReadable
6
+ include Enumerable
7
+
8
+ attr_reader :arr
9
+ attr_accessor :start_i, :end_i
10
+
11
+ def initialize(arr, start_i=0, end_i=nil)
12
+ @arr = arr
13
+ @start_i = start_i
14
+ @end_i = end_i ? end_i : @arr.length
15
+ end
16
+
17
+ def at(i)
18
+ i = self.length + i if i < 0
19
+ i += @start_i
20
+ return nil if i < @start_i || i >= @end_i
21
+ @arr.at(i % @arr.length)
22
+ end
23
+
24
+ def length
25
+ end_i - start_i
26
+ end
27
+
28
+ def empty?
29
+ self.length < 1
30
+ end
31
+
32
+ def first
33
+ self.at(0)
34
+ end
35
+
36
+ def each
37
+ return if @arr.empty?
38
+ for i in @start_i...@end_i
39
+ yield(@arr.at(i % @arr.length))
40
+ end
41
+ end
42
+
43
+ def to_a
44
+ res = Array.new(self.length)
45
+ self.each_with_index { |lm, i| res[i] = lm }
46
+ res
47
+ end
48
+
49
+ def to_s(expand_arr=false)
50
+ "<#{self.class.name}:#{"%x" % self.object_id} @start_i=#{
51
+ @start_i}, @end_i=#{end_i} @arr: #{expand_arr&&expand_arr!=0 ?
52
+ @arr.inspect : @arr.length.to_s + " element" +
53
+ (@arr.length==1 ? "" : "s")}>"
54
+ end
55
+ end
@@ -0,0 +1,79 @@
1
+ require 'pav/dbg_log'
2
+
3
+ class TracedObj
4
+ attr_reader :__to_filters__, :__to_obj__
5
+ attr_accessor :__to_processor__
6
+
7
+ def initialize(obj, excl_meths=[])
8
+ @__to_obj__ = obj
9
+ if excl_meths && !excl_meths.empty?
10
+ @__to_filters__ = [ proc { |obj, id, args, block|
11
+ !excl_meths.include?(id) } ]
12
+ else
13
+ @__to_filters__ = []
14
+ end
15
+ @__to_processor__ = proc { |obj, id, args, block|
16
+ $PDbgLog.sig_call(self)
17
+ $PDbgLog.puts_msg "#{obj.class.name}#{(
18
+ obj.kind_of?(Class) || obj.kind_of?(Module)) ? "#" :
19
+ "."}#{id}(#{args.collect {|a| a.inspect}.join(", ")
20
+ }) #{caller(2).join("\n")}"
21
+ res = obj.send(id, *args, &block)
22
+ $PDbgLog.sig_return(res.inspect)
23
+ res
24
+ }
25
+ end
26
+
27
+ def method_missing(id, *args, &block)
28
+ for filt in @__to_filters__
29
+ return @__to_obj__.send(id, *args, &block) unless
30
+ filt.call(@__to_obj__, id, args, block)
31
+ end
32
+ @__to_processor__.call(@__to_obj__, id, args, block)
33
+ end
34
+
35
+ def __to_add_filter__(block=Proc.new)
36
+ if block
37
+ @__to_filters__.push(block)
38
+ @__to_filters__.length-1
39
+ else
40
+ nil
41
+ end
42
+ end
43
+
44
+ def to_s(*args, &block)
45
+ id = "to_s"
46
+ for filt in @__to_filters__
47
+ return @__to_obj__.send(id, *args, &block) unless
48
+ filt.call(@__to_obj__, id, args, block)
49
+ end
50
+ @__to_processor__.call(@__to_obj__, id, args, block)
51
+ end
52
+
53
+ def to_a(*args, &block)
54
+ id = "to_a"
55
+ for filt in @__to_filters__
56
+ return @__to_obj__.send(id, *args, &block) unless
57
+ filt.call(@__to_obj__, id, args, block)
58
+ end
59
+ @__to_processor__.call(@__to_obj__, id, args, block)
60
+ end
61
+
62
+ def inspect(*args, &block)
63
+ id = "inspect"
64
+ for filt in @__to_filters__
65
+ return @__to_obj__.send(id, *args, &block) unless
66
+ filt.call(@__to_obj__, id, args, block)
67
+ end
68
+ @__to_processor__.call(@__to_obj__, id, args, block)
69
+ end
70
+
71
+ def hash(*args, &block)
72
+ id = "hash"
73
+ for filt in @__to_filters__
74
+ return @__to_obj__.send(id, *args, &block) unless
75
+ filt.call(@__to_obj__, id, args, block)
76
+ end
77
+ @__to_processor__.call(@__to_obj__, id, args, block)
78
+ end
79
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.10
3
+ specification_version: 1
4
+ name: extract_curves
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2005-11-15
8
+ summary: GUI digitizer of a raster trace of the geometric curve corresponding to the characteristics of motion of a process.
9
+ require_paths:
10
+ - ruby_libs
11
+ - ruby_ext
12
+ email: pavpen@berkeley.edu
13
+ homepage:
14
+ rubyforge_project:
15
+ description: "Extract Curves a simplistic GTK Ruby-based appliaction which can convert the
16
+ raster image file result of a geometric-trace-producing process's interaction
17
+ with the characteristic of motion of another (interesting) process into a list
18
+ of rectangular coordinates (in raster image's system) representing the inferred
19
+ characteristic of motion of an image blob. Blob recognition is done by color: *
20
+ by maximum pixel neighbor-to-neighbor difference * by maximum difference from
21
+ blob's average color * by maximum difference from a pixel neighborhood's average
22
+ color (using RGB or HSV). Use other software to pre-process (e.g. enhance
23
+ contrast, or even reduce to gray scale), but Extract Curves's skeletonization is
24
+ done based on the hypothesis of a recognized image blob, as opposed to a
25
+ collection of pixels. Output is human-readable (tab-separated)."
26
+ autorequire:
27
+ default_executable: extract_curves
28
+ bindir: bin
29
+ has_rdoc: false
30
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
31
+ requirements:
32
+ -
33
+ - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.8.2
36
+ version:
37
+ platform: mswin32
38
+ authors:
39
+ - Pavel Minev Penev
40
+ files:
41
+ - bin/extract_curves.rb
42
+ - bin/ec_sph_area.rb
43
+ - bin/ec_rev_lines.rb
44
+ - bin/ec_rect2polar.rb
45
+ - ruby_ext/pav/pav.dll
46
+ - ruby_ext/pav/extconf.rb
47
+ - ruby_libs/pav/string/observable.rb
48
+ - ruby_libs/pav/string/text.rb
49
+ - ruby_libs/pav/string/ext.rb
50
+ - ruby_libs/pav/string/bits.rb
51
+ - ruby_libs/pav/string/words.rb
52
+ - ruby_libs/pav/numeric/ext.rb
53
+ - ruby_libs/pav/icons/vprev.xpm
54
+ - ruby_libs/pav/icons/vnext.xpm
55
+ - ruby_libs/pav/icons/prev_pressed.xpm
56
+ - ruby_libs/pav/icons/prev_hover.xpm
57
+ - ruby_libs/pav/icons/prev.xpm
58
+ - ruby_libs/pav/icons/next_pressed.xpm
59
+ - ruby_libs/pav/icons/next_hover.xpm
60
+ - ruby_libs/pav/icons/next.xpm
61
+ - ruby_libs/pav/icons/handle.xpm
62
+ - ruby_libs/pav/icons/alt_handle_pressed.xpm
63
+ - ruby_libs/pav/icons/alt_handle_hover.xpm
64
+ - ruby_libs/pav/icons/alt_handle.xpm
65
+ - ruby_libs/pav/icons/extract_curves/trace_mark.xpm
66
+ - ruby_libs/pav/icons/extract_curves/extract_curves-logo-rgb.gif
67
+ - ruby_libs/pav/icons/extract_curves/extract_curves-icon-rgb.ppm
68
+ - ruby_libs/pav/traced_obj.rb
69
+ - ruby_libs/pav/sub_arr.rb
70
+ - ruby_libs/pav/set.rb
71
+ - ruby_libs/pav/search.rb
72
+ - ruby_libs/pav/rangeset.rb
73
+ - ruby_libs/pav/rand_accessible.rb
74
+ - ruby_libs/pav/pix.rb
75
+ - ruby_libs/pav/pav_find.rb
76
+ - ruby_libs/pav/heap.rb
77
+ - ruby_libs/pav/generator_cache.rb
78
+ - ruby_libs/pav/floatsio.rb
79
+ - ruby_libs/pav/dbg_log.rb
80
+ - ruby_libs/pav/cache.rb
81
+ - ruby_libs/pav/attr_cache.t1.rb
82
+ - ruby_libs/pav/attr_cache.rb
83
+ - ruby_libs/pav/pix/subpix.rb
84
+ - ruby_libs/pav/pix/shaved_core.rb
85
+ - ruby_libs/pav/pix/node_grp.rb
86
+ - ruby_libs/pav/pix/node.rb
87
+ - ruby_libs/pav/pix/img_obj.rb
88
+ - ruby_libs/pav/pix/curve.rb
89
+ - ruby_libs/pav/pix/contour.rb
90
+ - ruby_libs/pav/pix/circle.rb
91
+ - ruby_libs/pav/pix/blob.rb
92
+ - ruby_libs/pav/pix/aapix.rb
93
+ - ruby_libs/pav/pix/contour/situations.rb
94
+ - ruby_libs/pav/pix/contour/situations.dmp
95
+ - ruby_libs/pav/pix/contour/carp_calc.rb
96
+ - ruby_libs/pav/pix/contour/calc_situations.rb
97
+ - ruby_libs/pav/gtk/toolbar.rb
98
+ - ruby_libs/pav/gtk/icons.rb
99
+ - ruby_libs/pav/gtk/button.rb
100
+ test_files: []
101
+ rdoc_options: []
102
+ extra_rdoc_files: []
103
+ executables:
104
+ - ec_rect2polar.rb
105
+ - ec_rev_lines.rb
106
+ - ec_sph_area.rb
107
+ - extract_curves.rb
108
+ extensions: []
109
+ requirements:
110
+ - libgtk2-ruby >= 2.6.0
111
+ - libgtk2.0-0 >= 2.6.0
112
+ dependencies: []