Skip to main content

kneemesh

PyPI Coverage Docs

Generate B-rep geometry of knee structures from a segmentation LabelMap, and mesh it with high-quality elements. The meniscus is supported now; lateral and medial tibial, femoral, and patellar cartilage and the bones are planned. For the meniscus:

  • B-rep from segmentation labels. Reads a LabelMap (.nii, .nrrd, or .mhd), fits a centerline through the labeled meniscus, slices its smoothed surface into cross-section contours, and lofts them into a solid B-spline B-rep (.brep) with planar or smooth end caps.
  • Tetrahedral meshing with linear 4-node or quadratic 10-node tetrahedra.
  • Hexahedral meshing with block-structured 8-node, 20-node, or 27-node hexahedra. The solid is split into a butterfly (O-grid) of five blocks, so elements stay well shaped at the meniscus's sharp corners.

Meshes are written in any format gmsh infers from the file extension, such as .msh, .vtk, or .inp.

Documentation: https://comporthobiomech.github.io/kneemesh/

Installation

pip install kneemesh

Usage

Two command-line pipelines take the structure as their first argument, then a JSON configuration, --option value overrides, or both. Run kneemesh-brep meniscus --help to list every option and its default.

kneemesh-brep meniscus --label-map knee.nii --output meniscus.brep --cap planar
kneemesh-mesh meniscus --brep meniscus.brep --output meniscus.msh --max-size 1.0

Each run saves the configuration it used, so it can be repeated with --config. Without --config it is saved as settings<timestamp>.json in the working directory. With --config and overrides, the changed configuration is saved beside the original as <name>_modified.json.

Element types

Elements B-rep options Mesh options
4-node tetrahedra --element tetrahedral (the default)
10-node tetrahedra --element tetrahedral --element-order 2
8-node hexahedra --hex-blocks true --points-per-slice 10 --element hexahedral
20-node hexahedra --hex-blocks true --points-per-slice 10 --element hexahedral --element-order 2 --second-order-incomplete true
27-node hexahedra --hex-blocks true --points-per-slice 10 --element hexahedral --element-order 2

Development

Requires uv.

uv sync
uv run pytest

Build the documentation into docs/_build/html:

uv run --group docs sphinx-build -W -b html docs docs/_build/html

License

Licensed under the Apache License 2.0.

Metadata

Release files for kneemesh 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kneemesh 0.1.0
File Size Uploaded Provenance Actions
kneemesh-0.1.0.tar.gz 30.9 kB With provenance Details for kneemesh-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kneemesh 0.1.0
File Interpreter ABI Platform Actions
kneemesh-0.1.0-py3-none-any.whl Python 3 none any Details for kneemesh-0.1.0-py3-none-any.whl

Total release size: 68.5 kB

Release files / kneemesh-0.1.0.tar.gz

Download URL kneemesh-0.1.0.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
89f00fe31afbda1738db213099835595277c32b7a12c3f81fad6b4d8d6231763
BLAKE2b-256 checksum
How to use checksums
4733cc1a5fecfdcb2b73524e2026307ccad51ca94d44f08184223d389e624c57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / kneemesh-0.1.0-py3-none-any.whl

Download URL kneemesh-0.1.0-py3-none-any.whl
Size 37.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9464f9677bce0f8ebfacc9ebb0f2d9396c84d08dec59960a9d8300fc857a9df9
BLAKE2b-256 checksum
How to use checksums
ccc9be139e20741f95619ba3689f2db7a9cc89b0b7400a621c11c91eb8f1f7b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for kneemesh 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kneemesh-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page