Add your description here
Project description
py-distance-transforms
py_distance_transforms
is a Python package that provides efficient distance transform operations on arrays. It is a wrapper around the Julia package DistanceTransforms.jl, bringing its high-performance capabilities to the Python ecosystem.
Documentation
Docs | Description |
---|---|
Getting Started: | A quickstart guide to using py_distance_transforms for efficient distance transform operations on arrays. |
Deep Learning (Hausdorff Loss): | A MONAI tutorial adjusted to show how to use the Hausdorff loss function and the corresponding py_distance_transforms |
Features
- Fast distance transform computations on CPU and GPU
- Support for 1D, 2D, and 3D arrays
- Multi-threading for enhanced CPU performance
- GPU acceleration for NVIDIA GPUs (CUDA)
- Simple and intuitive API
Installation
Install py_distance_transforms
using pip:
pip install py_distance_transforms
Basic Usage
from py_distance_transforms import transform
import numpy as np
arr = np.random.choice([0, 1], size=(10, 10)).astype(np.float32)
result = transform(arr)
GPU Acceleration
import torch
from py_distance_transforms import transform_cuda
x_gpu = torch.rand((100, 100), device='cuda')
x_gpu = (x_gpu > 0.5).float()
gpu_transformed = transform_cuda(x_gpu)
Acknowledgments
py_distance_transforms
is a Python wrapper around the Julia package DistanceTransforms.jl.- Huge thanks to @pabloferz for getting DLPack.jl to work with PythonCall/juliacall and PyTorch. Massive thanks to @cjdoris and all of the contributors to PythonCall.jl as well.
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
py_distance_transforms-0.2.3.tar.gz
(397.4 kB
view details)
File details
Details for the file py_distance_transforms-0.2.3.tar.gz
.
File metadata
- Download URL: py_distance_transforms-0.2.3.tar.gz
- Upload date:
- Size: 397.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d0d96051a876d3e96e95cf19258fb3d165261c5f1ec3ae1aed63be3ec51723b |
|
MD5 | ff068fea10792c9a436defae52ad873e |
|
BLAKE2b-256 | 8e0f2c933f102076974241deb873e98bce7c36407cd34e92beb088aa1d7b8dc0 |