We're Hiring!

Save H5 table on OMERO server (without attaching to anything

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.

Re: Save H5 table on OMERO server (without attaching to anyt

Postby bhcho » Mon Dec 05, 2011 3:22 pm

Hm...this is a critical problem.

What we are planning is...A user (1) will create/save a h5 OMERO table for image content repository with a name of xxx_0000001.h5. Then that user (1) also save the most recent repository file name somewhere (such as tag, annotation)

After that, another user (2) will retrieve the file name of the most recent repository. then it will retrieve the file by querying the file name. Moreover, this user (2) will add another rows to the existing file and save it as xxx_0000002.h5. Of course the tag or annotation that contains the most recent file name should be updated.

And this keeps going.

Could you give me some advice to implement this? I mean, is there any detour method to do this?

Best,
BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: Save H5 table on OMERO server (without attaching to anyt

Postby jmoore » Wed Dec 07, 2011 3:11 pm

bhcho wrote:Could you give me some advice to implement this? I mean, is there any detour method to do this?


At the moment, my best suggestion would be to have a single group which everyone is a member of. That may take some work on your part. For example, your bridge could notice any newly created users and add them to the group.

Longer-term, we are certainly thinking about public-read and public-write permissions, but it will be some time until they get implemented. Feel free to get involved in those tickets, though.

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

Re: Save H5 table on OMERO server (without attaching to anyt

Postby bhcho » Wed Dec 07, 2011 4:18 pm

my best suggestion would be to have a single group which everyone is a member of. That may take some work on your part. For example, your bridge could notice any newly created users and add them to the group.


1. if there are two accounts which are members of the same group, then does this mean that they can read/write the same annotation/tag?

2. why my bridge needs to recognize any newly created users and add them to the group?

BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: Save H5 table on OMERO server (without attaching to anyt

Postby jmoore » Wed Dec 07, 2011 5:44 pm

bhcho wrote:1. if there are two accounts which are members of the same group, then does this mean that they can read/write the same annotation/tag?


As long as the group is collaborative (rwrw).

2. why my bridge needs to recognize any newly created users and add them to the group?


Just a suggestion for one way of keeping all new users in the same group. You may (or may not) need some mechanism to do so.

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

Re: Save H5 table on OMERO server (without attaching to anyt

Postby bhcho » Wed Dec 07, 2011 5:54 pm

As long as the group is collaborative (rwrw).

Sounds great. Then could you tell me how to create/modify an annotation(or tag, or whatever a user can save a string), WITHOUT attaching to anything?

Always thanks.
BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: Save H5 table on OMERO server (without attaching to anyt

Postby jmoore » Wed Dec 07, 2011 7:23 pm

Code: Select all
tag = session.getUpdateService().saveAndReturnObject(omero.model.TagAnnotationI())

would suffice, but you'll want to set the values on the tag first.

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

Re: Save H5 table on OMERO server (without attaching to anyt

Postby bhcho » Wed Dec 07, 2011 8:58 pm

Thanks Josh,

I was able to set/get the text using the 'tag' by
Code: Select all
In [16]: tag.setTextValue('hahaha')
In [17]: tag.getTextValue()
Out[17]: 'hahaha'
In [18]: tag.setNs('Recent_File')
In [19]: tag.getNs()
Out[19]: 'Recent_File'


But could you tell me how can I access to this 'tag' using other accounts? Using Ns?

This is just creating a tag, right?
Code: Select all
tag = session.getUpdateService().saveAndReturnObject(omero.model.TagAnnotationI())


BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: Save H5 table on OMERO server (without attaching to anyt

Postby jmoore » Thu Dec 08, 2011 7:42 am

There are a couple of ways you could do it:

  • By some unique NS: iQuery.findByQuery("select ta from TagAnnotation where ta.ns = '348952983475298347520983745'", None), but you will need to share this value between all users.
  • Assume that the newest (oldest?) annotation in the special group is the one you're looking for: iQuery.findByQuery("select ta from TagAnnotation ta order by ta.id desc", omero.sys.ParametersI().page(0, 1))
  • Attach the annotation to the group itself: iQuery.findAllByQuery("select ann from ExperimenterGroupAnnotationLink link join link.annotation an where link.parent.id = 5 and an.ns = 'Recent_File'", None). In this case, there could possibly be more than one which you would have to handle somehow.

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

Re: Save H5 table on OMERO server (without attaching to anyt

Postby bhcho » Thu Dec 08, 2011 8:37 pm

Hi Josh,

It seems like I can directly search the newest OMERO.table among the ones with the same file name, right?
if so, that would be the easiest way (without using tag annotations).

BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: Save H5 table on OMERO server (without attaching to anyt

Postby bhcho » Fri Dec 09, 2011 3:48 pm

Another followup question. (Hopefully final one on this thread ;) )

I'd like to make a function that retrieves a table A, create a new table B with copying data from the table A, then save it with a different name. (Of course, the new table file name will be updated in the tagAnnotation, which is shared by everyone in the same group)

The reason why I'm doing this is to let every account update the table (actually creating a new one) by adding each one's new data (I think this is the only way to have a pseudo-"world-writable" OMERO.tables)

So, I want to know how to copy the table and create a new one?

I can retrieve a table by
Code: Select all
table = conn.getSharedResources().openTable( omero.model.OriginalFileI( fid, False ) ) # fid is the file id of the table

Then If I'm not the owner of the table, I don't think I can directly update the table by
Code: Select all
        num_data = table.getNumberOfRows()
        columns = []
        columns.append(omero.grid.LongColumn( 'INDEX', 'Data Index', [] ))
        columns.append(omero.grid.LongColumn( 'iid', 'Image ID', [] ))
        columns.append(omero.grid.LongColumn( 'pixels', 'Pixel Index', [] ))
        columns.append(omero.grid.LongColumn( 'channel', 'Channel Index', [] ))
        columns.append(omero.grid.LongColumn( 'zslice', 'zSlice Index', [] ))
        columns.append(omero.grid.LongColumn( 'timepoint', 'Time Point Index', [] ))

        IND = num_data + 1
        columns[0].values.append( long(IND) )   #INDEX
        columns[1].values.append( long(iid) )   
        columns[2].values.append( long(pixels) )
        columns[3].values.append( long(channel) )
        columns[4].values.append( long(zslice) ) 
        columns[5].values.append( long(timepoint) )
        table.addData(columns)
        table.close()


I guess before I update the table, I think I should copy this table to a newly created table first.
Could you please help me here?

Best,
BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

PreviousNext

Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 0 guests