DistanceTransforms.jl
Fast, gpu-accelerated distance transforms
Install / Use
/learn @MolloiLab/DistanceTransforms.jlREADME
DistanceTransforms
DistanceTransforms.jl is a Julia package that provides efficient distance transform operations on arrays (CPU & GPU).
Installation
using Pkg
Pkg.add("DistanceTransforms")
Quick Start
using DistanceTransforms
# Create a simple binary array
arr = [
0 1 1 0
0 0 0 0
1 1 0 0
]
# Apply distance transform
result = transform(boolean_indicator(arr))
Features
- Fast CPU implementation using the Felzenszwalb algorithm
- Multi-threading support for enhanced CPU performance
- GPU acceleration for NVIDIA (CUDA), AMD (ROCm), and Apple (Metal)
- Simple API with unified transform interface
- Multi-dimensional support for 1D, 2D, and 3D arrays
Advanced Usage
Multi-threading
# Compare single vs multi-threaded performance
result = transform(arr; threaded = true) # default
result = transform(arr; threaded = false) # single-threaded
GPU Acceleration
using CUDA
# Automatically uses GPU implementation for CUDA arrays
x_gpu = CUDA.CuArray(boolean_indicator(rand([0, 1], 100, 100)))
gpu_result = transform(x_gpu)
Python Support
For Python users, check out distance_transforms, a Python wrapper providing the same functionality.
import numpy as np
import distance_transforms as dts
arr = np.random.choice([0, 1], size=(10, 10)).astype(np.float32)
result = dts.transform(arr)
Citation
If you use DistanceTransforms in your research, please cite:
@ARTICLE{10912438,
author={Black, Dale and Li, Wenbo and Zhang, Qiyu and Molloi, Sabee},
journal={IEEE Access},
title={Accelerating Euclidean Distance Transforms: A Fast and Flexible Approach with Multi-Vendor GPU, Multi-Threading, and Multi-Language Support},
year={2025},
volume={},
number={},
pages={1-1},
keywords={Transforms;Graphics processing units;Benchmark testing;Euclidean distance;Three-dimensional displays;Image segmentation;Hardware;Python;Metals;Arrays;Distance Transform;Hardware Acceleration;Hausdorff Distance;High Performance Computing;Image Processing;Medical Image Analysis;Parallel Computing;Segmentation;Skeletonization},
doi={10.1109/ACCESS.2025.3548563}}
Documentation
For comprehensive documentation and examples, visit our documentation site.
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
