Skip to main content

Object-oriented linear and nonlinear coordinate system transforms, plus coordinate system graphs.

Project description

Coorx

Coorx implements object-oriented linear and nonlinear coordinate system transforms. Optionally, coorx also keeps track of a graph of coordinate systems (such as a scene graph) that are connected by transforms, allowing automatic mapping between coordinate systems.

Tests PyPI version

  • A collection of different types of coordinate system transform classes with unit test coverage
  • Easy methods for mapping coordinate data through these transforms
  • Transform composition and simplification
  • Transforms intelligently map data types including numpy arrays, lists, etc.
  • Automatic generation of composite transforms from a coordinate system graph
  • Coordinate arrays that know which coordinate system they live in to handle automatic mapping
  • Using named coordinate systems, coorx warns you wnen you try to map data through the wrong transform
  • Automatic conversion of (some) transforms between ITK, Qt, scikit-image, and vispy

Installation

To install the package from PyPI, use the following command:

pip install coorx

Usage

Scale and translate 2D coordinates:

import numpy as np
from coorx import STTransform

coords = np.array([
    [ 0,  0],
    [ 1,  2],
    [20, 21],
])

tr = STTransform(scale=(10, 1), offset=(5, 5))

print(tr.map(coords))

Compose multiple transforms together:

import numpy as np
from coorx import STTransform, AffineTransform, CompositeTransform

coords = np.array([
    [0, 0, 0],
    [1, 2, 3],
    [-10, -200, -3000],
])

tr1 = STTransform(scale=(1, 10, 100))

tr2 = AffineTransform(dims=3)
tr2.rotate(90, axis=(0, 0, 1))

tr3 = CompositeTransform([tr2, tr1])

print(tr3.map(coords))

Todo

  • import bilinear, SRT transforms from pyqtgraph
  • import coordinate system graph handling from vispy
  • make coordinate system dimensionality explicit
  • unit tests against ITK output

Credit

Coorx is adapted from code originally written for VisPy (vispy.org), inspired by the nice transform classes in ITK, and maintained by the Allen Institute for Brain Science.

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

coorx-2.0.0.tar.gz (52.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coorx-2.0.0-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file coorx-2.0.0.tar.gz.

File metadata

  • Download URL: coorx-2.0.0.tar.gz
  • Upload date:
  • Size: 52.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for coorx-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5f8eb707a0ef34b34fe5ea5dfc6858f9f18496f663d8687305618d28b18d8f64
MD5 f0392439304c43cd71a2f4a2c4addc6a
BLAKE2b-256 d31524c3fc942320ab40b1effd838a7a62a0ced8e5c648ccbe9e8397eb6fb003

See more details on using hashes here.

File details

Details for the file coorx-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: coorx-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for coorx-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b942e3f6a4b9d3f4b9ee5e0a2b29220c34269b8bb346f9c0e44234f12f0c222
MD5 ae50a5320a321fe9f993b64ca7dbf154
BLAKE2b-256 db3b3490845d298daa3b5459b9de88f0fec92646adafcfcff82bb1f0a04ba142

See more details on using hashes here.

Supported by

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