Skip to main content

Ultrasound toolbox for GPU

Project description

What is ultraspy?

Ultraspy is a package designed to efficiently manipulate ultrasound data using GPU. The most common beamforming or Doppler methods are implemented (such as DAS, RF to I/Qs, Color/Power Doppler, ...), along with some state-of-the-art methods (Capon beamforming, Vector Doppler, alias-free Doppler velocity, ...). A set of metrics (PSL, FWHM, SNR) is also provided so anyone can validate the quality of their ultrasound data and beamforming operations.

The package is designed to work with both RF and I/Q signals, in 2D or 3D, and with any type of probe (linear, convex, or matrix). The core code can run both on CPU and GPU, making it ideal for any real-time application. All beamforming parameters (f-number, compounding, apodization…) can be freely customized at any time for research purposes.

The package has been thought to be as flexible as possible, so that anyone could eventually clone it and add its own research methods and test it in real time. A set of tutorials is provided to facilitate user learning and adoption, along with some instruction on how to contribute to the lib if you feel like your research method should be added to help the community.

Features

  • General beamforming methods, flexible to Radio-Frequency or In-phase Quadrature data, working on CPU and GPU. Mainly DAS and FDMAS for the plane-wave imaging, but also TFM for Beam Focusing imaging

  • Advanced beamforming methods (p-DAS or Capon), with a dedicated tutorial to understand how these are implemented and how to implement your own methods

  • Basic Doppler methods (Color and Power maps), and their dedicated utilities functions (matched filtering, RF to I/Qs conversion)

  • Advanced Doppler methods, such as a proposition for alias-free alias-free Doppler velocities (using dual-wavelength method). This still lacks of methods, and should include Vector Doppler or so in future releases

  • Basic metrics for evaluation of the data quality (SNR), or of our beamforming algorithms (FWHM, PSL, CNR)

Documentation

Full documentation can be found in the 'docs' folder, and is also available at https://ultraspy.readthedocs.io/en/latest. You will find there all the detailed information about how to install ultraspy and how to use it.

Installation

Installation can be easily done using pypi:

.. code-block:: console

$ pip install ultraspy

Also, if you want to run it on GPU, you need to install the proper version of cupy based on your CUDA version:

.. code-block:: console

$ pip install cupy-cudaXXx

Development (virtual environment)

For local development and tests, use a virtual environment so dependencies are isolated (recommended on Linux distributions that mark the system Python as externally managed).

.. code-block:: console

$ cd ultraspy
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -U pip
$ pip install -r requirements_cpu.txt
$ pip install -e .

For GPU tests, install CuPy after activating the venv (pick the wheel that matches your CUDA version; the project’s requirements_gpu.txt uses the CUDA 12.x line):

.. code-block:: console

$ pip install -r requirements_gpu.txt

Run tests with pytest (or tox, which creates its own envs), for example:

.. code-block:: console

$ PYTHONPATH=src pytest tests/test_cpu
$ PYTHONPATH=src pytest tests/test_gpu

The repository includes editor settings so Cursor / VS Code prefer .venv/bin/python once the venv exists.

GitLab CI runner setup (Ubuntu 24.04)

This repository now includes a .gitlab-ci.yml with:

  • cpu_tests_py312 / cpu_tests_py311 / cpu_tests_py310: CPU tests on the matching python:X.Y image
  • docs: Sphinx docs build with warnings as errors
  • gpu_tests_py312: optional GPU suite, enabled only when RUN_GPU_TESTS=1

To register a project runner on Ubuntu 24.04:

.. code-block:: console

$ curl -L --output gitlab-runner.deb https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb
$ sudo dpkg -i gitlab-runner.deb
$ sudo gitlab-runner register

Use these registration values:

  • URL: your GitLab instance URL (for gitlab.com: https://gitlab.com)
  • Token: project/group runner token from GitLab UI
  • Executor: shell (recommended for CUDA/GPU host access)
  • Tags: gpu for GPU runner, or no tag for generic CPU runner

GPU job notes:

  • Ensure python3.12 is installed on the runner host.
  • Ensure NVIDIA driver/CUDA are available to the runner user.
  • In project CI/CD variables, set RUN_GPU_TESTS=1 to enable GPU jobs.
  • CuPy wheel line: set CUPY_VERSION to 12 (default) or 13 to pick cupy-cuda12x[ctk] vs cupy-cuda13x[ctk], or set CUPY_PIP_SPEC to override the full pip requirement (passed through to tox).

Contribute

License

The project is under the MIT license.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

ultraspy-1.2.5-py3-none-any.whl (167.8 kB view details)

Uploaded Python 3

File details

Details for the file ultraspy-1.2.5-py3-none-any.whl.

File metadata

  • Download URL: ultraspy-1.2.5-py3-none-any.whl
  • Upload date:
  • Size: 167.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ultraspy-1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b688960f86e3d99a915a7fb639efe91c3905f0eef2379b2fcd6dd9a044512574
MD5 d1a8cf10b65010143a0a3b32fb6bf4a5
BLAKE2b-256 cae8eb828725d3e420ba949fc7958a00d63c799306e663cc696d5fd5849ce407

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 Pingdom Monitoring Sentry Error logging StatusPage Status page