From 08791230814241baf2283c07cc6b16b00dcccca4 Mon Sep 17 00:00:00 2001 From: Theo De La Hogue Date: Tue, 26 Sep 2023 10:42:41 +0200 Subject: Changing JSON description schema. --- src/argaze/AreaOfInterest/AOIFeatures.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/argaze/AreaOfInterest/AOIFeatures.py b/src/argaze/AreaOfInterest/AOIFeatures.py index debf1fa..dfbb165 100644 --- a/src/argaze/AreaOfInterest/AOIFeatures.py +++ b/src/argaze/AreaOfInterest/AOIFeatures.py @@ -51,24 +51,26 @@ class AreaOfInterest(numpy.ndarray): working_directory: folder path where to load files when a dictionary value is a relative filepath. """ - shape = aoi_data.pop('shape') + # Get first and unique shape + # TODO: allow multiple shapes to describe more complex AOI + shape, shape_data = aoi_data.popitem() - if shape == 'rectangle': + if shape == 'Rectangle': - x = aoi_data.pop('x') - y = aoi_data.pop('y') - width = aoi_data.pop('width') - height = aoi_data.pop('height') + x = shape_data.pop('x') + y = shape_data.pop('y') + width = shape_data.pop('width') + height = shape_data.pop('height') points = [[x, y], [x+width, y], [x+width, y+height], [x, y+height]] return AreaOfInterest(points) - elif shape == 'circle': + elif shape == 'Circle': - cx = aoi_data.pop('cx') - cy = aoi_data.pop('cy') - radius = aoi_data.pop('radius') + cx = shape_data.pop('cx') + cy = shape_data.pop('cy') + radius = shape_data.pop('radius') # TODO: Use pygeos N = 32 @@ -462,7 +464,7 @@ class AOIScene(): @property def dimension(self) -> int: - """Dimension of the AOIs in scene.""" + """Dimension of the AOI in scene.""" return self.__dimension -- cgit v1.1