Adding TagAnnotations to OME.tiffs
Posted:
Thu Oct 23, 2014 3:15 pm
by yuriy_alexandrov
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.
Re: Adding TagAnnotations to OME.tiffs
Posted:
Thu Oct 23, 2014 8:30 pm
by mlinkert
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
Re: Adding TagAnnotations to OME.tiffs
Posted:
Thu Oct 23, 2014 9:32 pm
by yuriy_alexandrov
Brilliant, thanks Melissa, - will try it tomorrow ASAP.
Best regards,
Y.
Re: Adding TagAnnotations to OME.tiffs
Posted:
Fri Oct 24, 2014 11:11 am
by yuriy_alexandrov
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.
Re: Adding TagAnnotations to OME.tiffs
Posted:
Mon Oct 27, 2014 3:07 pm
by sbesson
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
Re: Adding TagAnnotations to OME.tiffs
Posted:
Tue Oct 28, 2014 12:47 pm
by yuriy_alexandrov
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.
Re: Adding TagAnnotations to OME.tiffs
Posted:
Tue Oct 28, 2014 1:53 pm
by sbesson
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