We're Hiring!

Adding TagAnnotations to OME.tiffs

Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats
Please note:
Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats

If you are having trouble with image files, there is information about reporting bugs in the Bio-Formats documentation. Please send us the data and let us know what version of Bio-Formats you are using. For issues with your code, please provide a link to a public repository, ideally GitHub.

Adding TagAnnotations to OME.tiffs

Postby yuriy_alexandrov » Thu Oct 23, 2014 3:15 pm

Hi All,

This is mostly Bioformats question, related to OME.tiff generation, which currently already in use by our OPT group via Matlab API.
TagAnnotations are obvious enhancement to this, so the question is how exactly to add them.

I can create TagAnnotation as

Code: Select all
tag  = ome.xml.model.TagAnnotation();

but not sure how to set value and incorporate it into the metadata.

In the case of "modulo", it was

Code: Select all
   modulo = loci.formats.CoreMetadata();
...
    OMEXMLService = loci.formats.services.OMEXMLServiceImpl();
    OMEXMLService.addModuloAlong(metadata, modulo, 0);
...

Hopefully it shouldn't be more complicated in the case of TagAnnotations? - but didn't find an example anywhere.

Best,
Y.
yuriy_alexandrov
 
Posts: 126
Joined: Thu Oct 25, 2012 2:06 pm

Re: Adding TagAnnotations to OME.tiffs

Postby mlinkert » Thu Oct 23, 2014 8:30 pm

Hi Yuriy,

The easiest way to add a TagAnnotation to an existing IMetadata object ('metadata' from the previous thread) is as follows:

Code: Select all
metadata.setTagAnnotationID("Annotation:0", 0);
metadata.setTagAnnotationValue("this is the tag", 0);


That will automatically create and attach the TagAnnotation with the given value. You will need to change the ID (currently "Annotation:0") and the annotation index if you are populating multiple annotations.

There are several other properties that can be set on a TagAnnotation; see http://www.openmicroscopy.org/Schemas/D ... Annotation and http://downloads.openmicroscopy.org/bio ... Store.html for more information.

-Melissa
User avatar
mlinkert
Team Member
 
Posts: 353
Joined: Fri May 29, 2009 2:12 pm
Location: Southwest Wisconsin

Re: Adding TagAnnotations to OME.tiffs

Postby yuriy_alexandrov » Thu Oct 23, 2014 9:32 pm

Brilliant, thanks Melissa, - will try it tomorrow ASAP.

Best regards,
Y.
yuriy_alexandrov
 
Posts: 126
Joined: Thu Oct 25, 2012 2:06 pm

Re: Adding TagAnnotations to OME.tiffs

Postby yuriy_alexandrov » Fri Oct 24, 2014 11:11 am

Hi again,

Yes it worked during OMEtiff creation, and "xmlvalid" didn't report errors after I made numbering -"Annotation:0", "Annotation:1", "Annotation:2", etc. - continuous with other annotations.

However, I found that after importing the resulting image to Omero, these tag annotations are not displayed as "tag" on the right, neither in Insight nor in Webclient.

So it looks like, there is something wrong with this Tag-generation, or maybe with Tags during import.
I suspect, most likely, I didn't set some TagAnnotation attributes needed for this tag to become discernible.
I can show quite easily the code, as it is on github, or/and to send the corresponding file if needed.

Best regards,
Y.
yuriy_alexandrov
 
Posts: 126
Joined: Thu Oct 25, 2012 2:06 pm

Re: Adding TagAnnotations to OME.tiffs

Postby sbesson » Mon Oct 27, 2014 3:07 pm

Hi Yuriy,

the issue most likely arises from the fact that the tags are added but not linked to the image. To link your annotation to the image you will need to use the setImageAnnotationRef method.
The following minimal code should create an OME-TIFF file with a tag which is imported during the import to OMERO:

Code: Select all
java.lang.System.setProperty('javax.xml.transform.TransformerFactory', 'com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl');
I =zeros(100,100, 1,2,3);
metadata = createMinimalOMEXMLMetadata(I);
metadata.setTagAnnotationID('Annotation:0', 0);
metadata.setTagAnnotationValue('test tag', 0);
metadata.setImageAnnotationRef('Annotation:0', 0, 0);
bfsave(I, filepath, 'metadata', metadata);


Sebastien
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: Adding TagAnnotations to OME.tiffs

Postby yuriy_alexandrov » Tue Oct 28, 2014 12:47 pm

Thanks Sebastien,

Yes I checked this and it works, as I reported in related (XMLAnnotation) thread.

For us, the question of search-ability of custom annotations still remains.
Are XMLAnotations searchable via Insight/Webclient "Search" option?
Even when linked properly to image, it appears that they are not.

Best,
Y.
yuriy_alexandrov
 
Posts: 126
Joined: Thu Oct 25, 2012 2:06 pm

Re: Adding TagAnnotations to OME.tiffs

Postby sbesson » Tue Oct 28, 2014 1:53 pm

Hi Yuriy,

glad to know this is working. Since this is a thread on TagAnnotation, let's keep the XML annotation discussion on the other thread.

Sebastien
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm


Return to User Discussion [Legacy]

Who is online

Users browsing this forum: No registered users and 1 guest