Skip to main content

ulmtools

A collection of tools for Ultrasound Localization Microscopy (ULM) implemented in Rust.

Installation

pip install ulmtools

Examples

Detect peaks in a 2D image

import matplotlib.pyplot as plt
import numpy as np
from ulmtools import detect_peaks

np.random.seed(0)
shape = (128, 128)
image = np.zeros(shape)

# Create test input
x_grid, y_grid = np.meshgrid(
    np.linspace(-1, 1, shape[0]), np.linspace(-1, 1, shape[1]), indexing="ij"
)
for n in range(32):
    x = 2 * (np.random.rand() - 0.5)
    y = 2 * (np.random.rand() - 0.5)
    d = np.sqrt((x_grid - x) ** 2 + (y_grid - y) ** 2)
    image += np.exp(-(d**2 / 3e-3))

peaks, intensities = detect_peaks(image)

# Plot results
fig, ax = plt.subplots()
ax.imshow(
    np.abs(image.T),
    cmap="hot",
)
ax.scatter(peaks[:, 0], peaks[:, 1], c="blue", s=2)
plt.show()

Draw tracks on a 2D image

import matplotlib.pyplot as plt
import numpy as np
from ulmtools import draw_tracks

np.random.seed(3)
shape = (128, 128)
extent = (-1, 1, -1, 1)
pixel_size = 1e-2

t = np.linspace(0.05, 1, 300)
matrix = np.stack(
    [np.sin(5 * 2 * np.pi * t) * t, np.cos(5 * 2 * np.pi * t) * t, 1 - t], axis=1
)

image_intensity, image_density, extent = draw_tracks(
    matrix,
    track_end_indices=np.array([matrix.shape[0]]),
    pixel_size=pixel_size,
    extent=extent,
)

fig, ax = plt.subplots()
ax.imshow(
    np.abs(image_density.T),
    cmap="hot",
    interpolation="nearest",
)
plt.show()

Metadata

Release files for ulmtools 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ulmtools 0.2.0
File Size Uploaded
ulmtools-0.2.0.tar.gz 89.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for ulmtools 0.2.0
File Interpreter ABI Platform
ulmtools-0.2.0-cp37-abi3-win_amd64.whl CPython 3.7 abi3 Windows x86-64 Details
ulmtools-0.2.0-cp37-abi3-manylinux_2_34_x86_64.whl CPython 3.7 abi3 Linux glibc 2.34+ x86-64 Details
ulmtools-0.2.0-cp37-abi3-macosx_11_0_arm64.whl CPython 3.7 abi3 macOS 11.0+ ARM64 Details

Total release size: 1.5 MB

Release files / ulmtools-0.2.0.tar.gz

Download URL ulmtools-0.2.0.tar.gz
Size 89.3 kB
Tags Source
SHA-256 checksum
How to use checksums
45be270b7bc0b05f6c7e3e662e72f1580b5a302f2499026192c39d4fce42a089
BLAKE2b-256 checksum
How to use checksums
09f82c8914bf3efa2ee9f659e6f46a02e5df9574872d0a586529fa6b93639ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / ulmtools-0.2.0-cp37-abi3-win_amd64.whl

Download URL ulmtools-0.2.0-cp37-abi3-win_amd64.whl
Size 397.8 kB
Tags CPython 3.7 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
778d75019e601d24a5402ee1ee7278aebc5910f23c50248dcb32b1de7b7b8899
BLAKE2b-256 checksum
How to use checksums
06487d6c5ea16a8948b5b216bc0acb06e4b5e6bd54e534a05fdcf493920b4f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / ulmtools-0.2.0-cp37-abi3-manylinux_2_34_x86_64.whl

Download URL ulmtools-0.2.0-cp37-abi3-manylinux_2_34_x86_64.whl
Size 569.8 kB
Tags CPython 3.7 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
89ec728909ca4de6fcbc84cd04dd8394a3f887eff9522f59d840110fe15a3167
BLAKE2b-256 checksum
How to use checksums
d18506d511d07f144a26ad0c9a884b05c8992e87aa8c16ffbc44c58cfc7d8f5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / ulmtools-0.2.0-cp37-abi3-macosx_11_0_arm64.whl

Download URL ulmtools-0.2.0-cp37-abi3-macosx_11_0_arm64.whl
Size 488.8 kB
Tags CPython 3.7 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0eda2c07c21c0be7cc33db2c292937bfd98476e107e14d2091ab07762e312810
BLAKE2b-256 checksum
How to use checksums
f7d94575414d7aec8dd1b519d1665fcfa6242ba333fb1993dddcde6c18c3ba3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.2.0 This release

4 release files

0.1.1

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page