Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Transfer an image from Numpy to Icy
from icy.main import Icy
from icy.sequence import Sequence
from icyexecnetgateway import IcyExecnetGateway, unpack_image
code = """
from numpyexecnet import pack_image
import matplotlib.pyplot as plt
import numpy as np
print "Hello from remote"
a = np.random.rand(50,50)
packed_image = pack_image(a)
channel.send(packed_image)
plt.figure()
plt.title("Image sent to Icy")
plt.imshow(a, cmap="gray")
plt.colorbar()
plt.show()
"""
with IcyExecnetGateway(python_path = "/usr/local/bin/python") as gateway:
gateway.remote_exec(code)
packed_image = gateway.receive()
unpacked_image = unpack_image(packed_image)
sequence = Sequence(unpacked_image)
Icy.addSequence(sequence)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment