Created
November 26, 2013 15:42
-
-
Save tlecomte/7660667 to your computer and use it in GitHub Desktop.
Transfer an image from Numpy to Icy
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
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