sqed 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,25 +3,61 @@ require 'spec_helper'
3
3
  describe 'handling 7 slot stages' do
4
4
 
5
5
  let(:image) { ImageHelpers.inhs_stage_7_slot }
6
- let(:sqed) { Sqed.new(target_image: image, target_pattern: :seven_slot, boundary_color: :red, has_border: false ) }
6
+ let(:sqed) do
7
+ Sqed.new(
8
+ image: image,
9
+ pattern: :seven_slot,
10
+ boundary_color: :red,
11
+ has_border: false )
12
+ end
13
+
14
+ let(:m) do
15
+ { 0 => 'collecting_event_labels',
16
+ 1 => 'determination_labels',
17
+ 2 => 'other_labels',
18
+ 3 => 'image_registration',
19
+ 4 => 'curator_metadata',
20
+ 5 => 'identifier',
21
+ 6 => 'specimen' }
22
+ end
7
23
 
8
24
  context 'parses' do
9
25
  specify 'new() without errors' do
10
- expect( sqed ).to be_truthy
26
+ expect(sqed).to be_truthy
11
27
  end
12
28
 
13
29
  specify 'get result without errors' do
14
- expect( sqed.result ).to be_truthy
30
+ expect(sqed.result).to be_truthy
15
31
  end
16
32
  end
17
33
 
18
- context 'without target_pattern' do
19
- let(:m) { {"0" => "collecting_event_labels", "1" => "determination_labels", "2" => "other_labels", "3" => "image_registration", "4" => "curator_metadata", "5" => "identifier", "6" => "specimen" } }
20
- let(:s) { Sqed.new(target_image: image, metadata_map: m, target_layout: :seven_slot, boundary_color: :red, has_border: false ) }
34
+ context 'trickier boundaries - without thumbnail' do
35
+ let(:s) { Sqed.new(image: ImageHelpers.inhs_stage_7_slot2, metadata_map: m, use_thumbnail: false, layout: :seven_slot, boundary_color: :red, has_border: false ) }
21
36
 
22
- specify 'get result without errors' do
23
- expect( sqed.result ).to be_truthy
37
+ specify 'boundaries are reasonable' do
38
+ s.result
39
+ c = s.boundaries.coordinates
40
+ c.each do |section, values|
41
+ c[section].each_with_index do |v, i|
42
+ msg = "section #{section}, index #{i} has a bad value '#{v}'"
43
+ expect(v > -1).to be_truthy, msg
44
+ end
45
+ end
24
46
  end
25
47
  end
26
48
 
27
- end
49
+ context 'trickier boundaries - with_thumbnail' do
50
+ let(:s) { Sqed.new(image: ImageHelpers.inhs_stage_7_slot2, use_thumbnail: true, pattern: :seven_slot, boundary_color: :red, has_border: false ) }
51
+
52
+ specify 'boundaries are reasonable' do
53
+ s.result
54
+ c = s.boundaries.coordinates
55
+ c.each do |section, values|
56
+ c[section].each_with_index do |v, i|
57
+ msg = "section #{section}, index #{i} has a bad value '#{v}'"
58
+ expect(v > -1).to be_truthy, msg
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -1,6 +1,6 @@
1
1
  module ImageHelpers
2
2
 
3
- BASE_PATH = '../files/'
3
+ BASE_PATH = '../files/'.freeze
4
4
 
5
5
  class << self
6
6
 
@@ -35,6 +35,10 @@ module ImageHelpers
35
35
  get_image 'stage_images/inhs_7_slot.jpg'
36
36
  end
37
37
 
38
+ def inhs_stage_7_slot2
39
+ get_image 'stage_images/inhs_7_slot2.jpg'
40
+ end
41
+
38
42
  def crossy_green_line_specimen
39
43
  get_image 'stage_images/CrossyGreenLinesSpecimen.jpg'
40
44
  end
@@ -84,16 +88,16 @@ module ImageHelpers
84
88
  get_image 'label_iamges/label_images/black_stage_green_line_specimen_label.jpg'
85
89
  end
86
90
 
87
- def readme_text
88
- get_image 'label_images/readme.png'
91
+ def readme_text
92
+ get_image 'label_images/readme.png'
89
93
  end
90
94
 
91
95
  def basic_text_image1
92
- get_image 'label_images/basic1.png'
96
+ get_image 'label_images/basic1.png'
93
97
  end
94
98
 
95
99
  def basic_text_image2
96
- get_image 'label_images/basic2.png'
100
+ get_image 'label_images/basic2.png'
97
101
  end
98
102
 
99
103
  # Real life, black border, no internal boundaries
@@ -111,8 +115,5 @@ module ImageHelpers
111
115
  def slide_scan_image
112
116
  get_image 'misc_images/types_8.jpg'
113
117
  end
114
-
115
-
116
- end
117
-
118
+ end
118
119
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Yoder
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-14 00:00:00.000000000 Z
12
+ date: 2018-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -122,6 +122,7 @@ files:
122
122
  - ".ruby-version"
123
123
  - ".travis.yml"
124
124
  - Gemfile
125
+ - Guardfile
125
126
  - LICENSE.txt
126
127
  - README.md
127
128
  - Rakefile
@@ -172,6 +173,7 @@ files:
172
173
  - spec/support/files/stage_images/frost_stage_thumb.jpg
173
174
  - spec/support/files/stage_images/greenlineimage.jpg
174
175
  - spec/support/files/stage_images/inhs_7_slot.jpg
176
+ - spec/support/files/stage_images/inhs_7_slot2.jpg
175
177
  - spec/support/files/stage_images/inhs_four_thirds.jpg
176
178
  - spec/support/files/test0.jpg
177
179
  - spec/support/files/test1.jpg
@@ -201,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
203
  version: '0'
202
204
  requirements: []
203
205
  rubyforge_project:
204
- rubygems_version: 2.6.4
206
+ rubygems_version: 2.6.14
205
207
  signing_key:
206
208
  specification_version: 4
207
209
  summary: Specimens Quickly Extracted and Digitized, or just "squid". A ruby gem for
@@ -241,6 +243,7 @@ test_files:
241
243
  - spec/support/files/stage_images/frost_stage_thumb.jpg
242
244
  - spec/support/files/stage_images/greenlineimage.jpg
243
245
  - spec/support/files/stage_images/inhs_7_slot.jpg
246
+ - spec/support/files/stage_images/inhs_7_slot2.jpg
244
247
  - spec/support/files/stage_images/inhs_four_thirds.jpg
245
248
  - spec/support/files/test0.jpg
246
249
  - spec/support/files/test1.jpg