Hi Raf,
I'm not testing this on a 4.4. server since it would take me a while to set that up.
But hopefully (with a few tweaks) this will work for you, to list available archived files for a given image
and to download them locally.
- Code: Select all
from omero.gateway import BlitzGateway, OriginalFileWrapper
from omero.model import OriginalFileI
params = omero.sys.ParametersI()
queryService = conn.getQueryService()
imageId = 10008
params.addId(imageId)
conn.SERVICE_OPTS.setOmeroGroup(-1)
query = """select link from PixelsOriginalFileMap as link
left outer join fetch link.child as pixels
left outer join fetch link.parent
where pixels.image.id = :id"""
result = queryService.findAllByQuery(query, params)
for link in result:
filename = link.parent.name.val
fileId = link.parent.id.val
print "Downloading...", fileId, filename
origFile = OriginalFileWrapper(conn, OriginalFileI(fileId, False))
with f = open(filename, "wb")
try:
for chunk in origFile.getFileInChunks(buf=2621440):
f.write(chunk)
finally:
f.close()
Are you running these scripts locally, connecting to a remote OMERO server, or are you using the OMERO scripting service to run them on the server?
Let me know how you get on,
Regards,
Will.