diff --git a/demo/interoperability/non-prototype.ipynb b/demo/interoperability/non-prototype.ipynb new file mode 100644 index 00000000..8edcc0ef --- /dev/null +++ b/demo/interoperability/non-prototype.ipynb @@ -0,0 +1,246 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "aad45a96-98fa-4ae1-b130-9ffce350c054", + "metadata": {}, + "outputs": [], + "source": [ + "import pyclesperanto as cle\n", + "import pyclesperanto_prototype as clep" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "2e6e5aeb-d293-4635-a2a1-534d74e3a370", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0.13.1'" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cle.__version__" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "89cc3759-96bc-4d54-958c-e53030e73e41", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0.24.4'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "clep.__version__" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "b04f7318-c5bb-41d6-bd83-0ff483af9ed7", + "metadata": {}, + "outputs": [], + "source": [ + "cle_image = cle.create((10,10))" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "1de6c12b-6dbf-43c3-b420-94c5bd5eb4da", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\"\"" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "str(type(cle_image))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "20278663-3a4b-41b3-a470-93db9da4dfc3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "\n", + "\n", + "cle._ image
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
shape(10, 10)
dtypefloat32
size400.0 B
min0.0
max0.0
\n", + "\n", + "
" + ], + "text/plain": [ + "cl.OCLArray([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]], dtype=float32)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "clep.gaussian_blur(cle_image)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "23acfb5f-556e-45d3-9595-8485b3dfde69", + "metadata": {}, + "outputs": [], + "source": [ + "clep_image = clep.create((10,10))" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "a6280f8c-d484-45db-aac2-7ebc842bb37b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\"\"" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "str(type(clep_image))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "abbb0013-6e6e-457e-86e5-af60035316cf", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "\n", + "\n", + "cle._ image
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
shape(10, 10)
dtypefloat32
size400.0 B
min0.0
max0.0
\n", + "\n", + "
" + ], + "text/plain": [ + "array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n", + " [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]], dtype=float32, mtype=buffer)" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cle.gaussian_blur(clep_image)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d6589959-d464-4071-93f9-c5d1524657f8", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/pyclesperanto_prototype/_tier0/_types.py b/pyclesperanto_prototype/_tier0/_types.py index 2e437d32..474dd70a 100644 --- a/pyclesperanto_prototype/_tier0/_types.py +++ b/pyclesperanto_prototype/_tier0/_types.py @@ -3,7 +3,12 @@ import pyopencl as cl from typing import Union -Image = Union[np.ndarray, OCLArray, cl.Image, _OCLImage] +try: + import pyclesperanto + Image = Union[np.ndarray, OCLArray, cl.Image, _OCLImage, pyclesperanto._pyclesperanto._Array] +except ImportError: + Image = Union[np.ndarray, OCLArray, cl.Image, _OCLImage] + def is_image(object): return isinstance(object, np.ndarray) or \ @@ -14,4 +19,5 @@ def is_image(object): "", "", "", - ""] + "", + ""] diff --git a/setup.cfg b/setup.cfg index 3851eb97..b468ab52 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ python_requires = >=3.6 # add your package requirements here install_requires = - numpy!=1.19.4 + numpy!=1.19.4, <2.0.0 pyopencl toolz scikit-image>=0.18.0, !=0.20.0