Skip to content

Commit

Permalink
fix(Python): support empty image metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Aug 22, 2023
1 parent 201f7a2 commit 9d220ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/python/itkwasm/itkwasm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""itkwasm: Python interface to itk-wasm WebAssembly modules."""

__version__ = "1.0b129"
__version__ = "1.0b130"

from .interface_types import InterfaceTypes
from .image import Image, ImageType
Expand Down
4 changes: 3 additions & 1 deletion packages/core/python/itkwasm/itkwasm/pyodide.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,10 @@ def to_js(py):
image_dict['direction'] = image_dict['direction'].ravel()
if image_dict['data'] is not None:
image_dict['data'] = image_dict['data'].ravel()
if image_dict['metadata']:
if 'metadata' in image_dict:
image_dict['metadata'] = pyodide.ffi.to_js(image_dict['metadata'], dict_converter=js.Map.new)
else:
image_dict['metadata'] = pyodide.ffi.to_js(dict(), dict_converter=js.Map.new)
return pyodide.ffi.to_js(image_dict, dict_converter=js.Object.fromEntries)
elif isinstance(py, PointSet):
point_set_dict = asdict(py)
Expand Down

0 comments on commit 9d220ba

Please sign in to comment.