Skip to main content

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: Open In Colab A quickstart guide to using py_distance_transforms for efficient distance transform operations on arrays.
Deep Learning (Hausdorff Loss): Open In Colab 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_2d
import numpy as np

arr = np.random.choice([0, 1], size=(10, 10)).astype(np.float32)
result = transform_2d(arr)

GPU Acceleration

import torch
from py_distance_transforms import transform_gpu_2d

x_gpu = torch.rand((100, 100), device='cuda')
x_gpu = (x_gpu > 0.5).float()

gpu_transformed = transform_gpu_2d(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.0.tar.gz (388.2 kB view details)

Uploaded Source

Built Distribution

py_distance_transforms-0.2.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file py_distance_transforms-0.2.0.tar.gz.

File metadata

File hashes

Hashes for py_distance_transforms-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ac1c30832674a2318e5cec2467276f96e251eba8c61b8141462441a3383bef6d
MD5 2ef5a7e10830ed673d5e437b6129bd70
BLAKE2b-256 f7fd26c7be33f0132dea5e1fd1071056a1ebf333ee97f025b1cecca55ebdce6e

See more details on using hashes here.

File details

Details for the file py_distance_transforms-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for py_distance_transforms-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9e13f9dcafbf6ccaa493272051be9e7828ca0ea418b5595e357b0ee1baeca21
MD5 ed847fb92fd56788c01a1d5571d33f4b
BLAKE2b-256 fe78d17b769d5c5e87193cdfca7b201a26a28bb3d04551b80d5738f5ea5578ec

See more details on using hashes here.

Supported by

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