Skip to main content

Solves eikonal function on instance maps.

Project description

Python Instance Eikonal Function Solver (PIEFS)

PIEFS is a library which solves the Eikonal Function for 2D and 3D instance masks, using the Fast Iterative Method. It achieves memory efficiency through a fused kernel written in OpenAI Triton. It also provides functionality to calculate gradients of the eikonal field.

This implementation uses convolutions to calculate affinity masks, which may be faster and can occur on cuda, however uses dense representations of the affinity masks and therefore is memory intensive. It may be possible for much of the mask operations to occur with sparse tensors for memory efficiency.

A big thanks to Kevin Cutler (Original Omnipose Author) for helping me create this.

Example:

import torch
from piefs import solve_eikonal, gradient_from_eikonal

image = torch.load('path/to/my/image.pt')  # An image with shape (B, C=1, X, Y, Z)
eikonal = solve_eikonal(image, eps=1e-5, min_steps=200, use_triton=True)  # A Distance map with shape (B, C=1, X, Y, Z)
gradients = gradient_from_eikonal(eikonal)  # A Gradient tensor with shape (B, C=3, X, Y, Z)

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

PIEFS-0.0.1.tar.gz (21.2 kB view hashes)

Uploaded Source

Built Distributions

piefs-0.0.1-py3-none-any.whl (22.3 kB view hashes)

Uploaded Python 3

PIEFS-0.0.1-py3-none-any.whl (22.3 kB view hashes)

Uploaded Python 3

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