gapat


Namegapat JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/ddffwyb/GAPAT
SummaryA comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography
upload_time2024-11-12 20:35:33
maintainerNone
docs_urlNone
authorYibing Wang
requires_pythonNone
licenseMIT
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.
            # A comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography

The repository provides code of the paper with the same name as this repository.

> A comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography.

## 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.

## 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="cpu", num_devices=1, 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. Default: 1.                                                                                                      |
| `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.                      |

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ddffwyb/GAPAT",
    "name": "gapat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "photoacoustic computed tomography, large-scale data size, GPU-accelerated method, Taichi Lang for python, multiple GPU platform",
    "author": "Yibing Wang",
    "author_email": "ddffwyb@pku.edu.cn",
    "download_url": "https://files.pythonhosted.org/packages/29/71/5e2b4af900e6630bc93a642f99a9744b28a40673338a13b9d3dc4c7a5091/gapat-0.0.3.tar.gz",
    "platform": null,
    "description": "# A comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography\r\n\r\nThe repository provides code of the paper with the same name as this repository.\r\n\r\n> A comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography.\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## 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=\"cpu\", num_devices=1, block_dim=512)`\r\n\r\nReconstruction of photoacoustic computed tomography.\r\n\r\n**Warning**: 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. Default: 1.                                                                                                      |\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",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A comprehensive framework of GPU-accelerated image reconstruction for photoacoustic computed tomography",
    "version": "0.0.3",
    "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": "98607b4a3cad96b07dd84bcb457c5201710b7c1a286c3a3e975777a3f3e56fdc",
                "md5": "1bc3f4b54e0caa7290fbb24ee2d36a43",
                "sha256": "9199294cdf722276299fda5b7034b298f70ffb2cf27d210dd71bd5326682ded9"
            },
            "downloads": -1,
            "filename": "gapat-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1bc3f4b54e0caa7290fbb24ee2d36a43",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7926,
            "upload_time": "2024-11-12T20:35:31",
            "upload_time_iso_8601": "2024-11-12T20:35:31.451291Z",
            "url": "https://files.pythonhosted.org/packages/98/60/7b4a3cad96b07dd84bcb457c5201710b7c1a286c3a3e975777a3f3e56fdc/gapat-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "29715e2b4af900e6630bc93a642f99a9744b28a40673338a13b9d3dc4c7a5091",
                "md5": "f61beea6f52712afaef781aec9bdef93",
                "sha256": "0f04abab655e28e4d10a708f69c92014c4d7479bed28fa16b13521f1f4ee9b4a"
            },
            "downloads": -1,
            "filename": "gapat-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f61beea6f52712afaef781aec9bdef93",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8606,
            "upload_time": "2024-11-12T20:35:33",
            "upload_time_iso_8601": "2024-11-12T20:35:33.210548Z",
            "url": "https://files.pythonhosted.org/packages/29/71/5e2b4af900e6630bc93a642f99a9744b28a40673338a13b9d3dc4c7a5091/gapat-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-12 20:35:33",
    "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"
}
        
Elapsed time: 0.46122s