Page 1 of 1

Fiji (ImageJ) Import OMERO...

PostPosted: Tue Oct 07, 2014 4:45 pm
by sgriesha
Hi,

I have tried the new feature (import from omero into imageJ) it works well. However, I was wondering if there is a way to programmatically (through the scripting options or macro language) to populate the dialog box that comes up. Their are options for Server, Port, User, Password, ImageID but I can't seem to figure out how to reach these options through scripting. Any help would be appreciated.

Best,
Scott

Re: Fiji (ImageJ) Import OMERO...

PostPosted: Wed Oct 08, 2014 2:39 pm
by jburel
Hi Scott

Could you clarify your workflow?
Do you open an image using the omero.insight-ij plugin to open an image stored in OMERO into image J.
The information like password etc are passed to the corresponding B-F plugin but not exposed. (e.g no entry in recorder).
What are you trying to achieve?
Once an OMERO session is created you can join it and save data back to OMERO if this is the case.
we are currently working on such workflow

Regards
Jmarie

Re: Fiji (ImageJ) Import OMERO...

PostPosted: Wed Oct 08, 2014 3:49 pm
by sgriesha
Hi,

Sorry I wasn't more clear. The workflow I was envisioning was to have a Fiji script (using jython in Fiji) download an image from an OMERO server using its image ID, do some automated measurements close the image and open the next looping across an image ID range. Basically measure something in image IDs 5-50. I was hoping I could somehow tell the OMERO... image import function what image ID to import using a script. If their are better ways to do this that would be great as well.

Scott

Re: Fiji (ImageJ) Import OMERO...

PostPosted: Thu Oct 09, 2014 2:46 pm
by jburel
Hi Scott
I wrote a little example reading a plane of a given image stored in OMERO and ran it into Fiji Jython interpreter.
You will need to add the "omero_client.jar" to be able to connect to OMERO
In this example I do not keep the session alive. OMERO session will expire after 10mins (default set server side).

Code: Select all
from omero import client
from omero.api import ServiceFactoryPrx
from omero.api import IContainerPrx
from omero.api import RawPixelsStorePrx
from omero.model import Image
from java.util import ArrayList
from java.lang import Long
from java.lang import Boolean

# retrieve a the plane of a given image
#create a connection using the default port
c = client(host)
entry = c.createSession(username, password)
# for unsecure session (faster) do
# unsecureClient = secureClient.createClient(false)
# entryUnencrypted = unsecureClient.getSession()

# retrieve the image
svc = entry.getContainerService()
ids = ArrayList()
ids.add(id)
images = svc.getImages("Image", ids, None)
image = images.get(0)
pixelsID = image.getPrimaryPixels().getId().getValue()
# read a plane
store = entry.createRawPixelsStore()
store.setPixelsId(pixelsID, Boolean.FALSE)
plane = store.getPlane(z, w, t) #return an array of byte
print plane
c.closeSession()



Cheers

Jmarie