Parallel beamforming wrapper for native code
Project description
fast-DAS
Parallel delay-and-sum implementation wrapping native CUDA from python
About
- Supports windows and unix
- Uses CPU-multithreading when
use_gpu
isFalse
- Uses NVIDIA CUDA library when
use_gpu
isTrue
- Cross-compiled on windows using WSL and CMake
Usage
fast-DAS is a python wrapper and native code implementation for the delay-and-sum algorithm pre-compiled in C++ (CPU version) and CUDA (GPU version).
The goal is to boost the digital beamforming process for ultrasound acquisitions.
Installation
pip install fast-das
Note on Windows/CPU usage
In Windows, you may encounter the following error when setting the use_gpu flag to False:
FileNotFoundError: Could not find module '..\lib\site-packages\fastDAS\bin\libdas.dll' (or one of its dependencies). Try using the full path with constructor syntax.
This is because multi-threading is performed with the pthreads library, which is not natively included in Windows. pthreads is included in MinGW, so adding gcc to your conda environment will resolve this issue (for example from here).
Input format
To beamform with fast-DAS, initialize a DAS object based on your compute preference (CPU/GPU):
from fastDAS import delay_and_sum as fd
das = fd.DAS(use_gpu=True)
For out-of-the-box usage with Verasonics Vantage systems, save the MATLAB workspace after collecting an RF acquisition.
The workspace file should contain at least the following variables as a .mat file:
{
'NA': {'NA_tot':_, 'NA':_},
'PData': {
'Size': _,
'PDelta': _,
'Origin': _,
},
'Trans': {
'lensCorrection': _,
'ElementPos': _,
'WavelenToMm': _,
},
'TX': {
'Steer': _,
'Delay': _,
},
'TW': {
'Peak': _
},
'Receive': {
'SamplesPerWave': _,
'StartDepth': _,
'StartSample': _,
'EndSample': _
}
}
In a plane wave compounding acqusition, the init_delays()
function can be used to calculate the Tx and Rx delay map based on a workspace like the one above.
Otherwise, you can implement the del_Tx
and del_Rx
variables yourself.
Note that the units of these delay maps are not [usec]
but rather [samples]
.
Customized Usage
If you want to use the native code wrapper in an acquisition other than plane wave steering, calculate your own del_Tx and del_Rx delays.
You'll need to provide the DAS class with some basic information on the acquisition protocol (see DAS.beamform() docstring for specific details)
das = fd.DAS(use_gpu=True)
del_Tx = np.zeros((NA, FOVz, FOVx), dtype=np.float32)
del_Rx = np.zeros((n_el, FOVz, FOVx), dtype=np.float32)
# Calc the delays
# ...
das.del_Tx = del_Tx
das.del_Rx = del_Rx
RF = get_your_RF_data()
das.beamform(RF, N, start_sample, end_sample)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fast-das-1.1.3.tar.gz
.
File metadata
- Download URL: fast-das-1.1.3.tar.gz
- Upload date:
- Size: 739.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 596b65d3d94bf42c1ee02ed8b8f08dee227ff28029087b19874da957b094f3f7 |
|
MD5 | 74a6a3b687f1847f10711cf520f0db70 |
|
BLAKE2b-256 | 503f290efb523e448483570ef1a6d7b9055a8ad997818c8eb1f9ff7091c5d04c |
File details
Details for the file fast_das-1.1.3-py3-none-any.whl
.
File metadata
- Download URL: fast_das-1.1.3-py3-none-any.whl
- Upload date:
- Size: 741.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43b707f3300cd18d9e2cc48efdf092a5fad21f31123841f1ba91fa3527f9acbb |
|
MD5 | 848b895366ea610607bc61d405de134c |
|
BLAKE2b-256 | 9ddb433059a9f4a2a41ce686dfed283c66b090d3207cf15947853e123f9acb36 |