Skip to main content

Read and write the annotation files from Halo

Project description

Mypy Black Pytest Docs

PyHaloXML

Python code to read/write .annotation files from Halo. Can export as .geojson for further analysis.

Examples

Example 1 : Move rectangles to a different layer and save as .annotation.

Example 2 : Check if annotations have holes in them and save as .geojson.

Example 3 : Show the wkt representation of the shapely polygon.

Example 4 : Create a .annotation file from coordinates.

Installation

pip install pyhaloxml

Note on version 3

The matching of negative to positive regions now needs to be done by the user after loading the data. The examples have been updated. This needed to happen because negative regions can be unmatched in Halo. This would cause errors when loading.

Loading speed

Rust is used to match the negative regions to positive regions, thanks to Wim Pomp!

It takes 41 seconds to load a 30.9MB file with 856454 vertices in 5769 regions with 731 holes.

Development

  • Install Rust
  • Clone the repository
  • pip install -e .

Notes on development

  • The xml is relatively simple. There are Annotations and an annotation contains regions.
  • Regions can be either positive or negative. However regions in an annotation are not hierarchical. So there is no telling what negative region should go with what positive region.
  • This package expects a negative region to be fully enclosed by one positive region. The matching is done by taking a single point that is inside or on the border of the negative region and checking if it is inside a positive region.

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

pyhaloxml-3.0.2.tar.gz (851.2 kB view hashes)

Uploaded Source

Built Distributions

pyhaloxml-3.0.2-cp310-abi3-win_amd64.whl (125.8 kB view hashes)

Uploaded CPython 3.10+ Windows x86-64

pyhaloxml-3.0.2-cp310-abi3-win32.whl (123.8 kB view hashes)

Uploaded CPython 3.10+ Windows x86

pyhaloxml-3.0.2-cp310-abi3-musllinux_1_1_x86_64.whl (286.6 kB view hashes)

Uploaded CPython 3.10+ musllinux: musl 1.1+ x86-64

pyhaloxml-3.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (254.3 kB view hashes)

Uploaded CPython 3.10+ manylinux: glibc 2.17+ x86-64

pyhaloxml-3.0.2-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (271.9 kB view hashes)

Uploaded CPython 3.10+ manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

pyhaloxml-3.0.2-cp310-abi3-macosx_10_12_x86_64.whl (235.7 kB view hashes)

Uploaded CPython 3.10+ macOS 10.12+ x86-64

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