Skip to content

Commit 19db749

Browse files
committed
feat(mesh-io): python dispatch mz3 support
1 parent 53dd7fa commit 19db749

12 files changed

+395
-0
lines changed

packages/mesh-io/python/itkwasm-mesh-io/itkwasm_mesh_io/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
from .free_surfer_binary_read_mesh import free_surfer_binary_read_mesh
2323
from .free_surfer_binary_write_mesh_async import free_surfer_binary_write_mesh_async
2424
from .free_surfer_binary_write_mesh import free_surfer_binary_write_mesh
25+
from .mz3_read_mesh_async import mz3_read_mesh_async
26+
from .mz3_read_mesh import mz3_read_mesh
27+
from .mz3_write_mesh_async import mz3_write_mesh_async
28+
from .mz3_write_mesh import mz3_write_mesh
2529
from .obj_read_mesh_async import obj_read_mesh_async
2630
from .obj_read_mesh import obj_read_mesh
2731
from .obj_write_mesh_async import obj_write_mesh_async
@@ -51,6 +55,8 @@
5155
from .wasm_zstd_write_mesh_async import wasm_zstd_write_mesh_async
5256
from .wasm_zstd_write_mesh import wasm_zstd_write_mesh
5357

58+
from .mz3_read_point_set_async import mz3_read_point_set_async
59+
from .mz3_write_point_set_async import mz3_write_point_set_async
5460
from .obj_read_point_set_async import obj_read_point_set_async
5561
from .obj_write_point_set_async import obj_write_point_set_async
5662
from .off_read_point_set_async import off_read_point_set_async
@@ -61,6 +67,8 @@
6167
from .wasm_write_point_set_async import wasm_write_point_set_async
6268
from .wasm_zstd_read_point_set_async import wasm_zstd_read_point_set_async
6369
from .wasm_zstd_write_point_set_async import wasm_zstd_write_point_set_async
70+
from .mz3_read_point_set import mz3_read_point_set
71+
from .mz3_write_point_set import mz3_write_point_set
6472
from .obj_read_point_set import obj_read_point_set
6573
from .obj_write_point_set import obj_write_point_set
6674
from .off_read_point_set import off_read_point_set
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Generated file. Do not edit.
2+
3+
import os
4+
from typing import Dict, Tuple, Optional, List, Any
5+
6+
from itkwasm import (
7+
environment_dispatch,
8+
BinaryFile,
9+
Mesh,
10+
)
11+
12+
def mz3_read_mesh(
13+
serialized_mesh: os.PathLike,
14+
information_only: bool = False,
15+
) -> Tuple[Any, Mesh]:
16+
"""Read a mesh file format and convert it to the itk-wasm file format
17+
18+
:param serialized_mesh: Input mesh serialized in the file format
19+
:type serialized_mesh: os.PathLike
20+
21+
:param information_only: Only read mesh metadata -- do not read pixel data.
22+
:type information_only: bool
23+
24+
:return: Whether the input could be read. If false, the output mesh is not valid.
25+
:rtype: Any
26+
27+
:return: Output mesh
28+
:rtype: Mesh
29+
"""
30+
func = environment_dispatch("itkwasm_mesh_io", "mz3_read_mesh")
31+
output = func(serialized_mesh, information_only=information_only)
32+
return output
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Generated file. Do not edit.
2+
3+
import os
4+
from typing import Dict, Tuple, Optional, List, Any
5+
6+
from itkwasm import (
7+
environment_dispatch,
8+
BinaryFile,
9+
Mesh,
10+
)
11+
12+
async def mz3_read_mesh_async(
13+
serialized_mesh: os.PathLike,
14+
information_only: bool = False,
15+
) -> Tuple[Any, Mesh]:
16+
"""Read a mesh file format and convert it to the itk-wasm file format
17+
18+
:param serialized_mesh: Input mesh serialized in the file format
19+
:type serialized_mesh: os.PathLike
20+
21+
:param information_only: Only read mesh metadata -- do not read pixel data.
22+
:type information_only: bool
23+
24+
:return: Whether the input could be read. If false, the output mesh is not valid.
25+
:rtype: Any
26+
27+
:return: Output mesh
28+
:rtype: Mesh
29+
"""
30+
func = environment_dispatch("itkwasm_mesh_io", "mz3_read_mesh_async")
31+
output = await func(serialized_mesh, information_only=information_only)
32+
return output
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Generated file. Do not edit.
2+
3+
import os
4+
from typing import Dict, Tuple, Optional, List, Any
5+
6+
from itkwasm import (
7+
environment_dispatch,
8+
BinaryFile,
9+
PointSet,
10+
)
11+
12+
def mz3_read_point_set(
13+
serialized_point_set: os.PathLike,
14+
information_only: bool = False,
15+
) -> Tuple[Any, PointSet]:
16+
"""Read a point set file format and convert it to the itk-wasm file format
17+
18+
:param serialized_point_set: Input point set serialized in the file format
19+
:type serialized_point_set: os.PathLike
20+
21+
:param information_only: Only read point set metadata -- do not read pixel data.
22+
:type information_only: bool
23+
24+
:return: Whether the input could be read. If false, the output point set is not valid.
25+
:rtype: Any
26+
27+
:return: Output point set
28+
:rtype: PointSet
29+
"""
30+
func = environment_dispatch("itkwasm_mesh_io", "mz3_read_point_set")
31+
output = func(serialized_point_set, information_only=information_only)
32+
return output
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Generated file. Do not edit.
2+
3+
import os
4+
from typing import Dict, Tuple, Optional, List, Any
5+
6+
from itkwasm import (
7+
environment_dispatch,
8+
BinaryFile,
9+
PointSet,
10+
)
11+
12+
async def mz3_read_point_set_async(
13+
serialized_point_set: os.PathLike,
14+
information_only: bool = False,
15+
) -> Tuple[Any, PointSet]:
16+
"""Read a point set file format and convert it to the itk-wasm file format
17+
18+
:param serialized_point_set: Input point set serialized in the file format
19+
:type serialized_point_set: os.PathLike
20+
21+
:param information_only: Only read point set metadata -- do not read pixel data.
22+
:type information_only: bool
23+
24+
:return: Whether the input could be read. If false, the output point set is not valid.
25+
:rtype: Any
26+
27+
:return: Output point set
28+
:rtype: PointSet
29+
"""
30+
func = environment_dispatch("itkwasm_mesh_io", "mz3_read_point_set_async")
31+
output = await func(serialized_point_set, information_only=information_only)
32+
return output
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Generated file. Do not edit.
2+
3+
import os
4+
from typing import Dict, Tuple, Optional, List, Any
5+
6+
from itkwasm import (
7+
environment_dispatch,
8+
Mesh,
9+
BinaryFile,
10+
)
11+
12+
def mz3_write_mesh(
13+
mesh: Mesh,
14+
serialized_mesh: str,
15+
information_only: bool = False,
16+
use_compression: bool = False,
17+
binary_file_type: bool = False,
18+
) -> Tuple[Any]:
19+
"""Write an itk-wasm file format converted to an mesh file format
20+
21+
:param mesh: Input mesh
22+
:type mesh: Mesh
23+
24+
:param serialized_mesh: Output mesh
25+
:type serialized_mesh: str
26+
27+
:param information_only: Only write mesh metadata -- do not write pixel data.
28+
:type information_only: bool
29+
30+
:param use_compression: Use compression in the written file, if supported
31+
:type use_compression: bool
32+
33+
:param binary_file_type: Use a binary file type in the written file, if supported
34+
:type binary_file_type: bool
35+
36+
:return: Whether the input could be written. If false, the output mesh is not valid.
37+
:rtype: Any
38+
"""
39+
func = environment_dispatch("itkwasm_mesh_io", "mz3_write_mesh")
40+
output = func(mesh, serialized_mesh, information_only=information_only, use_compression=use_compression, binary_file_type=binary_file_type)
41+
return output
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Generated file. Do not edit.
2+
3+
import os
4+
from typing import Dict, Tuple, Optional, List, Any
5+
6+
from itkwasm import (
7+
environment_dispatch,
8+
Mesh,
9+
BinaryFile,
10+
)
11+
12+
async def mz3_write_mesh_async(
13+
mesh: Mesh,
14+
serialized_mesh: str,
15+
information_only: bool = False,
16+
use_compression: bool = False,
17+
binary_file_type: bool = False,
18+
) -> Tuple[Any]:
19+
"""Write an itk-wasm file format converted to an mesh file format
20+
21+
:param mesh: Input mesh
22+
:type mesh: Mesh
23+
24+
:param serialized_mesh: Output mesh
25+
:type serialized_mesh: str
26+
27+
:param information_only: Only write mesh metadata -- do not write pixel data.
28+
:type information_only: bool
29+
30+
:param use_compression: Use compression in the written file, if supported
31+
:type use_compression: bool
32+
33+
:param binary_file_type: Use a binary file type in the written file, if supported
34+
:type binary_file_type: bool
35+
36+
:return: Whether the input could be written. If false, the output mesh is not valid.
37+
:rtype: Any
38+
"""
39+
func = environment_dispatch("itkwasm_mesh_io", "mz3_write_mesh_async")
40+
output = await func(mesh, serialized_mesh, information_only=information_only, use_compression=use_compression, binary_file_type=binary_file_type)
41+
return output
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Generated file. Do not edit.
2+
3+
import os
4+
from typing import Dict, Tuple, Optional, List, Any
5+
6+
from itkwasm import (
7+
environment_dispatch,
8+
PointSet,
9+
BinaryFile,
10+
)
11+
12+
def mz3_write_point_set(
13+
point_set: PointSet,
14+
serialized_point_set: str,
15+
information_only: bool = False,
16+
use_compression: bool = False,
17+
binary_file_type: bool = False,
18+
) -> Tuple[Any]:
19+
"""Write an ITK-Wasm file format converted to a point set file format
20+
21+
:param point_set: Input point set
22+
:type point_set: PointSet
23+
24+
:param serialized_point_set: Output point set
25+
:type serialized_point_set: str
26+
27+
:param information_only: Only write point set metadata -- do not write pixel data.
28+
:type information_only: bool
29+
30+
:param use_compression: Use compression in the written file, if supported
31+
:type use_compression: bool
32+
33+
:param binary_file_type: Use a binary file type in the written file, if supported
34+
:type binary_file_type: bool
35+
36+
:return: Whether the input could be written. If false, the output mesh is not valid.
37+
:rtype: Any
38+
"""
39+
func = environment_dispatch("itkwasm_mesh_io", "mz3_write_point_set")
40+
output = func(point_set, serialized_point_set, information_only=information_only, use_compression=use_compression, binary_file_type=binary_file_type)
41+
return output
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Generated file. Do not edit.
2+
3+
import os
4+
from typing import Dict, Tuple, Optional, List, Any
5+
6+
from itkwasm import (
7+
environment_dispatch,
8+
PointSet,
9+
BinaryFile,
10+
)
11+
12+
async def mz3_write_point_set_async(
13+
point_set: PointSet,
14+
serialized_point_set: str,
15+
information_only: bool = False,
16+
use_compression: bool = False,
17+
binary_file_type: bool = False,
18+
) -> Tuple[Any]:
19+
"""Write an ITK-Wasm file format converted to a point set file format
20+
21+
:param point_set: Input point set
22+
:type point_set: PointSet
23+
24+
:param serialized_point_set: Output point set
25+
:type serialized_point_set: str
26+
27+
:param information_only: Only write point set metadata -- do not write pixel data.
28+
:type information_only: bool
29+
30+
:param use_compression: Use compression in the written file, if supported
31+
:type use_compression: bool
32+
33+
:param binary_file_type: Use a binary file type in the written file, if supported
34+
:type binary_file_type: bool
35+
36+
:return: Whether the input could be written. If false, the output mesh is not valid.
37+
:rtype: Any
38+
"""
39+
func = environment_dispatch("itkwasm_mesh_io", "mz3_write_point_set_async")
40+
output = await func(point_set, serialized_point_set, information_only=information_only, use_compression=use_compression, binary_file_type=binary_file_type)
41+
return output

packages/mesh-io/python/itkwasm-mesh-io/tests/fixtures.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def input_data():
2323
test_files = [
2424
Path('input') / 'cow.vtk',
2525
Path('input') / 'box-points.obj',
26+
Path('input') / '11ScalarMesh.mz3',
2627
]
2728
data = {}
2829
for f in test_files:

0 commit comments

Comments
 (0)