Name | gapat JSON |
Version |
1.0.1
JSON |
| download |
home_page | None |
Summary | A comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography |
upload_time | 2025-03-03 07:46:56 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2023 DDFFWYB Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
photoacoustic computed tomography
large-scale data size
gpu-accelerated method
taichi lang for python
multiple gpu platform
|
VCS |
 |
bugtrack_url |
|
requirements |
bm3d
numpy
matplotlib
opencv-python
PyYAML
scipy
taichi
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography
The package `gapat` provides code of the following paper using easy-to-use Python interface with another form and realization of the algorithm.
> Comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography ([Link](https://www.spiedigitallibrary.org/journals/journal-of-biomedical-optics/volume-29/issue-06/066006/Comprehensive-framework-of-GPU-accelerated-image-reconstruction-for-photoacoustic-computed/10.1117/1.JBO.29.6.066006.full#_=_))
## Abstract
**Significance**: Photoacoustic Computed Tomography (PACT) is a promising non-invasive imaging technique for both life science and clinical implementations. To achieve fast imaging speed, modern PACT systems have equipped arrays that have hundreds to thousands of ultrasound transducer (UST) elements, and the element number continues to increase. However, large number of UST elements with parallel data acquisition could generate a massive data size, making it very challenging to realize fast image reconstruction. Although several research groups have developed GPU-accelerated method for PACT, there lacks an explicit and feasible step-by-step description of GPU-based algorithms for various hardware platforms.
**Aim**: In this study, we propose a comprehensive framework for developing GPU-accelerated PACT image reconstruction (Gpu-Accelerated PhotoAcoustic computed Tomography, _**GAPAT**_), helping the research society to grasp this advanced image reconstruction method.
**Approach**: We leverage widely accessible open-source parallel computing tools, including Python multiprocessing-based parallelism, Taichi Lang for Python, CUDA, and possible other backends. We demonstrate that our framework promotes significant performance of PACT reconstruction, enabling faster analysis and real-time applications. Besides, we also described how to realize parallel computing on various hardware configurations, including multicore CPU, single GPU, and multiple GPUs platform.
**Results**: Notably, our framework can achieve an effective rate of approximately 871 times when reconstructing extremely large-scale 3D PACT images on a dual-GPU platform compared to a 24-core workstation CPU. Besides this manuscript, we shared example codes in the GitHub.
**Conclusions**: Our approach allows for easy adoption and adaptation by the research community, fostering implementations of PACT for both life science and medicine.
**Keywords**: photoacoustic computed tomography, large-scale data size, GPU-accelerated method, Taichi Lang for python, multiple GPU platform.
## Installation
The code requires python>=3.8, and pre-installing CUDA on your computer is strongly recommended (no specific version requirement).
We recommend using the conda environment to install the cuda toolkit. The following command installs the cuda toolkit.
```bash
conda create -n gapat python=3.9 -y
conda activate gapat
conda install -c conda-forge cudatoolkit=11.8
```
Then install the package using pip.
```bash
pip install gapat
```
## Getting Started
Here is a simple example to show how to use the package. You can also read the following documentation for more details.
```python
import time
import numpy as np
from gapat.algorithms import recon
from gapat.processings import negetive_processing
from gapat.utils import load_dat, calculate_detector_location, save_mat
# Settings
data_path = "./data"
num_channels = 256
num_times = 2048
detector_interval_x = 0.10e-3 # Scanning spacing
detector_interval_y = 0.50e-3 # Linear array spacing
x_range = [-10.0e-3, 110.0e-3]
y_range = [-10.0e-3, 110.0e-3]
z_range = [10.0e-3, 50.0e-3]
res = 0.20e-3
vs = 1500.0
fs = 40.0e6
delay = 0
method = "das"
device = "gpu"
num_devices = 1
device_no = 0
# Load data
signal_backproj = load_dat(data_path, num_channels, num_times)
num_detectors = signal_backproj.shape[0]
detector_location = calculate_detector_location(num_detectors, num_channels, detector_interval_x, detector_interval_y)
detector_normal = np.zeros((num_detectors, 3), dtype=np.float32)
detector_normal[:, 2] = 1.0 # The normal of the detectors points to the volume of planar array
# Reconstruction
start = time.time()
signal_recon = recon(
signal_backproj,
detector_location,
detector_normal,
x_range,
y_range,
z_range,
res,
vs,
fs,
delay,
method,
device,
num_devices,
device_no,
)
end = time.time()
print(f"Reconstruction time: {end - start} seconds")
# Save the result
signal_recon = negetive_processing(signal_recon, method="zero", axis=0)
save_mat("result.mat", "signal_recon", signal_recon)
```
## Documentation
### gapat.algorithms
> **`gapat.algorithms.recon(signal_backproj, detector_location, detector_normal, x_range, y_range, z_range, res, vs, fs, delay=0, method="das", device="gpu", num_devices=1, device_no=0, block_dim=512)`**
Reconstruction of photoacoustic computed tomography.
Warning: When using multi-device reconstruction, the function must be called on the main process.
_Parameters_
| Parameter | Type | Description |
| ------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `signal_backproj` | `np.ndarray` | The input signal. Each row is a signal of a detector.<br>Shape: (num_detectors, num_times). Dtype: np.float32. |
| `detector_location` | `np.ndarray` | The location of the detectors. Each row is the coordinates of a detector.<br>Shape: (num_detectors, 3). Dtype: np.float32. |
| `detector_normal` | `np.ndarray` | The normal of the detectors. Each row is the normal of a detector which points to the volume.<br>Shape: (num_detectors, 3). Dtype: np.float32. |
| `x_range` | `list` | The range of the reconstruction volume. The first is the start x and the second is the end x. Example: [0, 1].<br>Shape: (2,). Dtype: float. |
| `y_range` | `list` | The range of the reconstruction volume. The first is the start y and the second is the end y. Example: [0, 1].<br>Shape: (2,). Dtype: float. |
| `z_range` | `list` | The range of the reconstruction volume. The first is the start z and the second is the end z. Example: [0, 1].<br>Shape: (2,). Dtype: float. |
| `res` | `float` | The resolution of the volume. |
| `vs` | `float` | The speed of sound in the volume. |
| `fs` | `float` | The sampling frequency. |
| `delay` | `int` | The delay of the detectors. Default: 0. |
| `method` | `str` | The method to use. Default: "das". Options: "das", "ubp". |
| `device` | `str` | The device to use. Default: "gpu". Options: "cpu", "gpu". |
| `num_devices` | `int` | The number of devices to use. When = 1, the device set by `device_no` will be used.<br>When \> 1, the first n devices will be used. Default: 1. |
| `device_no` | `int` | The device no to use when num_devices = 1. Default: 0. |
| `block_dim` | `int` | The block dimension. Default: 512. |
_Returns_
| Parameter | Type | Description |
| -------------- | ------------ | ----------------------------------------------------------------------------- |
| `signal_recon` | `np.ndarray` | The reconstructed signal.<br>Shape: (num_x, num_y, num_z). Dtype: np.float32. |
### gapat.processings
> **`gapat.processings.bandpass_filter(signal_matrix, fs, band_range, order=2, axis=0)`**
Bandpass filter the signal matrix.
_Parameters_
| Parameter | Type | Description |
| --------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `signal_matrix` | `np.ndarray` | The signal matrix to be filtered.<br>Shape: (num_detectors, num_times). Dtype: np.float32. |
| `fs` | `float` | The sampling frequency (Hz). |
| `band_range` | `list` | The band range to filter (Hz). The first is the low frequency and the second is the high frequency. Example: [10e6, 100e6].<br>Shape: (2,). Dtype: float. |
| `order` | `int` | The order of the filter. Default: 2. |
| `axis` | `int` | The axis to filter. Default: 0. (Which will be applied to each detector.) |
_Returns_
| Parameter | Type | Description |
| ------------------------ | ------------ | ------------------------------------------------------------------------------------ |
| `filtered_signal_matrix` | `np.ndarray` | The filtered signal matrix.<br>Shape: (num_detectors, num_times). Dtype: np.float32. |
> **`gapat.processings.negetive_processing(signal_recon, method="zero", axis=0)`**
Process the negative signal.
_Parameters_
| Parameter | Type | Description |
| -------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `signal_recon` | `np.ndarray` | The reconstructed signal to be processed.<br>Shape: (num_x, num_y, num_z). Dtype: np.float32. |
| `method` | `str` | The method to process the negative signal. Default: "zero". Options: "zero", "abs", "hilbert".<br>"zero": Set the negative signal to zero.<br>"abs": Take the absolute value of the negative signal.<br>"hilbert": Use the hilbert transform to get the envelope of the signal. |
| `axis` | `int` | The axis to process when method is "hilbert". Default: 0. |
_Returns_
| Parameter | Type | Description |
| ------------------------ | ------------ | ---------------------------------------------------------------------------------------- |
| `processed_signal_recon` | `np.ndarray` | The processed signal reconstruction.<br>Shape: (num_x, num_y, num_z). Dtype: np.float32. |
### gapat.utils
> **`gapat.utils.load_mat(filename)`**
Load .mat file and return a dictionary with variable names as keys, and loaded matrices as values.
_Parameters_
| Parameter | Type | Description |
| ---------- | ----- | -------------------------- |
| `filename` | `str` | The path to the .mat file. |
_Returns_
| Parameter | Type | Description |
| --------- | ------ | ------------------------------------------------------------------------ |
| `data` | `dict` | A dictionary with variable names as keys, and loaded matrices as values. |
> **`gapat.utils.save_mat(filename, varname, data)`**
Save data to .mat file with the given variable name.
_Parameters_
| Parameter | Type | Description |
| ---------- | ------------ | -------------------------------------- |
| `filename` | `str` | The path to the .mat file. |
| `varname` | `str` | The variable name to save the data to. |
| `data` | `np.ndarray` | The data to save. |
> **`gapat.utils.load_dat(data_path, num_channels, num_times, dtype=np.int16, order="F", zero_set=True)`**
Load all .dat files in the given directory and return a numpy array.
_Parameters_
| Parameter | Type | Description |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------- |
| `data_path` | `str` | The path to the .dat files. |
| `num_channels` | `int` | The number of channels. |
| `num_times` | `int` | The number of times. |
| `dtype` | `np.dtype` | The data type of the data needed to be loaded. Default: np.int16. |
| `order` | `str` | The order of the loaded data. Same as numpy.reshape order. "F" for Fortran order, "C" for C order. Default: "F". |
| `zero_set` | `bool` | Whether to set the first and last two rows to 0.0. Default: True. |
_Returns_
| Parameter | Type | Description |
| --------- | ------------ | ------------------------------------------------------------------------------------- |
| `data` | `np.ndarray` | The loaded data.<br>Shape: (num_channels \* num_files, num_times). Dtype: np.float32. |
> **`gapat.utils.calculate_detector_location(num_detectors, num_channels, detector_interval_x, detector_interval_y)`**
Calculate the location of the detectors.
_Parameters_
| Parameter | Type | Description |
| --------------------- | ------- | -------------------------------------------------------------------------- |
| `num_detectors` | `int` | The number of total detectors. Equivalent to num_channels \* num_steps. |
| `num_channels` | `int` | The number of channels. |
| `detector_interval_x` | `float` | The interval of the detectors in the x direction (scanning direction). |
| `detector_interval_y` | `float` | The interval of the detectors in the y direction (linear array direction). |
_Returns_
| Parameter | Type | Description |
| ------------------- | ------------ | ------------------------------------------------------------------------------- |
| `detector_location` | `np.ndarray` | The location of the detectors.<br>Shape: (num_detectors, 3). Dtype: np.float32. |
Raw data
{
"_id": null,
"home_page": null,
"name": "gapat",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "photoacoustic computed tomography, large-scale data size, GPU-accelerated method, Taichi Lang for python, multiple GPU platform",
"author": null,
"author_email": "Yibing Wang <ddffwyb@pku.edu.cn>",
"download_url": "https://files.pythonhosted.org/packages/04/db/1a5cbb40243176f6b631be3c4521f17938a1aa7af8345dbe3ae69ac614d6/gapat-1.0.1.tar.gz",
"platform": null,
"description": "# Comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography\r\n\r\nThe package `gapat` provides code of the following paper using easy-to-use Python interface with another form and realization of the algorithm.\r\n\r\n> Comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography ([Link](https://www.spiedigitallibrary.org/journals/journal-of-biomedical-optics/volume-29/issue-06/066006/Comprehensive-framework-of-GPU-accelerated-image-reconstruction-for-photoacoustic-computed/10.1117/1.JBO.29.6.066006.full#_=_))\r\n\r\n## Abstract\r\n\r\n**Significance**: Photoacoustic Computed Tomography (PACT) is a promising non-invasive imaging technique for both life science and clinical implementations. To achieve fast imaging speed, modern PACT systems have equipped arrays that have hundreds to thousands of ultrasound transducer (UST) elements, and the element number continues to increase. However, large number of UST elements with parallel data acquisition could generate a massive data size, making it very challenging to realize fast image reconstruction. Although several research groups have developed GPU-accelerated method for PACT, there lacks an explicit and feasible step-by-step description of GPU-based algorithms for various hardware platforms.\r\n\r\n**Aim**: In this study, we propose a comprehensive framework for developing GPU-accelerated PACT image reconstruction (Gpu-Accelerated PhotoAcoustic computed Tomography, _**GAPAT**_), helping the research society to grasp this advanced image reconstruction method.\r\n\r\n**Approach**: We leverage widely accessible open-source parallel computing tools, including Python multiprocessing-based parallelism, Taichi Lang for Python, CUDA, and possible other backends. We demonstrate that our framework promotes significant performance of PACT reconstruction, enabling faster analysis and real-time applications. Besides, we also described how to realize parallel computing on various hardware configurations, including multicore CPU, single GPU, and multiple GPUs platform.\r\n\r\n**Results**: Notably, our framework can achieve an effective rate of approximately 871 times when reconstructing extremely large-scale 3D PACT images on a dual-GPU platform compared to a 24-core workstation CPU. Besides this manuscript, we shared example codes in the GitHub.\r\n\r\n**Conclusions**: Our approach allows for easy adoption and adaptation by the research community, fostering implementations of PACT for both life science and medicine.\r\n\r\n**Keywords**: photoacoustic computed tomography, large-scale data size, GPU-accelerated method, Taichi Lang for python, multiple GPU platform.\r\n\r\n## Installation\r\n\r\nThe code requires python>=3.8, and pre-installing CUDA on your computer is strongly recommended (no specific version requirement).\r\n\r\nWe recommend using the conda environment to install the cuda toolkit. The following command installs the cuda toolkit.\r\n\r\n```bash\r\nconda create -n gapat python=3.9 -y\r\nconda activate gapat\r\nconda install -c conda-forge cudatoolkit=11.8\r\n```\r\n\r\nThen install the package using pip.\r\n\r\n```bash\r\npip install gapat\r\n```\r\n\r\n## Getting Started\r\n\r\nHere is a simple example to show how to use the package. You can also read the following documentation for more details.\r\n\r\n```python\r\nimport time\r\n\r\nimport numpy as np\r\nfrom gapat.algorithms import recon\r\nfrom gapat.processings import negetive_processing\r\nfrom gapat.utils import load_dat, calculate_detector_location, save_mat\r\n\r\n# Settings\r\ndata_path = \"./data\"\r\nnum_channels = 256\r\nnum_times = 2048\r\ndetector_interval_x = 0.10e-3 # Scanning spacing\r\ndetector_interval_y = 0.50e-3 # Linear array spacing\r\nx_range = [-10.0e-3, 110.0e-3]\r\ny_range = [-10.0e-3, 110.0e-3]\r\nz_range = [10.0e-3, 50.0e-3]\r\nres = 0.20e-3\r\nvs = 1500.0\r\nfs = 40.0e6\r\ndelay = 0\r\nmethod = \"das\"\r\ndevice = \"gpu\"\r\nnum_devices = 1\r\ndevice_no = 0\r\n\r\n# Load data\r\nsignal_backproj = load_dat(data_path, num_channels, num_times)\r\nnum_detectors = signal_backproj.shape[0]\r\ndetector_location = calculate_detector_location(num_detectors, num_channels, detector_interval_x, detector_interval_y)\r\ndetector_normal = np.zeros((num_detectors, 3), dtype=np.float32)\r\ndetector_normal[:, 2] = 1.0 # The normal of the detectors points to the volume of planar array\r\n\r\n# Reconstruction\r\nstart = time.time()\r\nsignal_recon = recon(\r\n signal_backproj,\r\n detector_location,\r\n detector_normal,\r\n x_range,\r\n y_range,\r\n z_range,\r\n res,\r\n vs,\r\n fs,\r\n delay,\r\n method,\r\n device,\r\n num_devices,\r\n device_no,\r\n)\r\nend = time.time()\r\nprint(f\"Reconstruction time: {end - start} seconds\")\r\n\r\n# Save the result\r\nsignal_recon = negetive_processing(signal_recon, method=\"zero\", axis=0)\r\nsave_mat(\"result.mat\", \"signal_recon\", signal_recon)\r\n```\r\n\r\n## Documentation\r\n\r\n### gapat.algorithms\r\n\r\n> **`gapat.algorithms.recon(signal_backproj, detector_location, detector_normal, x_range, y_range, z_range, res, vs, fs, delay=0, method=\"das\", device=\"gpu\", num_devices=1, device_no=0, block_dim=512)`**\r\n\r\nReconstruction of photoacoustic computed tomography.\r\n\r\nWarning: When using multi-device reconstruction, the function must be called on the main process.\r\n\r\n_Parameters_\r\n\r\n| Parameter | Type | Description |\r\n| ------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |\r\n| `signal_backproj` | `np.ndarray` | The input signal. Each row is a signal of a detector.<br>Shape: (num_detectors, num_times). Dtype: np.float32. |\r\n| `detector_location` | `np.ndarray` | The location of the detectors. Each row is the coordinates of a detector.<br>Shape: (num_detectors, 3). Dtype: np.float32. |\r\n| `detector_normal` | `np.ndarray` | The normal of the detectors. Each row is the normal of a detector which points to the volume.<br>Shape: (num_detectors, 3). Dtype: np.float32. |\r\n| `x_range` | `list` | The range of the reconstruction volume. The first is the start x and the second is the end x. Example: [0, 1].<br>Shape: (2,). Dtype: float. |\r\n| `y_range` | `list` | The range of the reconstruction volume. The first is the start y and the second is the end y. Example: [0, 1].<br>Shape: (2,). Dtype: float. |\r\n| `z_range` | `list` | The range of the reconstruction volume. The first is the start z and the second is the end z. Example: [0, 1].<br>Shape: (2,). Dtype: float. |\r\n| `res` | `float` | The resolution of the volume. |\r\n| `vs` | `float` | The speed of sound in the volume. |\r\n| `fs` | `float` | The sampling frequency. |\r\n| `delay` | `int` | The delay of the detectors. Default: 0. |\r\n| `method` | `str` | The method to use. Default: \"das\". Options: \"das\", \"ubp\". |\r\n| `device` | `str` | The device to use. Default: \"gpu\". Options: \"cpu\", \"gpu\". |\r\n| `num_devices` | `int` | The number of devices to use. When = 1, the device set by `device_no` will be used.<br>When \\> 1, the first n devices will be used. Default: 1. |\r\n| `device_no` | `int` | The device no to use when num_devices = 1. Default: 0. |\r\n| `block_dim` | `int` | The block dimension. Default: 512. |\r\n\r\n_Returns_\r\n\r\n| Parameter | Type | Description |\r\n| -------------- | ------------ | ----------------------------------------------------------------------------- |\r\n| `signal_recon` | `np.ndarray` | The reconstructed signal.<br>Shape: (num_x, num_y, num_z). Dtype: np.float32. |\r\n\r\n### gapat.processings\r\n\r\n> **`gapat.processings.bandpass_filter(signal_matrix, fs, band_range, order=2, axis=0)`**\r\n\r\nBandpass filter the signal matrix.\r\n\r\n_Parameters_\r\n\r\n| Parameter | Type | Description |\r\n| --------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |\r\n| `signal_matrix` | `np.ndarray` | The signal matrix to be filtered.<br>Shape: (num_detectors, num_times). Dtype: np.float32. |\r\n| `fs` | `float` | The sampling frequency (Hz). |\r\n| `band_range` | `list` | The band range to filter (Hz). The first is the low frequency and the second is the high frequency. Example: [10e6, 100e6].<br>Shape: (2,). Dtype: float. |\r\n| `order` | `int` | The order of the filter. Default: 2. |\r\n| `axis` | `int` | The axis to filter. Default: 0. (Which will be applied to each detector.) |\r\n\r\n_Returns_\r\n\r\n| Parameter | Type | Description |\r\n| ------------------------ | ------------ | ------------------------------------------------------------------------------------ |\r\n| `filtered_signal_matrix` | `np.ndarray` | The filtered signal matrix.<br>Shape: (num_detectors, num_times). Dtype: np.float32. |\r\n\r\n> **`gapat.processings.negetive_processing(signal_recon, method=\"zero\", axis=0)`**\r\n\r\nProcess the negative signal.\r\n\r\n_Parameters_\r\n\r\n| Parameter | Type | Description |\r\n| -------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\r\n| `signal_recon` | `np.ndarray` | The reconstructed signal to be processed.<br>Shape: (num_x, num_y, num_z). Dtype: np.float32. |\r\n| `method` | `str` | The method to process the negative signal. Default: \"zero\". Options: \"zero\", \"abs\", \"hilbert\".<br>\"zero\": Set the negative signal to zero.<br>\"abs\": Take the absolute value of the negative signal.<br>\"hilbert\": Use the hilbert transform to get the envelope of the signal. |\r\n| `axis` | `int` | The axis to process when method is \"hilbert\". Default: 0. |\r\n\r\n_Returns_\r\n\r\n| Parameter | Type | Description |\r\n| ------------------------ | ------------ | ---------------------------------------------------------------------------------------- |\r\n| `processed_signal_recon` | `np.ndarray` | The processed signal reconstruction.<br>Shape: (num_x, num_y, num_z). Dtype: np.float32. |\r\n\r\n### gapat.utils\r\n\r\n> **`gapat.utils.load_mat(filename)`**\r\n\r\nLoad .mat file and return a dictionary with variable names as keys, and loaded matrices as values.\r\n\r\n_Parameters_\r\n\r\n| Parameter | Type | Description |\r\n| ---------- | ----- | -------------------------- |\r\n| `filename` | `str` | The path to the .mat file. |\r\n\r\n_Returns_\r\n\r\n| Parameter | Type | Description |\r\n| --------- | ------ | ------------------------------------------------------------------------ |\r\n| `data` | `dict` | A dictionary with variable names as keys, and loaded matrices as values. |\r\n\r\n> **`gapat.utils.save_mat(filename, varname, data)`**\r\n\r\nSave data to .mat file with the given variable name.\r\n\r\n_Parameters_\r\n\r\n| Parameter | Type | Description |\r\n| ---------- | ------------ | -------------------------------------- |\r\n| `filename` | `str` | The path to the .mat file. |\r\n| `varname` | `str` | The variable name to save the data to. |\r\n| `data` | `np.ndarray` | The data to save. |\r\n\r\n> **`gapat.utils.load_dat(data_path, num_channels, num_times, dtype=np.int16, order=\"F\", zero_set=True)`**\r\n\r\nLoad all .dat files in the given directory and return a numpy array.\r\n\r\n_Parameters_\r\n\r\n| Parameter | Type | Description |\r\n| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------- |\r\n| `data_path` | `str` | The path to the .dat files. |\r\n| `num_channels` | `int` | The number of channels. |\r\n| `num_times` | `int` | The number of times. |\r\n| `dtype` | `np.dtype` | The data type of the data needed to be loaded. Default: np.int16. |\r\n| `order` | `str` | The order of the loaded data. Same as numpy.reshape order. \"F\" for Fortran order, \"C\" for C order. Default: \"F\". |\r\n| `zero_set` | `bool` | Whether to set the first and last two rows to 0.0. Default: True. |\r\n\r\n_Returns_\r\n\r\n| Parameter | Type | Description |\r\n| --------- | ------------ | ------------------------------------------------------------------------------------- |\r\n| `data` | `np.ndarray` | The loaded data.<br>Shape: (num_channels \\* num_files, num_times). Dtype: np.float32. |\r\n\r\n> **`gapat.utils.calculate_detector_location(num_detectors, num_channels, detector_interval_x, detector_interval_y)`**\r\n\r\nCalculate the location of the detectors.\r\n\r\n_Parameters_\r\n\r\n| Parameter | Type | Description |\r\n| --------------------- | ------- | -------------------------------------------------------------------------- |\r\n| `num_detectors` | `int` | The number of total detectors. Equivalent to num_channels \\* num_steps. |\r\n| `num_channels` | `int` | The number of channels. |\r\n| `detector_interval_x` | `float` | The interval of the detectors in the x direction (scanning direction). |\r\n| `detector_interval_y` | `float` | The interval of the detectors in the y direction (linear array direction). |\r\n\r\n_Returns_\r\n\r\n| Parameter | Type | Description |\r\n| ------------------- | ------------ | ------------------------------------------------------------------------------- |\r\n| `detector_location` | `np.ndarray` | The location of the detectors.<br>Shape: (num_detectors, 3). Dtype: np.float32. |\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 DDFFWYB Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography",
"version": "1.0.1",
"project_urls": {
"homepage": "https://github.com/ddffwyb/GAPAT"
},
"split_keywords": [
"photoacoustic computed tomography",
" large-scale data size",
" gpu-accelerated method",
" taichi lang for python",
" multiple gpu platform"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "88710ff941ab157eb6410004dfdfe986f18e1b975b28050048087d96f45ce64c",
"md5": "3dd7038192bd6d5e3a16ff385f496a5b",
"sha256": "2af2a126c3a9fa72b9b41cbba8a7c0429fa9259ddb8e62ed2ffc9d232430a7d6"
},
"downloads": -1,
"filename": "gapat-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3dd7038192bd6d5e3a16ff385f496a5b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 10880,
"upload_time": "2025-03-03T07:46:54",
"upload_time_iso_8601": "2025-03-03T07:46:54.521772Z",
"url": "https://files.pythonhosted.org/packages/88/71/0ff941ab157eb6410004dfdfe986f18e1b975b28050048087d96f45ce64c/gapat-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "04db1a5cbb40243176f6b631be3c4521f17938a1aa7af8345dbe3ae69ac614d6",
"md5": "225d3fcef5207d50bc6300ac35417a44",
"sha256": "8bc2c4d4467c840d0630ea16dd3ca6c49e8d8c87f48ecdabe23f75c79e337b87"
},
"downloads": -1,
"filename": "gapat-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "225d3fcef5207d50bc6300ac35417a44",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12525,
"upload_time": "2025-03-03T07:46:56",
"upload_time_iso_8601": "2025-03-03T07:46:56.611236Z",
"url": "https://files.pythonhosted.org/packages/04/db/1a5cbb40243176f6b631be3c4521f17938a1aa7af8345dbe3ae69ac614d6/gapat-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-03 07:46:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ddffwyb",
"github_project": "GAPAT",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "bm3d",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "opencv-python",
"specs": []
},
{
"name": "PyYAML",
"specs": []
},
{
"name": "scipy",
"specs": []
},
{
"name": "taichi",
"specs": [
[
"==",
"1.2.2"
]
]
}
],
"lcname": "gapat"
}