aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/AreaOfInterest/AOI2DScene.py15
-rw-r--r--src/argaze/AreaOfInterest/AOIFeatures.py11
2 files changed, 26 insertions, 0 deletions
diff --git a/src/argaze/AreaOfInterest/AOI2DScene.py b/src/argaze/AreaOfInterest/AOI2DScene.py
index f8599c5..062044f 100644
--- a/src/argaze/AreaOfInterest/AOI2DScene.py
+++ b/src/argaze/AreaOfInterest/AOI2DScene.py
@@ -91,6 +91,21 @@ class AOI2DScene(AOIFeatures.AOIScene):
new_areas[circle.getAttribute('id')] = AOIFeatures.AreaOfInterest.from_dict(circle_dict)
+ # Load SVG ellipse
+ for ellipse in description_file.getElementsByTagName('ellipse'):
+
+ # Convert ellipse element into dict
+ ellipse_dict = {
+ "Ellipse": {
+ 'cx': float(circle.getAttribute('cx')),
+ 'cy': float(circle.getAttribute('cy')),
+ 'rx': float(circle.getAttribute('rx')),
+ 'ry': float(circle.getAttribute('ry'))
+ }
+ }
+
+ new_areas[ellipse.getAttribute('id')] = AOIFeatures.AreaOfInterest.from_dict(ellipse_dict)
+
return AOI2DScene(new_areas)
def draw(self, image: numpy.array, draw_aoi: dict = None, exclude=[]):
diff --git a/src/argaze/AreaOfInterest/AOIFeatures.py b/src/argaze/AreaOfInterest/AOIFeatures.py
index dfbb165..2d5b9b1 100644
--- a/src/argaze/AreaOfInterest/AOIFeatures.py
+++ b/src/argaze/AreaOfInterest/AOIFeatures.py
@@ -78,6 +78,17 @@ class AreaOfInterest(numpy.ndarray):
return AreaOfInterest(points)
+ elif shape == 'Ellipse':
+
+ cx = shape_data.pop('cx')
+ cy = shape_data.pop('cy')
+ rx = shape_data.pop('rx')
+ ry = shape_data.pop('ry')
+
+ # TODO: Use pygeos
+ N = 32
+ points = [(math.cos(2*math.pi / N*x) * rx + cx, math.sin(2*math.pi / N*x) * ry + cy) for x in range(0, N+1)]
+
@property
def dimension(self) -> int:
"""Number of axis coding area points positions."""