diff options
author | Théo de la Hogue | 2023-09-20 18:03:06 +0200 |
---|---|---|
committer | Théo de la Hogue | 2023-09-20 18:03:06 +0200 |
commit | bc9257268bb54ea68f777cbb853dc6498274dd99 (patch) | |
tree | 06d0d00a8905027a405f9b7cfe9fe35cc619297d /src/argaze.test | |
parent | 1f36c34242791145a1b33dd17cf351018456310f (diff) | |
download | argaze-bc9257268bb54ea68f777cbb853dc6498274dd99.zip argaze-bc9257268bb54ea68f777cbb853dc6498274dd99.tar.gz argaze-bc9257268bb54ea68f777cbb853dc6498274dd99.tar.bz2 argaze-bc9257268bb54ea68f777cbb853dc6498274dd99.tar.xz |
Adding expand to AOIScene.
Diffstat (limited to 'src/argaze.test')
-rw-r--r-- | src/argaze.test/AreaOfInterest/AOIFeatures.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/argaze.test/AreaOfInterest/AOIFeatures.py b/src/argaze.test/AreaOfInterest/AOIFeatures.py index bced0aa..cc75ed8 100644 --- a/src/argaze.test/AreaOfInterest/AOIFeatures.py +++ b/src/argaze.test/AreaOfInterest/AOIFeatures.py @@ -181,21 +181,15 @@ class TestAOISceneClass(unittest.TestCase): aoi_2d_scene_AB["A"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 1], [1, 0]]) aoi_2d_scene_AB["B"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 2], [2, 2], [2, 0]]) - print('aoi_2d_scene_AB vars: ', vars(aoi_2d_scene_AB)) - # Create second scene with C and D aoi aoi_2d_scene_CD = AOIFeatures.AOIScene(2,) aoi_2d_scene_CD["C"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 3], [3, 3], [3, 0]]) aoi_2d_scene_CD["D"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 4], [4, 4], [4, 0]]) - print('aoi_2d_scene_CD vars: ', vars(aoi_2d_scene_CD)) - # Merge first scene and second scene into a third scene aoi_2d_scene_ABCD = aoi_2d_scene_AB | aoi_2d_scene_CD - print('aoi_2d_scene_ABCD vars: ', vars(aoi_2d_scene_ABCD)) - # Check third scene self.assertEqual(aoi_2d_scene_ABCD.dimension, 2) self.assertEqual(len(aoi_2d_scene_ABCD.items()), 4) @@ -205,13 +199,28 @@ class TestAOISceneClass(unittest.TestCase): # Merge second scene into first scene aoi_2d_scene_AB |= aoi_2d_scene_CD - print('aoi_2d_scene_AB vars: ', vars(aoi_2d_scene_AB)) - # Check first scene self.assertEqual(aoi_2d_scene_AB.dimension, 2) self.assertEqual(len(aoi_2d_scene_AB.items()), 4) self.assertEqual(list(aoi_2d_scene_AB.keys()), ["A", "B", "C", "D"]) self.assertEqual(len(vars(aoi_2d_scene_AB)), 2 + len(aoi_2d_scene_AB.items())) + + def test_expand(self): + """Test AOIScene expand method.""" + + # Create 2D scene + aoi_2d_scene = AOIFeatures.AOIScene(2,) + aoi_2d_scene["A"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 1], [1, 0]]) + aoi_2d_scene["B"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 2], [2, 2], [2, 0]]) + + # Expand to 3D scene + aoi_3d_scene = aoi_2d_scene.expand() + + self.assertEqual(aoi_3d_scene.dimension, 3) + self.assertEqual(len(aoi_3d_scene.items()), 2) + self.assertEqual(list(aoi_3d_scene.keys()), ["A", "B"]) + self.assertEqual(aoi_3d_scene["A"].shape[1], 3) + self.assertEqual(aoi_3d_scene["B"].shape[1], 3) def test___repr__(self): """Test AOIScene string representation.""" |