imagetooth 0.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +18 -0
- data/README.markdown +60 -0
- data/bin/imagetooth +16 -30
- data/images/rwwng.png +0 -0
- data/images/rwwwg.png +0 -0
- data/images/rwwww.png +0 -0
- data/images/wwwww.png +0 -0
- data/imagetooth.gemspec +4 -6
- data/lib/arg_parser.rb +29 -0
- data/spec/array_spec.rb +3 -3
- data/spec/image_tooth_spec.rb +10 -8
- data/wrrgw.png +0 -0
- data.tar.gz.sig +0 -0
- metadata +72 -90
- metadata.gz.sig +0 -0
- data/README +0 -1
- data/README~ +0 -0
- data/doc/classes/ImageTooth.html +0 -390
- data/doc/classes/ImageTooth.src/M000001.html +0 -20
- data/doc/classes/ImageTooth.src/M000002.html +0 -18
- data/doc/classes/ImageTooth.src/M000003.html +0 -18
- data/doc/classes/ImageTooth.src/M000004.html +0 -29
- data/doc/classes/ImageTooth.src/M000005.html +0 -51
- data/doc/classes/ImageTooth.src/M000006.html +0 -32
- data/doc/classes/ImageTooth.src/M000007.html +0 -25
- data/doc/classes/ImageTooth.src/M000008.html +0 -31
- data/doc/classes/ImageTooth.src/M000009.html +0 -36
- data/doc/classes/ImageTooth.src/M000010.html +0 -18
- data/doc/classes/ImageTooth.src/M000011.html +0 -18
- data/doc/classes/ImageTooth.src/M000012.html +0 -24
- data/doc/created.rid +0 -1
- data/doc/files/lib/image_tooth_rb.html +0 -135
- data/doc/fr_class_index.html +0 -27
- data/doc/fr_file_index.html +0 -27
- data/doc/fr_method_index.html +0 -38
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
rspec (2.6.0)
|
6
|
+
rspec-core (~> 2.6.0)
|
7
|
+
rspec-expectations (~> 2.6.0)
|
8
|
+
rspec-mocks (~> 2.6.0)
|
9
|
+
rspec-core (2.6.4)
|
10
|
+
rspec-expectations (2.6.0)
|
11
|
+
diff-lcs (~> 1.1.2)
|
12
|
+
rspec-mocks (2.6.0)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
rspec
|
data/README.markdown
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
ImageTooth 2.0.0
|
3
|
+
================
|
4
|
+
|
5
|
+
ImageTooth is a library that provides programmers and users a simple way to generate images for odontograms. IT allows to choose between png or jpg images.
|
6
|
+
|
7
|
+
What Does ImageTooth Do?
|
8
|
+
------------------------
|
9
|
+
|
10
|
+
### Tooth image generation.
|
11
|
+
|
12
|
+
Together with the library there is a simple script that allows you to create the teeth images directly.
|
13
|
+
A simple interface for painting teeth faces.
|
14
|
+
All permutations generating.
|
15
|
+
|
16
|
+
Example:
|
17
|
+
-------
|
18
|
+
|
19
|
+
First, you need to install the gem:
|
20
|
+
|
21
|
+
gem install imagetooth
|
22
|
+
|
23
|
+
Then, you can run the imagetooth command, like this:
|
24
|
+
|
25
|
+
imagetooth --image wwwww.png --folder ./
|
26
|
+
|
27
|
+
This code generates an image where the filename's characters means:
|
28
|
+
|
29
|
+
* w - White
|
30
|
+
* g - Green
|
31
|
+
* b - Blue
|
32
|
+
* n - Black
|
33
|
+
* r - Red
|
34
|
+
|
35
|
+
and are ordered, begining on the upper face of the the tooth and moving clockwise ending on the center face.
|
36
|
+
[top][right][bottom][left][center].png
|
37
|
+
![wwwww.png](https://github.com/gramos/imagetooth/blob/master/images/wwwww.png?raw=true)
|
38
|
+
|
39
|
+
More examples
|
40
|
+
-------------
|
41
|
+
|
42
|
+
Generate a tooth with its top face painted with red:![wwwww.png](https://github.com/gramos/imagetooth/blob/master/images/rwwww.png?raw=true)
|
43
|
+
|
44
|
+
imagetooth --image rwwww.png --folder ./
|
45
|
+
|
46
|
+
Generate a tooth with its top face painted red and center one green:![wwwww.png](https://github.com/gramos/imagetooth/blob/master/images/rwwwg.png?raw=true)
|
47
|
+
|
48
|
+
imagetooth --image rwwwg.png --folder ./
|
49
|
+
|
50
|
+
Generate a tooth with top face painted red, left one black and center one green:![wwwww.png](https://github.com/gramos/imagetooth/blob/master/images/rwwng.png?raw=true)
|
51
|
+
|
52
|
+
imagetooth --image rwwng.png --folder ./
|
53
|
+
|
54
|
+
All permutations with 5 faces and 5 colors (3125)
|
55
|
+
|
56
|
+
imagetooth --all --folder images/
|
57
|
+
|
58
|
+
this code generates 3125 images that are separated within five folders images/w/ images/g/ images/b/ images/r/ images/n/
|
59
|
+
|
60
|
+
|
data/bin/imagetooth
CHANGED
@@ -14,44 +14,30 @@
|
|
14
14
|
#
|
15
15
|
#########################################################################
|
16
16
|
|
17
|
-
|
17
|
+
lib_path = File.expand_path(File.dirname(__FILE__))
|
18
|
+
lib_path = File.join lib_path, "../lib"
|
18
19
|
|
19
|
-
|
20
|
-
require 'commandline/optionparser'
|
21
|
-
include CommandLine
|
22
|
-
require 'image_tooth'
|
23
|
-
|
24
|
-
opt = OptionParser.new { |o|
|
25
|
-
|
26
|
-
o << Option.new(:flag, :names => %w[--help -h],
|
27
|
-
:opt_description => "Prints this page.")
|
20
|
+
$LOAD_PATH << lib_path
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
:arg_description => "folder_output",
|
35
|
-
:opt_found => OptionParser::GET_ARGS)
|
36
|
-
|
37
|
-
o << Option.new(:names => %w(--image -i),
|
38
|
-
:opt_description => "Generate image tooth based on file name.",
|
39
|
-
:arg_description => "image_name",
|
40
|
-
:opt_found => OptionParser::GET_ARGS)
|
41
|
-
}
|
22
|
+
require 'optparse'
|
23
|
+
require 'image_tooth'
|
24
|
+
require 'arg_parser'
|
25
|
+
require 'ostruct'
|
26
|
+
require 'pp'
|
42
27
|
|
43
|
-
od = opt.parse(ARGV)
|
44
28
|
|
45
|
-
|
29
|
+
opt = ArgParser.parse(ARGV)
|
46
30
|
|
47
|
-
if (
|
31
|
+
if (opt.all and opt.folder)
|
48
32
|
@img_tooth = ImageTooth.new
|
49
|
-
@img_tooth.root_path =
|
33
|
+
@img_tooth.root_path = opt.folder
|
50
34
|
@img_tooth.create_folders
|
51
35
|
@img_tooth.gen_all
|
52
|
-
elsif (
|
36
|
+
elsif (opt.image and opt.folder)
|
53
37
|
@img_tooth = ImageTooth.new
|
54
|
-
@img_tooth.root_path =
|
55
|
-
@img_tooth.paint_img
|
38
|
+
@img_tooth.root_path = opt.folder
|
39
|
+
@img_tooth.paint_img opt.image
|
40
|
+
else
|
41
|
+
ArgParser.parse(["-h"])
|
56
42
|
end
|
57
43
|
|
data/images/rwwng.png
ADDED
Binary file
|
data/images/rwwwg.png
ADDED
Binary file
|
data/images/rwwww.png
ADDED
Binary file
|
data/images/wwwww.png
ADDED
Binary file
|
data/imagetooth.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'date'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{imagetooth}
|
5
|
-
s.version = "
|
5
|
+
s.version = "2.0.0"
|
6
6
|
s.date = Date.today.to_s
|
7
7
|
s.summary = %q{This library allows to generate images of teeth for odontograms with tooth faces painted in a color (red, green, blue, white or black for example). This is very usefull for dental applications..}
|
8
8
|
s.description =<<DESCRIPTION
|
@@ -16,13 +16,11 @@ DESCRIPTION
|
|
16
16
|
s.executables = ['imagetooth']
|
17
17
|
s.default_executable = %q{imagetooth}
|
18
18
|
s.require_paths = %w{lib bin .}
|
19
|
-
s.autorequire = 'image_tooth'
|
20
19
|
s.rubyforge_project = %q{imagetooth}
|
21
20
|
s.has_rdoc = true
|
22
|
-
s.required_ruby_version = '>= 1.
|
23
|
-
s.add_dependency("rmagick", ">=
|
24
|
-
s.
|
25
|
-
s.files = Dir.glob("**/*").delete_if { |item| item.include?("SVN") }
|
21
|
+
s.required_ruby_version = '>= 1.9.2'
|
22
|
+
s.add_dependency("rmagick", ">= 2.13.1")
|
23
|
+
s.files = Dir.glob("**/*").delete_if { |item| item.include?("~") }
|
26
24
|
|
27
25
|
s.signing_key = '/home/gramos/src/ruby/ruby-sign/gem-private_key.pem'
|
28
26
|
s.cert_chain = ['/home/gramos/src/ruby/ruby-sign/gem-public_cert.pem']
|
data/lib/arg_parser.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
class ArgParser
|
2
|
+
def self.parse(args)
|
3
|
+
options = OpenStruct.new
|
4
|
+
|
5
|
+
opts = OptionParser.new do |opts|
|
6
|
+
opts.on("-a", "--all", "Generate all teeth images's combinations.") do |all|
|
7
|
+
options.all = all
|
8
|
+
end
|
9
|
+
|
10
|
+
opts.on("-i", "--image IMAGE", "Generate image tooth based on file name.") do |i|
|
11
|
+
options.image = i
|
12
|
+
end
|
13
|
+
|
14
|
+
opts.on("-f", "--folder FOLDER", "Folder where images are saved. (** Required **)") do |f|
|
15
|
+
options.folder = f
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
19
|
+
puts opts
|
20
|
+
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.parse!(args)
|
26
|
+
options
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
data/spec/array_spec.rb
CHANGED
@@ -17,14 +17,14 @@ $LOAD_PATH << '../lib'
|
|
17
17
|
|
18
18
|
require 'array_adds'
|
19
19
|
|
20
|
-
|
20
|
+
describe "Array" do
|
21
21
|
|
22
|
-
|
22
|
+
it "Should be generate color sequence" do
|
23
23
|
char_colors = ['r', 'w']
|
24
24
|
char_colors.permut(2).should == [["r", "r"], ["r", "w"], ["w", "r"], ["w", "w"]]
|
25
25
|
end
|
26
26
|
|
27
|
-
|
27
|
+
it "Should be generate color sequence" do
|
28
28
|
char_colors = [['r', 'w'], ['r', 'w']]
|
29
29
|
char_colors.sequence.should == [["r", "r"], ["r", "w"], ["w", "r"], ["w", "w"]]
|
30
30
|
end
|
data/spec/image_tooth_spec.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
require 'image_tooth'
|
17
17
|
|
18
|
-
|
18
|
+
describe "Image Tooth" do
|
19
19
|
|
20
20
|
before(:each) do
|
21
21
|
@img_tooth = ImageTooth.new
|
@@ -37,7 +37,7 @@ context "Image Tooth" do
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
it "One color should be just one character" do
|
41
41
|
@img_tooth.wrap_color(:r).should == 'red'
|
42
42
|
@img_tooth.wrap_color(:g).should == 'green'
|
43
43
|
@img_tooth.wrap_color(:w).should == 'white'
|
@@ -45,14 +45,14 @@ context "Image Tooth" do
|
|
45
45
|
@img_tooth.wrap_color(:b).should == 'blue'
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
it "Should be generate base image tooth" do
|
49
49
|
@img_tooth.graph_base(@base_img)
|
50
50
|
File.exists?(@img_tooth.root_path + "/" + @base_img).should be_true
|
51
51
|
delete_img
|
52
52
|
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
it "Should be generate image with face painted, on base image" do
|
56
56
|
hash_faces = { :top => 'blue', :right => 'white', :bottom => 'white',
|
57
57
|
:left => 'white', :center => 'white' }
|
58
58
|
@img_tooth.graph_base
|
@@ -68,7 +68,7 @@ context "Image Tooth" do
|
|
68
68
|
File.exists?(@img_tooth.root_path + "/" + @painted_tooth).should be_true
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
it "Should be generate image with face painted, on base image" do
|
72
72
|
file_tooth = 'wrrgw.png'
|
73
73
|
@img_tooth.graph_base
|
74
74
|
@img_tooth.paint_img file_tooth
|
@@ -76,11 +76,13 @@ context "Image Tooth" do
|
|
76
76
|
delete_img
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
|
-
|
79
|
+
it "Should have five colors chars" do
|
80
|
+
[:w, :n, :r, :b, :g].each do |c|
|
81
|
+
ImageTooth.chars_colors.should include c
|
82
|
+
end
|
81
83
|
end
|
82
84
|
|
83
|
-
|
85
|
+
it "Should be generate a hash based on file name " do
|
84
86
|
hash_faces = { :top => 'white', :right => 'white', :bottom => 'green',
|
85
87
|
:left => 'green', :center => 'white' }
|
86
88
|
@img_tooth.file_name2hash_faces('wwggw.png').should == hash_faces
|
data/wrrgw.png
ADDED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,31 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: imagetooth
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
|
7
|
-
|
8
|
-
summary: This library allows to generate images of teeth for odontograms with tooth faces painted in a color (red, green, blue, white or black for example). This is very usefull for dental applications..
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
- bin
|
12
|
-
- .
|
13
|
-
email: ramos.gaston@gmail.com
|
14
|
-
homepage: http://rubyforge.org/projects/imagetooth
|
15
|
-
rubyforge_project: imagetooth
|
16
|
-
description: This library allows to generate images of teeth for odontograms with tooth faces painted in a color (red, green, blue, white or black for example). This is very usefull for dental applications.
|
17
|
-
autorequire: image_tooth
|
18
|
-
default_executable: imagetooth
|
19
|
-
bindir: bin
|
20
|
-
has_rdoc: true
|
21
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
22
|
-
requirements:
|
23
|
-
- - ">="
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
version: "1.8"
|
26
|
-
version:
|
4
|
+
prerelease:
|
5
|
+
version: 2.0.0
|
27
6
|
platform: ruby
|
28
|
-
|
7
|
+
authors:
|
8
|
+
- Gaston Ramos
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
29
11
|
cert_chain:
|
30
12
|
- |
|
31
13
|
-----BEGIN CERTIFICATE-----
|
@@ -49,78 +31,78 @@ cert_chain:
|
|
49
31
|
0xQa9X7YkXMgjqAHAC4=
|
50
32
|
-----END CERTIFICATE-----
|
51
33
|
|
52
|
-
|
53
|
-
|
54
|
-
|
34
|
+
date: 2011-06-21 00:00:00 -03:00
|
35
|
+
default_executable: imagetooth
|
36
|
+
dependencies:
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rmagick
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.13.1
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id001
|
48
|
+
description: |
|
49
|
+
This library allows to generate images of teeth for odontograms with tooth faces painted in a color (red, green, blue, white or black for example). This is very usefull for dental applications.
|
50
|
+
|
51
|
+
email: ramos.gaston@gmail.com
|
52
|
+
executables:
|
53
|
+
- imagetooth
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files: []
|
57
|
+
|
55
58
|
files:
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
- bin/imagetooth
|
62
|
-
- TODO
|
63
|
-
- images
|
64
|
-
- spec
|
65
|
-
- spec/array_spec.rb
|
59
|
+
- images/rwwng.png
|
60
|
+
- images/rwwww.png
|
61
|
+
- images/wwwww.png
|
62
|
+
- images/rwwwg.png
|
63
|
+
- README.markdown
|
66
64
|
- spec/image_tooth_spec.rb
|
65
|
+
- spec/array_spec.rb
|
67
66
|
- spec/wrrgw.png
|
68
|
-
- imagetooth.gemspec
|
69
67
|
- LICENSE
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
- doc/classes/ImageTooth.src/M000006.html
|
83
|
-
- doc/classes/ImageTooth.src/M000007.html
|
84
|
-
- doc/classes/ImageTooth.src/M000008.html
|
85
|
-
- doc/classes/ImageTooth.src/M000009.html
|
86
|
-
- doc/classes/ImageTooth.src/M000010.html
|
87
|
-
- doc/classes/ImageTooth.src/M000011.html
|
88
|
-
- doc/classes/ImageTooth.src/M000012.html
|
89
|
-
- doc/classes/ImageTooth.html
|
90
|
-
- doc/fr_file_index.html
|
91
|
-
- doc/fr_class_index.html
|
92
|
-
- doc/fr_method_index.html
|
93
|
-
- doc/index.html
|
94
|
-
- doc/created.rid
|
95
|
-
- README~
|
96
|
-
test_files: []
|
68
|
+
- bin/imagetooth
|
69
|
+
- TODO
|
70
|
+
- Gemfile
|
71
|
+
- imagetooth.gemspec
|
72
|
+
- Gemfile.lock
|
73
|
+
- lib/array_adds.rb
|
74
|
+
- lib/image_tooth.rb
|
75
|
+
- lib/arg_parser.rb
|
76
|
+
- wrrgw.png
|
77
|
+
has_rdoc: true
|
78
|
+
homepage: http://rubyforge.org/projects/imagetooth
|
79
|
+
licenses: []
|
97
80
|
|
81
|
+
post_install_message:
|
98
82
|
rdoc_options: []
|
99
83
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
-
|
104
|
-
|
105
|
-
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
- bin
|
87
|
+
- .
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.9.2
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: "0"
|
106
100
|
requirements: []
|
107
101
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: 1.15.7
|
117
|
-
version:
|
118
|
-
- !ruby/object:Gem::Dependency
|
119
|
-
name: OptionParser
|
120
|
-
version_requirement:
|
121
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 0.5.1
|
126
|
-
version:
|
102
|
+
rubyforge_project: imagetooth
|
103
|
+
rubygems_version: 1.6.2
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: This library allows to generate images of teeth for odontograms with tooth faces painted in a color (red, green, blue, white or black for example). This is very usefull for dental applications..
|
107
|
+
test_files: []
|
108
|
+
|
metadata.gz.sig
CHANGED
Binary file
|
data/README
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
please see http://imagetooth.rubyforge.org/
|
data/README~
DELETED
File without changes
|