We're Hiring!

batch delete

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.

batch delete

Postby frias » Thu Oct 18, 2012 12:46 pm

Hi!

I played with the DropBox feature and now have 1500 images imported on accident into omero. How can I delete these images which all appear in orphaned category, but the java application crashes when trying to list and delete them. So how can I delete all orphaned images at once, lets say via command line.

Best,

Sebastian
frias
 
Posts: 10
Joined: Thu Oct 18, 2012 12:43 pm

Re: batch delete

Postby wmoore » Thu Oct 18, 2012 1:13 pm

You could try the webclient.

Orphaned images are visible in the Tree hierarchy, and are paged at 200 images at a time, so you should be able to delete 200 at a time.

If you haven't deployed web yet, you can use the development version directly via instructions: https://www.openmicroscopy.org/site/sup ... ent-server
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: batch delete

Postby frias » Thu Oct 18, 2012 2:50 pm

Hi!

I tried the web interface already without too much success. Actually I forgot a zero, so there are 15000 images to get rid of which takes almost 100 web-pages to click through. Does not sound very convenient to me.

Can't omero delete handle this somehow?

Best,

Sebastian
frias
 
Posts: 10
Joined: Thu Oct 18, 2012 12:43 pm

Re: batch delete

Postby wmoore » Fri Oct 19, 2012 9:33 am

Hi,

I don't know of a command line option to do what you want. We have a 'delete' command but no query for orphan images on the command line.

One option is to use a small python script:

Code: Select all
from omero.gateway import BlitzGateway

conn = BlitzGateway('will', 'password')
conn.connect()

#print conn.getEventContext()   # if you want to know which group etc you'll be deleting images from
qs = conn.getQueryService()

query = "select obj from Image as obj " \
        "where not exists (select obl from DatasetImageLink as obl where obl.child=obj.id) "\
        "and not exists (select ws from WellSample as ws where ws.image=obj.id)"

imageIds = []

for image in qs.findAllByQuery(query, None):
    print "Deleting :", image.getId().getValue(), image.getName().getValue()
    imageIds.append( image.getId().getValue() )

conn.deleteObjects("Image", imageIds)


Edit this with your own username and password, save this as deleteOrphans.py then:

Code: Select all
$ export PYTHONPATH=$PYTHONPATH:/path/to/omero/lib/python
$ python deleteOrphans.py
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: batch delete

Postby frias » Mon Oct 22, 2012 12:47 pm

Very cool! I had to fix up some little things, but now it works!

Just one thing: If I request thousands of images to be deleted, the server crashes with memory problems. I now only delete a couple of thousand images, then stop the script and start over. This works fantastic!

Thank you very much!

Sebastian
frias
 
Posts: 10
Joined: Thu Oct 18, 2012 12:43 pm

Re: batch delete

Postby jmoore » Fri Oct 26, 2012 10:56 am

Could you provide us the server log from the time of the memory problems? That should definitely not be happening, even for 10s of 1000s of images.

Thanks,
~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany


Return to User Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron