Created
November 23, 2020 19:58
-
-
Save oeway/3d79e646751a523165c9a4363273f703 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from imjoy import api | |
import pyclesperanto_prototype as cle | |
from skimage.io import imread, imsave, imshow | |
import matplotlib | |
import numpy as np | |
class ImJoyPlugin(): | |
async def setup(self): | |
await api.showMessage("initialized, using GPU: " + cle.get_device().name) | |
async def run(self, ctx): | |
# load data | |
image = imread('https://samples.fiji.sc/blobs.png') | |
await api.showMessage("Loaded image size: " + str(image.shape)) | |
# push image to GPU memory | |
input_img = cle.push(image) | |
await api.showMessage("Image size in GPU: " + str(input_img.shape)) | |
viewer = await api.createWindow(src="https://kaibu.org/#/app") | |
await viewer.view_image(cle.pull(input_img)) | |
api.export(ImJoyPlugin()) |
This file contains hidden or 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
<docs lang="markdown"> | |
[TODO: write documentation for this plugin.] | |
</docs> | |
<config lang="json"> | |
{ | |
"name": "Pyclesperanto-demo", | |
"type": "native-python", | |
"version": "0.1.0", | |
"description": "[TODO: describe this plugin with one sentence.]", | |
"tags": [], | |
"ui": "", | |
"cover": "", | |
"inputs": null, | |
"outputs": null, | |
"flags": [], | |
"icon": "extension", | |
"api_version": "0.1.8", | |
"env": "", | |
"permissions": [], | |
"requirements": ["pip: numpy matplotlib scikit-image imageio pyclesperanto_prototype"], | |
"dependencies": [] | |
} | |
</config> | |
<script lang="python"> | |
from imjoy import api | |
import pyclesperanto_prototype as cle | |
from skimage.io import imread, imsave, imshow | |
import matplotlib | |
import numpy as np | |
class ImJoyPlugin(): | |
def setup(self): | |
api.alert("Used GPU: " + cle.get_device().name) | |
api.log('initialized') | |
def run(self, ctx): | |
api.alert('hello world.') | |
api.export(ImJoyPlugin()) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment