Skip to content

Instantly share code, notes, and snippets.

@tlecomte
Created November 26, 2013 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlecomte/7660667 to your computer and use it in GitHub Desktop.
Save tlecomte/7660667 to your computer and use it in GitHub Desktop.
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