Skip to main content

Python package to work with webKnossos NML skeleton files

Project description

wknml

PyPI version Supported Python Versions Build Status Documentation Code Style

Python library for working with webKnossos skeleton annotation files (NML).

Installation

wknml requires Python 3.6+

pip install wknml

Documentation

See docs/wknml.md for an API documentation.

Examples

Some examples to get you started. Make sure to also check the examples directory:

# Load an NML file
with open("input.nml", "rb") as f:
    nml = wknml.parse_nml(f)

# Access the most important properties
print(nml.parameters)
print(nml.trees)
print(nml.branchpoints)
print(nml.comments)
print(nml.groups)

# Iterate over all nodes
for tree in nml.trees:
    for node in tree.nodes:
        print(tree, node)

# Write a new NML file to disk
with open("out.nml", "wb") as f:
    wknml.write_nml(f, nml)
# Convert an NML file with unlinked nodes to one with connected trees
python -m examples.fix_unlinked_nml <unlinked>.nml <fixed>.nml

Development

Make sure to install all the required dependencies using Poetry:

pip install poetry
poetry install

Please, format and test your code changes before merging them.

poetry run black wknml tests examples
poetry run pytest tests

PyPi releases are automatically pushed when creating a new Git tag/Github release. Make sure to bump the package version number manually:

poetry version <patch, minor, major>

If necessary, rebuild the documentation and commit to repository:

poetry run pydoc-markdown -m wknml -m wknml.nml_generation -m wknml.nml_utils --render-toc > docs/wknml.md

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wknml-1.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

wknml-1.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file wknml-1.1.0.tar.gz.

File metadata

  • Download URL: wknml-1.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.7.11 Linux/5.8.0-1039-azure

File hashes

Hashes for wknml-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ea4d8d16f2d6abf0b4d6e779e586dae8692ad124b308a463380b86eb63be2e30
MD5 4564e925c8a7fa8df88b6a50c492a82b
BLAKE2b-256 d5b10abba0bafde6d770cbcbdc3ebb5ccf1a0aeebf600173a610f6e8897906a3

See more details on using hashes here.

File details

Details for the file wknml-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: wknml-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.7.11 Linux/5.8.0-1039-azure

File hashes

Hashes for wknml-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af3bf74568a40fb162a37e8c337a1a16d4576f312d6a98545b0644e6ff8f60f4
MD5 bd136f2a9bbee7159e4ae4ef569d1c40
BLAKE2b-256 315180ae9837ee8562aae3d2ecd21145e222090d242c72a9e4b3fe47addd9282

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page