diff --git a/src/nd2/structures.py b/src/nd2/structures.py index 31026c2..623613f 100644 --- a/src/nd2/structures.py +++ b/src/nd2/structures.py @@ -422,7 +422,7 @@ def _from_meta_dict(cls, val: dict) -> ExtrudedShape: return cls( sizeZ=val.get("SizeZ") or val.get("sizeZ") or 0, basePoints=[ - XYPoint(*val[f"BasePoints_{i}"].get("", [])) + XYPoint(*val[f"BasePoints_{i}"].values()) for i in range(val.get("BasePoints_Size", 0)) ], ) diff --git a/tests/test_rois.py b/tests/test_rois.py index 8812ef7..d57a55a 100644 --- a/tests/test_rois.py +++ b/tests/test_rois.py @@ -1,6 +1,7 @@ from pathlib import Path import nd2 +from nd2.structures import InterpType DATA = Path(__file__).parent / "data" @@ -10,3 +11,16 @@ def test_rois(): rois = f.rois.values() assert len(rois) == 18 assert [r.id for r in rois] == list(range(1, 19)) + + roi1 = f.rois[1] + assert roi1.info.label == "rect bgrd" + + roi16 = f.rois[16] + assert roi16.info.label == "S3:16 stim 3 poly" + assert roi16.info.interpType == InterpType.StimulationROI + assert roi16.animParams[0].extrudedShape.basePoints == [ + (-0.05231780847932399, -0.10247210748706266), + (0.09780325689597874, 0.04522765038218665), + (0.030006646726487105, 0.11302426055167814), + (-0.0959013435882828, -0.05646726487205058), + ]