Skip to main content

GPU-accelerated image processing in python using OpenCL

Project description

py-clesperanto

Conda Version PyPI License Development Status Build codecov Python Version Code style: black GitHub stars GitHub forks

pyclesperanto is the python package of clEsperanto - a multi-language framework for GPU-accelerated image processing. It relies on a familly of OpenCL kernels originated from CLIJ. This package is developped in python and C++ wrapped using PyBind11, and uses the C++ CLIc library as a processing backend.

Reference and examples

An in-depth API reference and package documentation can be found here, and several demonstration notebook on how to use the library and major functionnality are available in the demos folder

Installation

  • Get a conda/python environment, e.g. via mamba-forge.
    • If you never used python/conda environments before, please follow these instructions first.
  • Create a new environment and activate it:
mamba create --name cle
mamba activate cle
mamba install -c conda-forge pyclesperanto

MacOS users may need to install the following package: mamba install -c conda-forge ocl_icd_wrapper_apple Linux users may need to install the following package: mamba install -c conda-forge ocl-icd-system

NOTE: It is also possible to install pyclesperanto with pip

Troubleshooting: Graphics cards drivers

In case you encounter one of the following error messages:

  • "ImportError: DLL load failed while importing cl: The specified procedure could not be found" see also
  • "clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR"
  • "No backend available. Please install either OpenCL or CUDA on your system."
  • "No device available. Please install either OpenCL or CUDA on your system."

please install recent drivers for your graphics card and/or OpenCL device. Select the right driver source depending on your hardware from this list:

Linux user may have to install packages such as intel-opencl-icd or rocm-opencl-runtime depending on their GPU.

Code Example

import pyclesperanto as cle
from skimage.io import imread, imsave

# initialize GPU
device = cle.select_device()
print("Used GPU: ", device)

image = imread("https://samples.fiji.sc/blobs.png")

# push image to device memory
input_image = cle.push(image)

# process the image
inverted = cle.subtract_image_from_scalar(input_image, scalar=255)
blurred = cle.gaussian_blur(inverted, sigma_x=1, sigma_y=1)
binary = cle.threshold_otsu(blurred)
labeled = cle.connected_components_labeling(binary)

# The maxmium intensity in a label image corresponds to the number of objects
num_labels = cle.maximum_of_all_pixels(labeled)

# print out result
print("Num objects in the image: " + str(num_labels))

# read image from device memory
output_image = cle.pull(labeled)
imsave("result.tif", output_image)

Examples & Demos gallery

Segment + analyze blobs

Cell segmentation + Voronoi labeling

3D image filtering

Find local maxima

3D Tribolium nuclei segmentation

Explore application programming interface (API)

More usage and example can be found as notebooks in the demos folder

Contributing and Feedback

clEsperanto is developed in the open because we believe in the [open source community]. Feel free to drop feedback as github issue or via image.sc forum. Contribution are also very welcome. Please read our community guidelines before you start and get in touch with us so that we can help you get started. If you liked our work, star the repository, share it with your friends, and use it to make cool stuff!

Acknowledgements

We acknowledge support by the Deutsche Forschungsgemeinschaft under Germany’s Excellence Strategy (EXC2068) Cluster of Excellence Physics of Life of TU Dresden. This project has been made possible in part by grant number 2021-237734 (GPU-accelerating Fiji and friends using distributed CLIJ, NEUBIAS-style, EOSS4) from the Chan Zuckerberg Initiative DAF, an advised fund of the Silicon Valley Community Foundation.

Project details


Download files

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

Source Distribution

pyclesperanto-0.12.1.tar.gz (4.6 MB view details)

Uploaded Source

Built Distributions

pyclesperanto-0.12.1-cp312-cp312-win_amd64.whl (441.3 kB view details)

Uploaded CPython 3.12 Windows x86-64

pyclesperanto-0.12.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (844.0 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.12.1-cp312-cp312-macosx_11_0_arm64.whl (476.8 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyclesperanto-0.12.1-cp312-cp312-macosx_10_14_x86_64.whl (516.3 kB view details)

Uploaded CPython 3.12 macOS 10.14+ x86-64

pyclesperanto-0.12.1-cp311-cp311-win_amd64.whl (445.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

pyclesperanto-0.12.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (848.4 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.12.1-cp311-cp311-macosx_11_0_arm64.whl (474.5 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyclesperanto-0.12.1-cp311-cp311-macosx_10_14_x86_64.whl (512.1 kB view details)

Uploaded CPython 3.11 macOS 10.14+ x86-64

pyclesperanto-0.12.1-cp310-cp310-win_amd64.whl (444.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

pyclesperanto-0.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (847.0 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.12.1-cp310-cp310-macosx_11_0_arm64.whl (473.1 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyclesperanto-0.12.1-cp310-cp310-macosx_10_14_x86_64.whl (510.4 kB view details)

Uploaded CPython 3.10 macOS 10.14+ x86-64

pyclesperanto-0.12.1-cp39-cp39-win_amd64.whl (426.5 kB view details)

Uploaded CPython 3.9 Windows x86-64

pyclesperanto-0.12.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (845.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.12.1-cp39-cp39-macosx_11_0_arm64.whl (473.2 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyclesperanto-0.12.1-cp39-cp39-macosx_10_14_x86_64.whl (510.5 kB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

pyclesperanto-0.12.1-cp38-cp38-win_amd64.whl (444.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

pyclesperanto-0.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (844.5 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.12.1-cp38-cp38-macosx_11_0_arm64.whl (473.0 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyclesperanto-0.12.1-cp38-cp38-macosx_10_14_x86_64.whl (510.3 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

File details

Details for the file pyclesperanto-0.12.1.tar.gz.

File metadata

  • Download URL: pyclesperanto-0.12.1.tar.gz
  • Upload date:
  • Size: 4.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for pyclesperanto-0.12.1.tar.gz
Algorithm Hash digest
SHA256 675bdd3ae64ce55aac4649eae627a034fbe6a03c6d6aac6ee5d60e4eb4819cd6
MD5 83dce7916fd3ecdbedf9cdea08b56827
BLAKE2b-256 81ceb668ae0385f3f13de6955b8d8e8fb848626d200bf70840369cc6b1ec2a6e

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1a755ec7f0c37f543e67267641294b4d24b33b50dda333ff3a385ef76e578cf5
MD5 6d0ca56efebd0b21ffa2889bc1542f55
BLAKE2b-256 ffb6f7ec9be82bbbb6a4125bb8e7d042c4a898150b62eec9a9ae4c14959bc4c0

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d06123f4ae7c364a9dfee72d3a99d21adc07bac07032e40bffed470254e3d55
MD5 bbd94afe3d4d52be21aa8a961cfc4d76
BLAKE2b-256 7201b3c7a9b154055545e2aa59ef91c98ace04e9270e66040cd61358d6ae9888

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4403d163816ca102a4c912876fb6eed2943ca92b6dbcfd09571ba3f7a8f64df
MD5 4f2850b68ecba1a2b18199e432544426
BLAKE2b-256 521d8d898c528dd32b2c5d20da7e265ab473b22d5d11b88737a0ea6718162faf

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp312-cp312-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 e4e487cd48c15068dd5b6437fd5c8c8150bcae2c6cb8b2df4e9028f5f4068a66
MD5 0ccd5ba1ccb5fe1fb3f6c5062c882d28
BLAKE2b-256 79e34be0ce6e251567447a439866b8b5807af4af024bb3e595528a2d6a5418e2

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c4cdf89a039ca20148ca38c63b8d6c26735471d76e16d99aeb844d1dfa341c8a
MD5 5ecf91ec6b71de77dda91ae771facd89
BLAKE2b-256 541e2c7fbeed3ad2fe1a4d8bf1c5cc150305afaa69b330fe0c12d928c26b46b3

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2d1a8f44729dc6d642c7c5ed8319ba84bf60e7e33386cce25e0522b03d96835d
MD5 d472472b2843392b74414f3da76f25fe
BLAKE2b-256 7766c621095e4d82a3f527cfeb002c2ef0f41fc2f9c5e2434ed0f25db40770a8

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7dabe5eb3ee68c796eb2ee8dc2bc3d2497af64fe440f4fa2735399c8ae229fbe
MD5 41d493b83bce1708d11451ef678832cb
BLAKE2b-256 50ff3e48e98feed0a280c4c0d81f0c5725f339a1b89f618817612fc6167b7538

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp311-cp311-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 aa5a7233fd0b2e3c700e16369a75349a279e7f6077f1c61c60ac9a70b1153876
MD5 ecedc9eeea0d24eea9600a7c2932fed1
BLAKE2b-256 bfd20cc9bc58d518e66afea0ff395d4d5cef91ff17ad4d40c4350af75ea5faac

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b4bbe1b5178dc78f9954d70922298e386016fa4c53069cec70b1c365988920ad
MD5 56abadaed3c3dd11e745020417cde459
BLAKE2b-256 740b4112b34e42b32ccd315736f09905e35792c9d7fa7c62c912f07244a1a417

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08f0a8b2cc25c59b282506a896a40e917302752350a494c8e06cc1cba4b7df44
MD5 68331280ba6046c3d3d6de4be4715eec
BLAKE2b-256 70f822af713003922b40c7f082a7e987361b7c7aaeafb62fdf6d70d2d508d642

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68a8caea3cd2e4dc9d3f84addfc7dafdcce5e16f6e48c2bba2d9149b55af54f7
MD5 de8d06caa5aed9df2bb01b186cf7ecd5
BLAKE2b-256 6e10969edcec29f94ad69a2f647b6d1320489cdccf8b066ef8cd70f0534fa1fa

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 0933521498bded3ae8a0c8c00a4086df499af8f8f0aeceefe8a48b6ac1671288
MD5 8522f92ade2bc2f64075c7a7b8f2795d
BLAKE2b-256 56dff42bc860bd536b2cbb84d32afe249a67f92bd82061f6f900a263e71abf3b

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 03e0a054e7554abe71a2753743d664c9a326228c891a72576d837b93fc00eddf
MD5 4eaeb847c6572d5fbdbbb36356480bb8
BLAKE2b-256 2a2b94e3dd5dc493bd7cd570cc76588f90703f8eb4799ec6ce697a2b743c9120

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5376789354f31e8f476d71878518bca51cfd2dddd8477f723e2f9e9ff1c7c313
MD5 32511284fb12b5ad16335442e3fa39ce
BLAKE2b-256 09802d51d44a2542d8bedf3318fcf1f3ce8b114e9cb0d0f0c162d1b837ea789f

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d40c61071eb999d218365eb4e760a2888f7ccabb20e09401bbb09da1faeed815
MD5 e3f48eae900e686484ff366c3a993621
BLAKE2b-256 fe32bf6c10a12bcde0881dce7732422b86063aba5f41bcde98031fcd8f7a26fb

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 907645b9096702879773f5a6698e34ba17dd46bead436e71eade62f4a24d9a0c
MD5 52ac4df1c966f518ddd77a5beb7abcb8
BLAKE2b-256 1bc907d43183e1d72bd50f942c0df667241b83e98671d9cf5e3a4158857f4043

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 32816ee85d8454af149797c64aca292bf362b4a0ee7ca821c8c5840deae2009c
MD5 18a6934c42d6fe3be23f000fdb184f5c
BLAKE2b-256 55303a9ce1da44a39594493076f45764a6d0e7f00c6c9c373249792e0605d4cd

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3e8dc9fcb461c9d0529ca1952044251286e612689d3d0e0c0af09c49a8ec9894
MD5 f64ba32d2b9813fad548ecec67351e67
BLAKE2b-256 7e5c9b27a53a23825432d6d12535da54cb562006741c3fce1d18334c768b18f0

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b01c606d5e49a7773f53f11764e33e9e9346f729d2f31d4688586d49c951371
MD5 831706438d99105e67e9283478a0a086
BLAKE2b-256 d90da373a22dde2cd1be1a595b98b15fe41973851fcda1dbbc8f07f04f8bd47d

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.12.1-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for pyclesperanto-0.12.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 321b1d003bcda3d845b4eb2a76b87089965489f215aed35527248154b8cba06e
MD5 c38313960dd283e4f32b9fa001ea1d0f
BLAKE2b-256 2098cd4d75552f260a35241b8e2440b9adc0ee0c866f29ceb61a8e6790fa125e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page