Skip to content

Commit

Permalink
fix: fix extra kwargs to roi info (#158)
Browse files Browse the repository at this point in the history
* fix: fix extra kwargs to roi info

* catch one more
  • Loading branch information
tlambert03 authored Jul 5, 2023
1 parent 81e47b2 commit ea5d91b
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/nd2/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,22 @@ def _from_meta_dict(cls, val: dict) -> ROI:
# 'Id', 'Info', 'GUID', 'AnimParams_Size', 'AnimParams_{i}'
# where GUID and AnimParams keys are optional
anim_params = [
AnimParam(**{_lower0(k): v for k, v in val[f"AnimParams_{i}"].items()})
AnimParam(
**{
_lower0(k): v
for k, v in val[f"AnimParams_{i}"].items()
if _lower0(k) in AnimParam.__annotations__
}
)
for i in range(val.get("AnimParams_Size", 0))
]
info = RoiInfo(**{_lower0(k): v for k, v in val["Info"].items()})
info = RoiInfo(
**{
_lower0(k): v
for k, v in val["Info"].items()
if _lower0(k) in RoiInfo.__annotations__
}
)
return cls(
id=val["Id"],
info=info,
Expand Down Expand Up @@ -486,7 +498,11 @@ class AnimParam:
def __post_init__(self) -> None:
if isinstance(self.boxShape, dict):
self.boxShape = BoxShape(
**{_lower0(k): v for k, v in self.boxShape.items()}
**{
_lower0(k): v
for k, v in self.boxShape.items()
if _lower0(k) in BoxShape.__annotations__
}
)
if isinstance(self.extrudedShape, dict):
self.extrudedShape = ExtrudedShape._from_meta_dict(self.extrudedShape)
Expand Down

0 comments on commit ea5d91b

Please sign in to comment.