-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from clEsperanto/prep-0.12.0
Prep 0.12.0
- Loading branch information
Showing
22 changed files
with
1,788 additions
and
2,459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "50b170a2-98e2-4257-b5af-9e008a264a83", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"(OpenCL) NVIDIA GeForce RTX 4090 (OpenCL 3.0 CUDA)\n", | ||
"\tVendor: NVIDIA Corporation\n", | ||
"\tDriver Version: 535.183.06\n", | ||
"\tDevice Type: GPU\n", | ||
"\tCompute Units: 128\n", | ||
"\tGlobal Memory Size: 24217 MB\n", | ||
"\tMaximum Object Size: 6054 MB\n", | ||
"\tMax Clock Frequency: 2625 MHz\n", | ||
"\tImage Support: Yes" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import napari\n", | ||
"import numpy as np\n", | ||
"import pyclesperanto as cle\n", | ||
"\n", | ||
"cle.select_device()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8df18a3d", | ||
"metadata": {}, | ||
"source": [ | ||
"Let's create a numpy array and process it with clesperanto, in this case applying a gaussian blur" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "c5791a69", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"img = np.random.randint(0, 65536, size=(1024, 1024), dtype=np.uint16)\n", | ||
"blurred = cle.gaussian_blur(img, sigma_x=2, sigma_y=2)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4517fe36", | ||
"metadata": {}, | ||
"source": [ | ||
"Both images can be seemlessly added to the napari viewer. In the background, clesperanto implement internal method which allows napari to call back the data from the GPU to the host memory. Hence for napari, a clesperanto array is treated the same as a numpy array." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "14da0d8e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n", | ||
"viewer = napari.Viewer()\n", | ||
"viewer.add_image(img)\n", | ||
"viewer.add_image(blurred)\n", | ||
"napari.run()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d9006505", | ||
"metadata": {}, | ||
"source": [ | ||
"Enjoy!" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "5fd04493", | ||
"metadata": {}, | ||
"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.9.19" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.