Skip to main content

GPU-accelerated image processing in python using OpenCL

Project description

py-clesperanto

Build & Deploy Tests License PyPI Python Version Development Status GitHub issues GitHub stars GitHub forks PyPI - Downloads Code style: black

pyclesperanto is the python package of clEsperanto - a multi-language framework for GPU-accelerated image processing. clEsperanto uses OpenCL kernels from CLIJ. This package relies on the CLIc back-end for processing.

Installation

Get a conda/python environment, e.b. via mini-conda. If you never used python/conda environments before, please follow the instructions here first.

mamba create --name my_env python=3.10
mamba activate my_env

Install pyclesperanto package using conda: (WIP, please use pip instead)

OR using pip:

pip install pyclesperanto

Code Example

Note: This project is under heavy development. General API, functions, and parameters are subject to change.

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_box(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)

Example 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!

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.7.1.tar.gz (3.8 MB view hashes)

Uploaded Source

Built Distributions

pyclesperanto-0.7.1-cp311-cp311-win_amd64.whl (763.6 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pyclesperanto-0.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (793.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.7.1-cp311-cp311-macosx_11_0_arm64.whl (592.9 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyclesperanto-0.7.1-cp311-cp311-macosx_10_14_x86_64.whl (620.5 kB view hashes)

Uploaded CPython 3.11 macOS 10.14+ x86-64

pyclesperanto-0.7.1-cp310-cp310-win_amd64.whl (762.5 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pyclesperanto-0.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (792.6 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.7.1-cp310-cp310-macosx_11_0_arm64.whl (591.7 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyclesperanto-0.7.1-cp310-cp310-macosx_10_14_x86_64.whl (618.9 kB view hashes)

Uploaded CPython 3.10 macOS 10.14+ x86-64

pyclesperanto-0.7.1-cp39-cp39-win_amd64.whl (762.5 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pyclesperanto-0.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (794.5 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.7.1-cp39-cp39-macosx_11_0_arm64.whl (591.9 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyclesperanto-0.7.1-cp39-cp39-macosx_10_14_x86_64.whl (619.1 kB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

pyclesperanto-0.7.1-cp38-cp38-win_amd64.whl (762.5 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pyclesperanto-0.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (792.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pyclesperanto-0.7.1-cp38-cp38-macosx_11_0_arm64.whl (591.6 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyclesperanto-0.7.1-cp38-cp38-macosx_10_14_x86_64.whl (618.9 kB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

pyclesperanto-0.7.1-cp37-cp37m-win_amd64.whl (761.3 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

pyclesperanto-0.7.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (787.8 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pyclesperanto-0.7.1-cp37-cp37m-macosx_10_14_x86_64.whl (611.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

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