Giter Site home page Giter Site logo

m-albert / pyclesperanto Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clesperanto/pyclesperanto

0.0 0.0 0.0 14.94 MB

GPU-accelerated Image Processing library using OpenCL

Home Page: https://clesperanto.github.io/

License: Other

Shell 0.26% C++ 6.45% Python 48.10% CMake 0.31% Jupyter Notebook 44.88%

pyclesperanto's Introduction

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 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 pyclesperanto

MacOS users may need to install the following package:

mamba install ocl_icd_wrapper_apple

Linux users may need to install the following package:

mamba install ocl-icd-system

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

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)

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.

pyclesperanto's People

Contributors

strigaud avatar haesleinhuepf avatar dependabot[bot] avatar jo-mueller avatar grahamross123 avatar pr4deepr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.