pycudadecon


Namepycudadecon JSON
Version 0.4.1 PyPI version JSON
download
home_page
SummaryPython wrapper for CUDA-accelerated 3D deconvolution
upload_time2023-09-13 18:36:16
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT
keywords deconvolution microscopy cuda
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyCUDAdecon

This package provides a python wrapper and convenience functions for
[cudaDecon](https://github.com/scopetools/cudaDecon), which is a CUDA/C++
implementation of an accelerated Richardson Lucy Deconvolution
algorithm<sup>1</sup>.

* CUDA accelerated deconvolution with a handful of artifact-reducing features.
* radially averaged OTF generation with interpolation for voxel size
  independence between PSF and data volumes
* 3D deskew, rotation, general affine transformations
* CUDA-based camera-correction for [sCMOS artifact correction](https://llspy.readthedocs.io/en/latest/camera.html)


### Install

The conda package includes the required pre-compiled libraries for Windows and Linux. See GPU driver requirements [below](#gpu-requirements)

```sh
conda install -c conda-forge pycudadecon
```

*macOS is not supported*

### 📖   &nbsp; [Documentation](http://www.talleylambert.com/pycudadecon)


### GPU requirements

This software requires a CUDA-compatible NVIDIA GPU. The underlying cudadecon
libraries have been compiled against different versions of the CUDA toolkit.
The required CUDA libraries are bundled in the conda distributions so you don't
need to install the CUDA toolkit separately.  If desired, you can pick which
version of CUDA you'd like based on your needs, but please note that different
versions of the CUDA toolkit have different GPU driver requirements:

To specify a specific cudatoolkit version, install as follows (for instance, to
use `cudatoolkit=10.2`)

```sh
conda install -c conda-forge pycudadecon cudatoolkit=10.2
```

| CUDA | Linux driver | Win driver |
| ---- | ------------ | ---------- |
| 10.2 | ≥ 440.33     | ≥ 441.22   |
| 11.0 | ≥ 450.36.06  | ≥ 451.22   |
| 11.1 | ≥ 455.23     | ≥ 456.38   |
| 11.2 | ≥ 460.27.03  | ≥ 460.82   |


If you run into trouble, feel free to [open an
issue](https://github.com/tlambert03/pycudadecon/issues) and describe your
setup.


## Usage


The [`pycudadecon.decon()`](https://www.talleylambert.com/pycudadecon/deconvolution.html#pycudadecon.decon) function is designed be able to handle most basic applications:

```python
from pycudadecon import decon

# pass filenames of an image and a PSF
result = decon('/path/to/3D_image.tif', '/path/to/3D_psf.tif')

# decon also accepts numpy arrays
result = decon(img_array, psf_array)

# the image source can also be a sequence of arrays or paths
result = decon([img_array, '/path/to/3D_image.tif'], psf_array)

# see docstrings for additional parameter options
```

For finer-tuned control, you may wish to make an OTF file from your PSF using [`pycudadecon.make_otf()`](https://www.talleylambert.com/pycudadecon/otf.html#pycudadecon.make_otf), and then use the [`pycudadecon.RLContext`](https://www.talleylambert.com/pycudadecon/deconvolution.html#pycudadecon.RLContext) context manager to setup the GPU for use with the [`pycudadecon.rl_decon()`](https://www.talleylambert.com/pycudadecon/deconvolution.html#pycudadecon.rl_decon) function.  (Note all images processed in the same context must have the same input shape).

```python
from pycudadecon import RLContext, rl_decon
from glob import glob
import tifffile

image_folder = '/path/to/some_images/'
imlist = glob(image_folder + '*488*.tif')
otf_path = '/path/to/pregenerated_otf.tif'

with tifffile.TiffFile(imlist[0]) as tf:
    imshape = tf.series[0].shape

with RLContext(imshape, otf_path, dz) as ctx:
    for impath in imlist:
        image = tifffile.imread(impath)
        result = rl_decon(image, ctx.out_shape)
        # do something with result...
```

If you have a 3D PSF volume, the [`pycudadecon.TemporaryOTF`](https://www.talleylambert.com/pycudadecon/otf.html#pycudadecon.TemporaryOTF) context manager facilitates temporary OTF generation...

```python
 # continuing with the variables from the previous example...
 psf_path = "/path/to/psf_3D.tif"
 with TemporaryOTF(psf) as otf:
     with RLContext(imshape, otf.path, dz) as ctx:
         for impath in imlist:
             image = tifffile.imread(impath)
             result = rl_decon(image, ctx.out_shape)
             # do something with result...
```

... and that bit of code is essentially what the [`pycudadecon.decon()`](https://www.talleylambert.com/pycudadecon/deconvolution.html#pycudadecon.decon) function is doing, with a little bit of additional conveniences added in.

*Each of these functions has many options and accepts multiple keyword arguments. See the [documentation](https://www.talleylambert.com/pycudadecon/index.html) for further information on the respective functions.*

For examples and information on affine transforms, volume rotations, and deskewing (typical of light sheet volumes acquired with stage-scanning), see the [documentation on Affine Transformations](https://www.talleylambert.com/pycudadecon/affine.html)
___

<sup>1</sup> D.S.C. Biggs and M. Andrews, Acceleration of iterative image restoration algorithms, Applied Optics, Vol. 36, No. 8, 1997. https://doi.org/10.1364/AO.36.001766

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pycudadecon",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "deconvolution,microscopy,CUDA",
    "author": "",
    "author_email": "Talley Lambert <talley.lambert@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1f/36/f17b938d85ec35a5f421b21dfe44a97f2d91a6dcfb4f23d474329add733e/pycudadecon-0.4.1.tar.gz",
    "platform": null,
    "description": "# pyCUDAdecon\n\nThis package provides a python wrapper and convenience functions for\n[cudaDecon](https://github.com/scopetools/cudaDecon), which is a CUDA/C++\nimplementation of an accelerated Richardson Lucy Deconvolution\nalgorithm<sup>1</sup>.\n\n* CUDA accelerated deconvolution with a handful of artifact-reducing features.\n* radially averaged OTF generation with interpolation for voxel size\n  independence between PSF and data volumes\n* 3D deskew, rotation, general affine transformations\n* CUDA-based camera-correction for [sCMOS artifact correction](https://llspy.readthedocs.io/en/latest/camera.html)\n\n\n### Install\n\nThe conda package includes the required pre-compiled libraries for Windows and Linux. See GPU driver requirements [below](#gpu-requirements)\n\n```sh\nconda install -c conda-forge pycudadecon\n```\n\n*macOS is not supported*\n\n### \ud83d\udcd6   &nbsp; [Documentation](http://www.talleylambert.com/pycudadecon)\n\n\n### GPU requirements\n\nThis software requires a CUDA-compatible NVIDIA GPU. The underlying cudadecon\nlibraries have been compiled against different versions of the CUDA toolkit.\nThe required CUDA libraries are bundled in the conda distributions so you don't\nneed to install the CUDA toolkit separately.  If desired, you can pick which\nversion of CUDA you'd like based on your needs, but please note that different\nversions of the CUDA toolkit have different GPU driver requirements:\n\nTo specify a specific cudatoolkit version, install as follows (for instance, to\nuse `cudatoolkit=10.2`)\n\n```sh\nconda install -c conda-forge pycudadecon cudatoolkit=10.2\n```\n\n| CUDA | Linux driver | Win driver |\n| ---- | ------------ | ---------- |\n| 10.2 | \u2265 440.33     | \u2265 441.22   |\n| 11.0 | \u2265 450.36.06  | \u2265 451.22   |\n| 11.1 | \u2265 455.23     | \u2265 456.38   |\n| 11.2 | \u2265 460.27.03  | \u2265 460.82   |\n\n\nIf you run into trouble, feel free to [open an\nissue](https://github.com/tlambert03/pycudadecon/issues) and describe your\nsetup.\n\n\n## Usage\n\n\nThe [`pycudadecon.decon()`](https://www.talleylambert.com/pycudadecon/deconvolution.html#pycudadecon.decon) function is designed be able to handle most basic applications:\n\n```python\nfrom pycudadecon import decon\n\n# pass filenames of an image and a PSF\nresult = decon('/path/to/3D_image.tif', '/path/to/3D_psf.tif')\n\n# decon also accepts numpy arrays\nresult = decon(img_array, psf_array)\n\n# the image source can also be a sequence of arrays or paths\nresult = decon([img_array, '/path/to/3D_image.tif'], psf_array)\n\n# see docstrings for additional parameter options\n```\n\nFor finer-tuned control, you may wish to make an OTF file from your PSF using [`pycudadecon.make_otf()`](https://www.talleylambert.com/pycudadecon/otf.html#pycudadecon.make_otf), and then use the [`pycudadecon.RLContext`](https://www.talleylambert.com/pycudadecon/deconvolution.html#pycudadecon.RLContext) context manager to setup the GPU for use with the [`pycudadecon.rl_decon()`](https://www.talleylambert.com/pycudadecon/deconvolution.html#pycudadecon.rl_decon) function.  (Note all images processed in the same context must have the same input shape).\n\n```python\nfrom pycudadecon import RLContext, rl_decon\nfrom glob import glob\nimport tifffile\n\nimage_folder = '/path/to/some_images/'\nimlist = glob(image_folder + '*488*.tif')\notf_path = '/path/to/pregenerated_otf.tif'\n\nwith tifffile.TiffFile(imlist[0]) as tf:\n    imshape = tf.series[0].shape\n\nwith RLContext(imshape, otf_path, dz) as ctx:\n    for impath in imlist:\n        image = tifffile.imread(impath)\n        result = rl_decon(image, ctx.out_shape)\n        # do something with result...\n```\n\nIf you have a 3D PSF volume, the [`pycudadecon.TemporaryOTF`](https://www.talleylambert.com/pycudadecon/otf.html#pycudadecon.TemporaryOTF) context manager facilitates temporary OTF generation...\n\n```python\n # continuing with the variables from the previous example...\n psf_path = \"/path/to/psf_3D.tif\"\n with TemporaryOTF(psf) as otf:\n     with RLContext(imshape, otf.path, dz) as ctx:\n         for impath in imlist:\n             image = tifffile.imread(impath)\n             result = rl_decon(image, ctx.out_shape)\n             # do something with result...\n```\n\n... and that bit of code is essentially what the [`pycudadecon.decon()`](https://www.talleylambert.com/pycudadecon/deconvolution.html#pycudadecon.decon) function is doing, with a little bit of additional conveniences added in.\n\n*Each of these functions has many options and accepts multiple keyword arguments. See the [documentation](https://www.talleylambert.com/pycudadecon/index.html) for further information on the respective functions.*\n\nFor examples and information on affine transforms, volume rotations, and deskewing (typical of light sheet volumes acquired with stage-scanning), see the [documentation on Affine Transformations](https://www.talleylambert.com/pycudadecon/affine.html)\n___\n\n<sup>1</sup> D.S.C. Biggs and M. Andrews, Acceleration of iterative image restoration algorithms, Applied Optics, Vol. 36, No. 8, 1997. https://doi.org/10.1364/AO.36.001766\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for CUDA-accelerated 3D deconvolution",
    "version": "0.4.1",
    "project_urls": {
        "Documentation": "https://pycudadecon.readthedocs.io/en/latest/",
        "Source": "https://github.com/tlambert03/pycudadecon",
        "Tracker": "https://github.com/tlambert03/pycudadecon/issues"
    },
    "split_keywords": [
        "deconvolution",
        "microscopy",
        "cuda"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f62d8ed9bf4c49fa40795ef8e7f786c4f19b4964cfb91c69ba1772f0ceef481b",
                "md5": "7ebf3a73e49dc0fba2d9a07f74f3ad2c",
                "sha256": "0d518dc71b5a55fecdbc681a8f0b8fa7e10b32b1764edb5fb7b6a6bc2766f7d4"
            },
            "downloads": -1,
            "filename": "pycudadecon-0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7ebf3a73e49dc0fba2d9a07f74f3ad2c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 22295,
            "upload_time": "2023-09-13T18:36:14",
            "upload_time_iso_8601": "2023-09-13T18:36:14.373417Z",
            "url": "https://files.pythonhosted.org/packages/f6/2d/8ed9bf4c49fa40795ef8e7f786c4f19b4964cfb91c69ba1772f0ceef481b/pycudadecon-0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f36f17b938d85ec35a5f421b21dfe44a97f2d91a6dcfb4f23d474329add733e",
                "md5": "e434bea560dc8e9701c21abe82c247c9",
                "sha256": "36deb0deda0d601aaf66f75c88ec876608c2c1069d0657f994557e3824185806"
            },
            "downloads": -1,
            "filename": "pycudadecon-0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e434bea560dc8e9701c21abe82c247c9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 52355621,
            "upload_time": "2023-09-13T18:36:16",
            "upload_time_iso_8601": "2023-09-13T18:36:16.733326Z",
            "url": "https://files.pythonhosted.org/packages/1f/36/f17b938d85ec35a5f421b21dfe44a97f2d91a6dcfb4f23d474329add733e/pycudadecon-0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-13 18:36:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tlambert03",
    "github_project": "pycudadecon",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pycudadecon"
}
        
Elapsed time: 0.12518s