[ome-devel] Accessing OMERO.insight attachements via the API.

Bernhard Holländer bernhard.voigt at gmail.com
Tue Jul 28 14:58:49 BST 2009


Hi Jerome!

Have you tried just creating the link and saving that (python example):

link = ImageAnnotationLinkI()
link.parent = ImageI(image_id, False)
link.child = FileAnnotationI(annotation_id, False)
update_service.saveObject(link)

You would need to reload the image to get the updated annotation list.

Also it's sometimes useful to look at the Blitz0.log file in the
var/log folder of the server installation. The error messages are more
verbose there and might give a hint what's going wrong in your
example. It might not be correct to create the link via linkAnnotation
and save the link. I would guess you rather have to save the modified
image...

Hope that helps! Bernhard


On Tue, Jul 28, 2009 at 1:59 PM, Jerome Avondo<jeromeavondo at msn.com> wrote:
>
> Hi again,
>
> Thanks again for the help, I've managed to push forward with all this... But... :)
>
> I'm now trying to write some methods to copy annotations from one object to the other.
> I have no problems with ratings and tags but I'm still finding fileannotations tricky.
>
> Say I have an image, which already has a fileannotation associated with it. Now I want another Image to have the same fileannotation attached to it as well... I don't want to duplicate the file. Just want the second Image pointing to the same file.
>
> so I tried,
>
> using the loadAnnotations() from the IMetadataPrx object, to get all annotations for  my ImageID and of type ome.model.annotations.FileAnnotation. Which seems to work fine as I can get to the data that way.
>
> Then I try to set the retrieved FileAnnotation objects to my second Image object, using the Image member function, linkAnnotation(), to create a ImageAnnotationLink which I then save the new link to the database via the gateway saveObject(). But this doesn't work.
>
> When I try and save the link, I get, message = "could not insert: [ome.model.annotations.ImageAnnotationLink]; nested exception is org.hibernate.exception.ConstraintViolationException:"
>
> I also tried creating a new FileAnnotation object, and pointing it to the OriginalFile of the retrieved FileAnnotation. Still same error, when saving the link.
>
> And I also tried retrieving the FileAnnotation or OriginalFile objects by their ids via queries, thinking I might not have the full objects loaded, but same issue...
>
> Running out of ideas, any help welcome....
>
> Thanks,
>
> J.
>
> ________________________________
>> CC: ome-devel at lists.openmicroscopy.org.uk
>> From: j.burel at dundee.ac.uk
>> Subject: Re: [ome-devel] Accessing OMERO.insight attachements via the API.
>> Date: Wed, 22 Jul 2009 16:14:58 +0100
>> To: jeromeavondo at msn.com
>>
>>
>> Hi Jerome
>>
>> If you want to remove the tag, you need to delete the link.
>> We should add some methods to the API to improve the usability
>>
>> Retrieve the link using the findByQuery of the IQuery service i.e.
>> query =
>> "select link from ImageAnnotationLink as link where " +
>> "link.parent.id = :imageID and link.child.id =: tagID";
>>
>> then delete the link
>> using the deleteObject method from the IUpdate service.
>>
>> Hope it helps
>>
>> Jmarie
>
> _________________________________________________________________
> Windows Live Messenger: Happy 10-Year Anniversary—get free winks and emoticons.
> http://clk.atdmt.com/UKM/go/157562755/direct/01/
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>


More information about the ome-devel mailing list