We're Hiring!

How to stop using OMERO

General user discussion about using the OMERO platform to its fullest. Please ask new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

There are workflow guides for various OMERO functions on our help site - http://help.openmicroscopy.org

You should find answers to any basic questions about using the clients there.

How to stop using OMERO

Postby rdecoster » Tue Sep 12, 2017 8:12 am

Several groups are using OMERO in our department but over years labs move to other departments that do not use OMERO. What are the options for those individuals or entire groups to pull their data out OMERO. What is the best practise?

It might be also important that currently they are still working on a 4.4.9 version.

Thanks for looking into this.
Best,
Raf
rdecoster
 
Posts: 21
Joined: Mon Feb 01, 2016 11:55 am

Re: How to stop using OMERO

Postby wmoore » Tue Sep 12, 2017 11:06 pm

Hi Raf,

What data in OMERO are you interested in exporting?
If the images are "archived" when imported then you can export the original image files.
If not then you can export as OME-TIFF which will include a little but not all of the image metadata along with the pixel data.
What about annotations (Tags, Comments etc)?

There is no built-in functionality for large-scale exports, so the best option will be a script of some sort ( Python / Java / Bash ) depending on what you need.

Regards,

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: How to stop using OMERO

Postby rdecoster » Thu Sep 14, 2017 10:07 am

Hi Will,

I checked with the people leaving and they just want to get the original files out grouped by project/dataset.
I found a python script online which I adjusted a bit to my needs and I can drill down to all projects and datasets of a user but now I'm a bit lost in retrieving the original image. Basically where I end up is:

Code: Select all
im = conn.getObject("Image", 43840)
#you can do ome/tiff
im.exportOmeTiff(1024 * 1024)

#the original (which fails)
im.getImportedImageFiles()



the getimportedimagefiles method doesn't exist in 4.4.9, is there an alternative?

best,
Raf
rdecoster
 
Posts: 21
Joined: Mon Feb 01, 2016 11:55 am

Re: How to stop using OMERO

Postby wmoore » Fri Sep 15, 2017 11:33 am

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.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 1 guest