Skip to main content

Shape analysis in python

Project description

To know more about scikit-shapes, check out the documentation and the gallery of examples

Scikit-Shapes

codecov

Shape processing in Python

Presentation

Scikit-shapes is a python package for the analysis of 2D and 3D shape data. It gathers tools for:

  • Compute features for shapes such as curvature
  • Preprocess shapes with downscaling or landmarks setting
  • Register shapes with or without landmarks
  • Population Analysis : distance matrices

Philosophy

Scikit-shapes is thinked to be intuitive and user-friendly, our am is to provide a library that is

  • Task-oriented: basic objects are high-level tasks, such as Registration or Multiscaling. The mathematical details as loss function, deformation model, are defined as hyperparameters.
  • Modular: workflows can be designed following a plug-and-play approach, allowing comparison across different methods for the same task. In addition, it is possible to implement new modules such as deformation model or loss function and integrate them in existing pipelines.
  • Efficient: skshapes relies mostly on pyTorch and pyKeOps for computations. It allows to speed-up numerical intensive part of the analysis with parallelization on CPU or GPU.

Here is a code snippet illustrating how a registration model is build by combining a loss function and a deformation model:

import skshapes as sks

shape1 = sks.read("data/shape1.vtk")
shape2 = sks.read("data/shape2.vtk")

registration = sks.Registration(
    model=sks.ExtrinsicDeformation(n_steps=5, kernel="gaussian", blur=0.5),
    loss=sks.NearestNeighborLoss(),
    gpu=True,
)

registration.fit(source=shape1, target=shape2)
transformed_shape = registration.transform(source=shape1)

Connection to other open-source projects

Scikit-shapes relies on other open-source software, our main dependencies are :

  • PyTorch and KeOps : skshapes uses pytorch tensors as basic array structure and take benefits of the pytorch ecosystem to let the possibility to accelerate computations on GPU.
  • PyVista and Vedo : skshapes relies on PyVista for data loading and visualization, and on vedo for creating interactive visualization. Skshapes objects are exportable to vedo or pyvista through .to_vedo() and .to_pyvista() methods.
  • Jaxtyping and Beartype : scikit-shapes is a runtime type checked library. Types are documented with annotations and error are raised if a function is called with a wrong argument's type. This prevents silent errors due to common mistakes such as bad numerical type. Our runtime type checking engine is build around Beartype and annotations for numerical arrays are based on Jaxtyping.

Installation

At the moment, scikit-shapes is available on linux and macOS only

From pip

The last stable version of scikit-shapes version can be installed directly from pip with

pip install skshapes

From source

If you want the development version or consider contributing to the codebase, you can also install scikit-shapes locally from a clone of the repository. On a terminal, navigate to the scikit-shapes directory and run :

pip install -e .

Then you can :

  • run the pre-commit hooks:
pip install -r requirements_dev.txt
pre-commit install
pre-commit run --all-files
  • run the tests:
pip install -r requirements_dev.txt
pytest
  • build the documentation (and serve it locally)
pip install -r requirements_docs.txt
cd doc/source/
make clean
make html
cd ../_build/html
python -m http.server

Contributing

We warmly welcome all contribution, if you found a bug, a typo or want to contribute with a new feature, please open an issue.

You can also open a discussion if you have any question regarding the project.

For more information about contributing with new code, see the dedicated section of the documentation.

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

skshapes-0.3.tar.gz (122.2 kB view details)

Uploaded Source

Built Distribution

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

skshapes-0.3-py3-none-any.whl (117.7 kB view details)

Uploaded Python 3

File details

Details for the file skshapes-0.3.tar.gz.

File metadata

  • Download URL: skshapes-0.3.tar.gz
  • Upload date:
  • Size: 122.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for skshapes-0.3.tar.gz
Algorithm Hash digest
SHA256 8c0dcae261cc3b2143cbe27c50325376e9d42ba4955f96c690238a0f638dc6ab
MD5 34869b45f59648a1aa7591f5e3e7a3e7
BLAKE2b-256 5480a31346d85a0d5af0757a072e70681abe29451ba0daf048d45fa528c21256

See more details on using hashes here.

Provenance

The following attestation bundles were made for skshapes-0.3.tar.gz:

Publisher: wheels.yml on scikit-shapes/scikit-shapes

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

File details

Details for the file skshapes-0.3-py3-none-any.whl.

File metadata

  • Download URL: skshapes-0.3-py3-none-any.whl
  • Upload date:
  • Size: 117.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for skshapes-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cda53ece20ad96bbcac5f0d1d805dae44d1a14e51f1d1d76d56c5aedfa939d7d
MD5 c2fa54aa88f0abe518625b883708fd51
BLAKE2b-256 02c3acf74478d87838ebb1795fe268605541141e4ee21688eb9a872ec66ec37d

See more details on using hashes here.

Provenance

The following attestation bundles were made for skshapes-0.3-py3-none-any.whl:

Publisher: wheels.yml on scikit-shapes/scikit-shapes

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