http://trac.openmicroscopy.org.uk/ome/wiki/OmeroScripts
E.g.
- Code: Select all
client = script.client("SCRIPTNAME", "SCRIPTDESCRIPTION",
script.TYPE("VARIABLENAME").[in()|out()|inout()], ...)
conn = BlitzGateway(client_obj=client)
The BlitzGateway connection is then used to perform work such as retrieving images.
The scripts worked fine on the pre 4.4 versions of OMERO since the Insight client had to be viewing images within one group. Switching groups in Insight refreshed all the available images and, I presume, updated the group security context when running scripts.
Within OMERO 4.4 it is now possible to view images from more than one group. So you can launch the script to run on images that are not part of the user's default/current group. The framework passes in the Image or Dataset IDs but calls to getObject/getObjects fail to return any items since the connection context is using the default group. So the following calls return nothing for other groups:
- Code: Select all
ds = conn.getObject('Dataset', ...)
objects = conn.getObjects("Image", ...)
I cannot find a method within the BlitzGateway that will retrieve any objects that the user owns. It is tied to the current security context and so only works for the current group.
A workaround would be to iterate all the user's groups using the getOtherGroups() method, set the connection to the group and search for the object:
- Code: Select all
id = long(1)
for g in conn.getOtherGroups():
conn.setGroupForSession(g.getId())
o = conn.getObject('Image', id)
if o:
break
Is there a better way to approach this? For example should the Insight client pass more information through to the scripts framework containing the group associated with the image/dataset IDs. No change will then need to be made to scripts that retrieve objects since the group context will be correct for the input IDs.
Thanks,
Alex