Skip to content

Commit 2fe31e0

Browse files
authored
fix: fix extraction of xy points in extruded shapes (#183)
1 parent 82e7005 commit 2fe31e0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/nd2/structures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def _from_meta_dict(cls, val: dict) -> ExtrudedShape:
422422
return cls(
423423
sizeZ=val.get("SizeZ") or val.get("sizeZ") or 0,
424424
basePoints=[
425-
XYPoint(*val[f"BasePoints_{i}"].get("", []))
425+
XYPoint(*val[f"BasePoints_{i}"].values())
426426
for i in range(val.get("BasePoints_Size", 0))
427427
],
428428
)

tests/test_rois.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from pathlib import Path
22

33
import nd2
4+
from nd2.structures import InterpType
45

56
DATA = Path(__file__).parent / "data"
67

@@ -10,3 +11,16 @@ def test_rois():
1011
rois = f.rois.values()
1112
assert len(rois) == 18
1213
assert [r.id for r in rois] == list(range(1, 19))
14+
15+
roi1 = f.rois[1]
16+
assert roi1.info.label == "rect bgrd"
17+
18+
roi16 = f.rois[16]
19+
assert roi16.info.label == "S3:16 stim 3 poly"
20+
assert roi16.info.interpType == InterpType.StimulationROI
21+
assert roi16.animParams[0].extrudedShape.basePoints == [
22+
(-0.05231780847932399, -0.10247210748706266),
23+
(0.09780325689597874, 0.04522765038218665),
24+
(0.030006646726487105, 0.11302426055167814),
25+
(-0.0959013435882828, -0.05646726487205058),
26+
]

0 commit comments

Comments
 (0)