We're Hiring!

Deleting an Object

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please 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

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Deleting an Object

Postby icaoberg » Tue Apr 24, 2012 1:21 pm

So far I have deleted objects through scripts. Mainly, I create a delete service using the connection and then I use the client object on the callback methods to monitor object deletion. Very straightforward.

Now I want to implement a method within pyslid. The main issue I have is that I create the connection in the following fashion

Code: Select all
def connect( server, port, username, password ):
    '''
    Helper method that connects to an OMERO.searcher server.
    @param server
    @param port
    @param username
    @param password
    @returns connection
    '''

    try:
        conn = BlitzGateway( username, password, host=server, port=int(port))
        conn.connect()
        return conn
    except:
        return None


meaning I don't create a client. So I have two questions. Either I think will provide me with a solution
1) is it possible to delete an object without a client object? is the callback strictly neccesary?
2) is it possible to get the client from the connection?

thanks
ivan
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: Deleting an Object

Postby wmoore » Tue Apr 24, 2012 1:30 pm

You can get the client with

Code: Select all
conn.c


Are you using

Code: Select all
conn.deleteObjects()   
# E.g. deleteObjects("Dataset", [dsId ], deleteChildren=True, deleteAnns=True)


You can just use this method without monitoring the delete process and it should work just fine.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: Deleting an Object

Postby icaoberg » Tue Apr 24, 2012 8:23 pm

pardon my ignorance. i can see an scenario where i want to delete a project/dataset and not its children. but why would i want to delete an image and not its children?

children for an image are pixels and annotations, right? sorry for the lame question.

ivan
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: Deleting an Object

Postby wmoore » Tue Apr 24, 2012 8:44 pm

The deleteChildren flag is meaningless for Images. It will have no effect either way you set it.

deleteAnns is the same for Images as Projects, Datasets etc. It only refers to 'standalone' annotations like Tags and if False, then the Tag will not be deleted even if it becomes an "orphan" (not used).

Comments are always deleted and Tags, File-Annotations etc will not be deleted if they are used to annotate other objects.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest