From 2f2e88861207f78f0bb479040e7015c1f863ba8c Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 14 Dec 2022 21:10:29 -0500 Subject: [PATCH] BUG: pointset_type_from_wasm_type return a PointSet Likely copy/paste error from similar Mesh function. --- Wrapping/Generators/Python/Tests/extras.py | 11 +++++++++++ Wrapping/Generators/Python/itk/support/helpers.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Wrapping/Generators/Python/Tests/extras.py b/Wrapping/Generators/Python/Tests/extras.py index 6cd7817c166..a79c27e0257 100644 --- a/Wrapping/Generators/Python/Tests/extras.py +++ b/Wrapping/Generators/Python/Tests/extras.py @@ -199,6 +199,17 @@ def custom_callback(name, progress): itk.meshwrite(mesh, sys.argv[5]) itk.meshwrite(mesh, sys.argv[5], compression=True) +# smoke test wasm / Python / NumPy conversion +mesh_dict = itk.dict_from_mesh(mesh) +mesh_back = itk.mesh_from_dict(mesh_dict) + +pointset = itk.PointSet[itk.F, 3].New() +pointset.SetPoints(mesh.GetPoints()) +pointset.SetPointData(mesh.GetPointData()) + +pointset_dict = itk.dict_from_pointset(pointset) +pointset_back = itk.pointset_from_dict(pointset_dict) + # test search res = itk.search("Index") assert res[0] == "Index" diff --git a/Wrapping/Generators/Python/itk/support/helpers.py b/Wrapping/Generators/Python/itk/support/helpers.py index e06af3ae25d..d629b04e794 100644 --- a/Wrapping/Generators/Python/itk/support/helpers.py +++ b/Wrapping/Generators/Python/itk/support/helpers.py @@ -401,4 +401,4 @@ def pointset_type_from_wasm_type(jstype): prefix = prefix + js_to_python(pointPixelComponentType) prefix += str(dimension) - return getattr(itk.Mesh, prefix) + return getattr(itk.PointSet, prefix)