Shape analysis in python
Project description
To know more about scikit-shapes, check out the documentation and the gallery of examples
Scikit-Shapes
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
orMultiscaling
. 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 requirement_docs.txt
sphinx-apidoc -o doc/source/api/ --module-first --force src/skshapes
sphinx-build -b html doc/source/ doc/_build/html
cd doc/_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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file skshapes-0.2.tar.gz
.
File metadata
- Download URL: skshapes-0.2.tar.gz
- Upload date:
- Size: 100.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f24a4447280ca043e4965059fb168e9f5c3953cf038ac31d8268e60d53477f54 |
|
MD5 | ac23785b63d4515a4ebd16ca4e83315a |
|
BLAKE2b-256 | 3be0fc5b8d0edb4b23d4eebeb0b0681bf7038a97c2734d59edd5b3523ff6d43e |
File details
Details for the file skshapes-0.2-py3-none-any.whl
.
File metadata
- Download URL: skshapes-0.2-py3-none-any.whl
- Upload date:
- Size: 92.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96d2dfc955bd74c9a34843c79b07af7c85409b179519244558ff53675494b0e8 |
|
MD5 | d821a43ca30202b30400221fde27eec0 |
|
BLAKE2b-256 | f69414c76b5398436b6b4b9fc6e9e82c6dbf06a621029bde39bee76110f958ed |