Skip to content

Commit 86a8c7e

Browse files
Merge pull request #149 from haesleinhuepf/support_dots
Support points, also with relative coordinates
2 parents a4a5508 + d7c74ce commit 86a8c7e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="stackview",
8-
version="0.14.2",
8+
version="0.14.3",
99
author="Robert Haase",
1010
author_email="[email protected]",
1111
description="Interactive image stack viewing in jupyter notebooks",

stackview/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.14.2"
1+
__version__ = "0.14.3"
22

33
from ._static_view import jupyter_displayable_output, insight
44
from ._utilities import merge_rgb

stackview/_add_bounding_boxes.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,19 @@ def add_bounding_boxes(image, bounding_boxes, line_width=2):
5252
for bbox in bounding_boxes:
5353
x = bbox['x']
5454
y = bbox['y']
55-
width = bbox['width']
56-
height = bbox['height']
55+
width = bbox['width'] if 'width' in bbox else 1
56+
height = bbox['height'] if 'height' in bbox else 1
5757
color_name = bbox['color'] if 'color' in bbox else "red"
5858

59+
if isinstance(x, float):
60+
x = int(x * img_with_boxes.shape[1])
61+
if isinstance(y, float):
62+
y = int(y * img_with_boxes.shape[0])
63+
if isinstance(width, float):
64+
width = int(width * img_with_boxes.shape[1])
65+
if isinstance(height, float):
66+
height = int(height * img_with_boxes.shape[0])
67+
5968
# Convert color name to RGB
6069
color = color_name_to_rgb(color_name)
6170

0 commit comments

Comments
 (0)