Skip to main content

Object-oriented coordinate system transforms in pure Python

Project description

Coorx

Object-oriented linear and nonlinear coordinate system transforms.

  • 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.

Wishlist:

  • Automatic generation of composite transforms from a coordinate system graph
  • Coordinate arrays that know which coordinate system they live in to handle automatic mapping
  • Conversion of transforms between ITK, Qt, scikit-image, vispy, etc.
  • Numba, cuda optimization

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-1.0.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

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

coorx-1.0.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coorx-1.0.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for coorx-1.0.0.tar.gz
Algorithm Hash digest
SHA256 29b90d569e9b08c3854004ca93b3b0279bc9a72f8c028e5f9c386e8ce67a278e
MD5 22d475f41ef47b5ea9ba6daee9728b36
BLAKE2b-256 b63280d374b100714b6c99462c6d7bd6434762866bdb6545cca8f4ee5ae9f17b

See more details on using hashes here.

Provenance

The following attestation bundles were made for coorx-1.0.0.tar.gz:

Publisher: deploy.yml on campagnola/coorx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: coorx-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for coorx-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20da9a2f7d5fb734d367acd078b8bfa057d72451778b73eb7c1330d433587c6a
MD5 a80cff0622e5dcf3da5d1b0cb6177207
BLAKE2b-256 b619a286fc2ba81a6ba763b6ce61152aca89c0c26bbb3f92153faceea419b14f

See more details on using hashes here.

Provenance

The following attestation bundles were made for coorx-1.0.0-py3-none-any.whl:

Publisher: deploy.yml on campagnola/coorx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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