Skip to content

Instantly share code, notes, and snippets.

@dpwrussell
Created September 23, 2014 09:38
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 dpwrussell/bdf1a6ffae586c43ac89 to your computer and use it in GitHub Desktop.
Save dpwrussell/bdf1a6ffae586c43ac89 to your computer and use it in GitHub Desktop.
Override a BlitzGateway wrapper
class ImageWrapper (omero.gateway.ImageWrapper):
"""
omero_model_ImageI class wrapper overwrite omero.gateway.ImageWrapper
"""
def getClientPath(self):
print 'This one being run'
qs = self._conn.getQueryService()
params = omero.sys.ParametersI()
params.addLong("iid", self.getId())
query = "select fse from FilesetEntry fse join fse.fileset as fs "\
"left outer join fs.images as image where image.id=:iid"
# this could be OMERO 4, so handle that
try:
r = qs.findAllByQuery(query, params, self._conn.SERVICE_OPTS)
paths = [fs.clientPath.val for fs in r]
path = os.path.commonprefix(paths)
except:
path = ""
return path
# Update the ref to ImageWrapper in BlitzGateway
print 'Updating the imagewrapper'
omero.gateway.ImageWrapper = ImageWrapper
omero.gateway.refreshWrappers()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment