Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Transfer an image from Icy to a remote Python interpreter.
from icy.main import Icy
from icy.sequence import SequenceUtil
from icy.type import DataType
from icyexecnetgateway import IcyExecnetGateway, pack_image
code = """
from numpyexecnet import unpack_image
import matplotlib.pyplot as plt
print "Hello from remote"
packed_image = channel.receive()
a = unpack_image(packed_image)
plt.figure()
plt.title("Image from Icy")
plt.imshow(a)
plt.colorbar()
plt.show()
"""
sequence = Icy.getMainInterface().getFocusedSequence()
if sequence==None:
print "No image opened"
import sys
sys.exit()
image = sequence.getImage(0, 0, 0)
packed_image = pack_image(image)
with IcyExecnetGateway(python_path = "/usr/local/bin/python") as gateway:
gateway.remote_exec(code)
gateway.send(packed_image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment