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()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ulmtools-0.2.0.tar.gz (89.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ulmtools-0.2.0-cp37-abi3-win_amd64.whl (397.8 kB view details)

Uploaded CPython 3.7+Windows x86-64

ulmtools-0.2.0-cp37-abi3-manylinux_2_34_x86_64.whl (569.8 kB view details)

Uploaded CPython 3.7+manylinux: glibc 2.34+ x86-64

ulmtools-0.2.0-cp37-abi3-macosx_11_0_arm64.whl (488.8 kB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ulmtools-0.2.0.tar.gz
  • Upload date:
  • Size: 89.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ulmtools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 45be270b7bc0b05f6c7e3e662e72f1580b5a302f2499026192c39d4fce42a089
MD5 c5caa18ed953085f9dbc14ec46d0ea2c
BLAKE2b-256 09f82c8914bf3efa2ee9f659e6f46a02e5df9574872d0a586529fa6b93639ec8

See more details on using hashes here.

File details

Details for the file ulmtools-0.2.0-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: ulmtools-0.2.0-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 397.8 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ulmtools-0.2.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 778d75019e601d24a5402ee1ee7278aebc5910f23c50248dcb32b1de7b7b8899
MD5 72e4f0f8e2c2e89b4b2d772f0016619c
BLAKE2b-256 06487d6c5ea16a8948b5b216bc0acb06e4b5e6bd54e534a05fdcf493920b4f33

See more details on using hashes here.

File details

Details for the file ulmtools-0.2.0-cp37-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ulmtools-0.2.0-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 89ec728909ca4de6fcbc84cd04dd8394a3f887eff9522f59d840110fe15a3167
MD5 4ca5f2f054a5b0a95c37ca853c59ed6b
BLAKE2b-256 d18506d511d07f144a26ad0c9a884b05c8992e87aa8c16ffbc44c58cfc7d8f5c

See more details on using hashes here.

File details

Details for the file ulmtools-0.2.0-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ulmtools-0.2.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0eda2c07c21c0be7cc33db2c292937bfd98476e107e14d2091ab07762e312810
MD5 7bb73ac321784c8f8233a2338481c9cc
BLAKE2b-256 f7d94575414d7aec8dd1b519d1665fcfa6242ba333fb1993dddcde6c18c3ba3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page