[ome-devel] attaching analysis results to OMERO images

Josh Moore josh at glencoesoftware.com
Wed Feb 23 13:09:53 GMT 2011


Hi Adam,

On Feb 23, 2011, at 1:47 PM, Adam Fraser wrote:
>> You're looking at this page
>> http://trac.openmicroscopy.org.uk/ome/wiki/OmeroTables right?
>> 
> I fixed a couple of links to source code (were broken because of our recent
>> move to git) so I hope that helps.
>> 
> 
> Yes, indeed, and thanks. Unfortunately I'm getting this now. I'll try again
> later:
> 
> Traceback (most recent call last):
>  File "build/bdist.linux-x86_64/egg/trac/web/api.py", line 436, in
> send_error data, 'text/html')
>  ........ (more crud) .......
>  File "build/bdist.linux-x86_64/egg/trac/db/postgres_backend.py",
> line 203, in __init__ port))
> OperationalError: FATAL:  connection limit exceeded for non-superusers

Sorry about that. We're having site-wide issues at the moment.
Please bare with us, everyone.

> Probably if you're doing the same analysis with the same result fields for
>> every image in a Dataset, you should create a single table and link it to
>> the Dataset or Project.
>> 
> 
> Well, I'm not doing the analysis, I'm developing tools in CellProfiler that
> will make it easy to do such things, and I was hoping for a pointer to an
> API call that would allow me to link a file to an object id (image, dataset,
> project...).

Here is an example of linking a file annotation to a Plate:

http://git.openmicroscopy.org/?p=ome.git;a=blob;f=components/tools/OmeroPy/src/omero/util/populate_roi.py;h=29d4d043159c6bd2fc1810288c952de1448a550a;hb=refs/heads/develop#l612

Specifically:
   612         plate_annotation_link = PlateAnnotationLinkI()
   613         plate_annotation_link.parent = unloaded_plate
   614         plate_annotation_link.child = self.file_annotation
   615         plate_annotation_link = \
   616                 self.update_service.saveAndReturnObject(plate_annotation_link)
   617         self.file_annotation = plate_annotation_link.child

Line 612 creates the link object, which you will need to use when you don't
have the plate object, but only the plate id. "unloaded_plate" is equivalent to:

  omero.model.PlateI(plate_id, False)

One other thing to note is capturing the returned file_annotation in
case it has been updated. An entire example might look like this:

  ofile = client.upload("/local_file_name")
  ann = omero.model.FileAnnotationI()
  ann.file = ofile
  ann.ns = omero.rtypes.RString("your namespace here")
  link = omero.model.PlateAnnotationLinkI()
  link.link(omero.model.PlateI(plate_id, False), ann)
  link = update_service.saveAndReturnObject(link)

I pointed you to populate_roi.py, however, because it is doing exactly
what you are trying to do. It takes various file formats (XML, XLS, CSV)
reads out regions of interest and other calculations, and attaches them
to a Plate, such that Insight will display a nice Table of the data.
This is shown in the screenshots on OmeroTables (if you could get to the page).


> My guess is that linking a csv file to an image is the same as adding an
> attachment in Insight? Is that right? Then the next question I'd have is can

Correct.

> I use the API upload the document so it's not just a reference to a local
> file?

Also correct. Above this is done via the "download" method on the omero.client
object.

> Thanks!
> Adam

Cheers,
~Josh



More information about the ome-devel mailing list