Skip to content

Commit

Permalink
feat(mesh-io): add python package bindgen output
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Nov 29, 2023
1 parent 5d181f7 commit 4b96715
Show file tree
Hide file tree
Showing 56 changed files with 1,887 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/mesh-io/python/itkwasm-mesh-io/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# itkwasm-mesh-io

[![PyPI version](https://badge.fury.io/py/itkwasm-mesh-io.svg)](https://badge.fury.io/py/itkwasm-mesh-io)

Input and output for scientific and medical image file formats.

## Installation

```sh
pip install itkwasm-mesh-io
```
20 changes: 20 additions & 0 deletions packages/mesh-io/python/itkwasm-mesh-io/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions packages/mesh-io/python/itkwasm-mesh-io/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

from datetime import date

project = 'itkwasm-mesh-io'
copyright = f'{date.today().year}, NumFOCUS'
author = 'Insight Software Consortium'

extensions = [
'sphinx.ext.autosummary',
'autodoc2',
'myst_parser',
'sphinx.ext.intersphinx',
'sphinx_copybutton',
'sphinxext.opengraph',
'sphinx_design',
]

myst_enable_extensions = ["colon_fence", "fieldlist"]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

autodoc2_packages = [
{
"path": "../itkwasm_mesh_io",
"exclude_files": ["_version.py"],
},
]
autodoc2_render_plugin = "myst"

intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable", None),
"itkwasm": ("https://itkwasm.readthedocs.io/en/latest/", None),
}

html_theme = 'furo'
html_static_path = ['_static']
html_logo = "_static/logo.svg"
html_favicon = "_static/favicon.png"
html_title = f"{project}"

# Furo options
html_theme_options = {
"top_of_page_button": "edit",
"source_repository": "https://github.com/InsightSoftwareConsortium/itk-wasm",
"source_branch": "main",
"source_directory": "docs",
}
35 changes: 35 additions & 0 deletions packages/mesh-io/python/itkwasm-mesh-io/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
itkwasm-mesh-io
=======

> Input and output for scientific and medical image file formats.
[![itkwasm-mesh-io version](https://badge.fury.io/py/itkwasm_mesh_io.svg)](https://pypi.org/project/itkwasm_mesh_io/)

## Installation

::::{tab-set}

:::{tab-item} System
```shell
pip install itkwasm-mesh-io
```
:::

:::{tab-item} Browser
In Pyodide, e.g. the [Pyodide REPL](https://pyodide.org/en/stable/console.html) or [JupyterLite](https://jupyterlite.readthedocs.io/en/latest/try/lab),

```python
import micropip
await micropip.install('itkwasm-mesh-io')
:::

::::

```{toctree}
:hidden:
:maxdepth: 3
:caption: 📖 Reference

apidocs/index.rst
itkwasm docs <https://itkwasm.readthedocs.io/>
```
35 changes: 35 additions & 0 deletions packages/mesh-io/python/itkwasm-mesh-io/docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
8 changes: 8 additions & 0 deletions packages/mesh-io/python/itkwasm-mesh-io/docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
astroid<3
sphinx
furo
sphinx-autodoc2
myst-parser
sphinx-copybutton
sphinxext-opengraph
sphinx-design
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Generated file. To retain edits, remove this comment.

"""itkwasm-mesh-io: Input and output for scientific and medical image file formats."""

from .byu_read_mesh_async import byu_read_mesh_async
from .byu_read_mesh import byu_read_mesh
from .byu_write_mesh_async import byu_write_mesh_async
from .byu_write_mesh import byu_write_mesh
from .free_surfer_ascii_read_mesh_async import free_surfer_ascii_read_mesh_async
from .free_surfer_ascii_read_mesh import free_surfer_ascii_read_mesh
from .free_surfer_ascii_write_mesh_async import free_surfer_ascii_write_mesh_async
from .free_surfer_ascii_write_mesh import free_surfer_ascii_write_mesh
from .free_surfer_binary_read_mesh_async import free_surfer_binary_read_mesh_async
from .free_surfer_binary_read_mesh import free_surfer_binary_read_mesh
from .free_surfer_binary_write_mesh_async import free_surfer_binary_write_mesh_async
from .free_surfer_binary_write_mesh import free_surfer_binary_write_mesh
from .obj_read_mesh_async import obj_read_mesh_async
from .obj_read_mesh import obj_read_mesh
from .obj_write_mesh_async import obj_write_mesh_async
from .obj_write_mesh import obj_write_mesh
from .off_read_mesh_async import off_read_mesh_async
from .off_read_mesh import off_read_mesh
from .off_write_mesh_async import off_write_mesh_async
from .off_write_mesh import off_write_mesh
from .stl_read_mesh_async import stl_read_mesh_async
from .stl_read_mesh import stl_read_mesh
from .stl_write_mesh_async import stl_write_mesh_async
from .stl_write_mesh import stl_write_mesh
from .swc_read_mesh_async import swc_read_mesh_async
from .swc_read_mesh import swc_read_mesh
from .swc_write_mesh_async import swc_write_mesh_async
from .swc_write_mesh import swc_write_mesh
from .vtk_poly_data_read_mesh_async import vtk_poly_data_read_mesh_async
from .vtk_poly_data_read_mesh import vtk_poly_data_read_mesh
from .vtk_poly_data_write_mesh_async import vtk_poly_data_write_mesh_async
from .vtk_poly_data_write_mesh import vtk_poly_data_write_mesh
from .wasm_read_mesh_async import wasm_read_mesh_async
from .wasm_read_mesh import wasm_read_mesh
from .wasm_write_mesh_async import wasm_write_mesh_async
from .wasm_write_mesh import wasm_write_mesh
from .wasm_zstd_read_mesh_async import wasm_zstd_read_mesh_async
from .wasm_zstd_read_mesh import wasm_zstd_read_mesh
from .wasm_zstd_write_mesh_async import wasm_zstd_write_mesh_async
from .wasm_zstd_write_mesh import wasm_zstd_write_mesh

from ._version import __version__
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated file. Do not edit.

import os
from typing import Dict, Tuple, Optional, List, Any

from itkwasm import (
environment_dispatch,
BinaryFile,
Mesh,
)

def byu_read_mesh(
serialized_mesh: os.PathLike,
information_only: bool = False,
) -> Tuple[Any, Mesh]:
"""Read a mesh file format and convert it to the itk-wasm file format
:param serialized_mesh: Input mesh serialized in the file format
:type serialized_mesh: os.PathLike
:param information_only: Only read image metadata -- do not read pixel data.
:type information_only: bool
:return: Whether the input could be read. If false, the output mesh is not valid.
:rtype: Any
:return: Output mesh
:rtype: Mesh
"""
func = environment_dispatch("itkwasm_mesh_io", "byu_read_mesh")
output = func(serialized_mesh, information_only=information_only)
return output
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated file. Do not edit.

import os
from typing import Dict, Tuple, Optional, List, Any

from itkwasm import (
environment_dispatch,
BinaryFile,
Mesh,
)

async def byu_read_mesh_async(
serialized_mesh: os.PathLike,
information_only: bool = False,
) -> Tuple[Any, Mesh]:
"""Read a mesh file format and convert it to the itk-wasm file format
:param serialized_mesh: Input mesh serialized in the file format
:type serialized_mesh: os.PathLike
:param information_only: Only read image metadata -- do not read pixel data.
:type information_only: bool
:return: Whether the input could be read. If false, the output mesh is not valid.
:rtype: Any
:return: Output mesh
:rtype: Mesh
"""
func = environment_dispatch("itkwasm_mesh_io", "byu_read_mesh_async")
output = await func(serialized_mesh, information_only=information_only)
return output
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated file. Do not edit.

import os
from typing import Dict, Tuple, Optional, List, Any

from itkwasm import (
environment_dispatch,
Mesh,
BinaryFile,
)

def byu_write_mesh(
mesh: Mesh,
serialized_mesh: str,
information_only: bool = False,
use_compression: bool = False,
binary_file_type: bool = False,
) -> Tuple[Any]:
"""Write an itk-wasm file format converted to an mesh file format
:param mesh: Input mesh
:type mesh: Mesh
:param serialized_mesh: Output mesh
:type serialized_mesh: str
:param information_only: Only write image metadata -- do not write pixel data.
:type information_only: bool
:param use_compression: Use compression in the written file, if supported
:type use_compression: bool
:param binary_file_type: Use a binary file type in the written file, if supported
:type binary_file_type: bool
:return: Whether the input could be written. If false, the output mesh is not valid.
:rtype: Any
"""
func = environment_dispatch("itkwasm_mesh_io", "byu_write_mesh")
output = func(mesh, serialized_mesh, information_only=information_only, use_compression=use_compression, binary_file_type=binary_file_type)
return output
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated file. Do not edit.

import os
from typing import Dict, Tuple, Optional, List, Any

from itkwasm import (
environment_dispatch,
Mesh,
BinaryFile,
)

async def byu_write_mesh_async(
mesh: Mesh,
serialized_mesh: str,
information_only: bool = False,
use_compression: bool = False,
binary_file_type: bool = False,
) -> Tuple[Any]:
"""Write an itk-wasm file format converted to an mesh file format
:param mesh: Input mesh
:type mesh: Mesh
:param serialized_mesh: Output mesh
:type serialized_mesh: str
:param information_only: Only write image metadata -- do not write pixel data.
:type information_only: bool
:param use_compression: Use compression in the written file, if supported
:type use_compression: bool
:param binary_file_type: Use a binary file type in the written file, if supported
:type binary_file_type: bool
:return: Whether the input could be written. If false, the output mesh is not valid.
:rtype: Any
"""
func = environment_dispatch("itkwasm_mesh_io", "byu_write_mesh_async")
output = await func(mesh, serialized_mesh, information_only=information_only, use_compression=use_compression, binary_file_type=binary_file_type)
return output
Loading

0 comments on commit 4b96715

Please sign in to comment.