Skip to content

Commit 12e9bc6

Browse files
Merge pull request #63 from DiamondLightSource/I04_1-293-table
I04 1 293 table
2 parents 1329545 + c6db427 commit 12e9bc6

File tree

5 files changed

+10
-158
lines changed

5 files changed

+10
-158
lines changed

dls_barcode/config/barcode_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(self, file, file_manager):
2626
default_store = "../store/"
2727

2828
self.color_ok = add(ColorConfigItem, "Read Color", Color.Green())
29+
self.color_accept = add(ColorConfigItem, "Partially Read Color", Color.Yellow())
2930
self.color_unreadable = add(ColorConfigItem, "Not Read Color", Color.Red())
3031
self.color_empty = add(ColorConfigItem, "Empty Color", Color.Grey())
3132

@@ -61,6 +62,9 @@ def __init__(self, file, file_manager):
6162
def col_ok(self):
6263
return self.color_ok.value()
6364

65+
def col_accept(self):
66+
return self.color_accept.value()
67+
6468
def col_bad(self):
6569
return self.color_unreadable.value()
6670

dls_barcode/geometry/unipuck_locator.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ def find_location(self):
4949
# take the features which have only small convexity defects
5050

5151
(cx, cy) = self._find_contour_momentum(match_cnt)
52-
#blank_image = np.zeros([1000, 1000, 3], np.uint8)
53-
#cv2.drawContours(blank_image, [match_cnt], -1, (255, 255, 255), -1)
54-
#cv2.drawContours(self.image, [hull], -1, (255, 255, 255), 5)
55-
#self.popup_image(255- blank_image, 'cnt1')
56-
#self.save_image('C:/Users/rqq82173/PycharmProjects/PuckBarcodeReader/test_' + str(cx) + '.png', 255-blank_image)
5752

5853
feature_orientation = math.atan2(cy - y, cx - x) # feature orientation
5954
puck_orientation = feature_orientation - math.pi / 2 # puck orientation shifted -pi/2 rad from feature orientation
@@ -62,10 +57,6 @@ def find_location(self):
6257
uni.set_feature_center(Point(cx, cy))
6358
uni.set_feature_boarder(match_cnt)
6459

65-
#uni.calculate_slot_bounds(uni.center(), uni.radius(), uni.angle())
66-
#uni.draw_plate(Image(self.image), Color.White())
67-
#self.popup_image(self.image, 'test')
68-
6960
return uni
7061

7162
def _find_puck_contours(self):
@@ -75,9 +66,6 @@ def _find_puck_contours(self):
7566
cnt = ContoursManager(255 - edged)
7667
cnt.find_all()
7768

78-
# self.popup_image(blurred, 'bl')
79-
# self.popup_image(edged, 'ero')
80-
8169
return cnt
8270

8371
def _find_enclosing_circle_of_largest_contour(self):
@@ -91,14 +79,10 @@ def _find_contours_of_features(self, x, y, rad):
9179

9280
self.unipuck_contours.draw_largest_cnt(blank_image, Color.Black(), -1)
9381

94-
# self.popup_image(blank_image, 'cn2')
95-
9682
img_open = ImageMorphology(blank_image).do_open_morph(8) # removes some white artifacts
9783
img_open_cnt = ContoursManager(img_open)
9884
img_open_cnt.find_all()
9985

100-
# self.popup_image(img_open, 'morph2')
101-
10286
return img_open_cnt
10387

10488
def _find_feature(self, features_cnt): # do this better
@@ -135,6 +119,4 @@ def popup_image(self, ima, name):
135119
cv2.imshow(name, ima)
136120
cv2.waitKey(0)
137121
cv2.destroyAllWindows()
138-
#
139-
# def save_image(self, name, img):
140-
# cv2.imwrite(name, img)
122+

dls_barcode/geometry/unipuck_locator_script.py

Lines changed: 0 additions & 136 deletions
This file was deleted.

dls_barcode/gui/record_table.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ def _load_store_records(self):
8484
for n, record in enumerate(self._store.records):
8585
items = [record.date, record.time, record.holder_barcode, record.plate_type, record.num_valid_barcodes,
8686
record.num_unread_slots, record.num_empty_slots]
87-
88-
if (record.num_valid_barcodes + record.num_empty_slots) == record.num_slots:
87+
valid_empty = record.num_valid_barcodes + record.num_empty_slots
88+
if valid_empty == record.num_slots:
8989
color = self._options.col_ok()
90+
elif valid_empty < record.num_slots and record.num_valid_barcodes > 0:
91+
color = self._options.col_accept()
9092
else:
9193
color = self._options.col_bad()
9294

docs/release-notes/release-notes-dev.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Changes merged into master
55
--------------------------
66
| Jira Task | GitHub Issue | Type | Description |
77
|-----------|--------------|------|-------------|
8-
8+
| I04_1-143 | [#63](https://github.com/DiamondLightSource/PuckBarcodeReader/issues/62) | Minor | Record summary table color changes. |
99

1010
Change Types:
1111
* Major - Backward incompatible change

0 commit comments

Comments
 (0)