Skip to main content

GPU-accelerated image processing in python using OpenCL or CUDA

Project description

pyclesperanto

Image.sc Forum Conda Version PyPI License Development Status Build codecov DOI

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 python package uses PyBind11 to wrap the C++ CLIc library as a processing backend.

Installation, Documentation, and Uses

See the documentation for full installation instructions, guides, and examples on how to use the pyclesperanto. If you encountering any difficulties or interrogation we encourage you to raise your question in the image.sc forum under the tag clesperanto.

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?raw=true")

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

More usage and example can be found as notebooks in the tutorial section of the documentation as well as in the docs/demos folder of the repository.

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. Contributions, of any kind, are very welcome. Feel free to reach out to us. And 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 and by the Institut Pasteur, Paris. 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, and by support from the French National Research Agency via the France BioImaging research infrastructure (ANR-24-INBS-0005 FBI BIOGEN).

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.21.1.tar.gz (68.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyclesperanto-0.21.1-py3-none-any.whl (74.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyclesperanto-0.21.1.tar.gz
  • Upload date:
  • Size: 68.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyclesperanto-0.21.1.tar.gz
Algorithm Hash digest
SHA256 dfc1a255c491102acc33afbaac5f3901a08650c09a05e2cfa891bcf2ce53d3c6
MD5 8d5d77c8c31f8eafe6143fc11909ee15
BLAKE2b-256 e9844a8fe0c2c5e4085ba4798fd8e1478ae5856c13933d3f3cd42d8d869b48b5

See more details on using hashes here.

File details

Details for the file pyclesperanto-0.21.1-py3-none-any.whl.

File metadata

  • Download URL: pyclesperanto-0.21.1-py3-none-any.whl
  • Upload date:
  • Size: 74.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyclesperanto-0.21.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96eceab1b235cadeccb686e7d483c904fb6491dc6e01456a45f5794d58477547
MD5 11a5ed9c4f8bbbdfb7534d697af79556
BLAKE2b-256 4d9eb988abd1548540653ab4d065a31602f7fed6eecdf8db91dffb0adcd1275d

See more details on using hashes here.

Supported by

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