We're Hiring!

AnnotationRef is not in Image tag

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.

AnnotationRef is not in Image tag

Postby needonature » Thu Sep 20, 2018 11:51 pm

Hi Team,

I am using Matlab to call java obj/functions to add MapAnnotation into ometiff file. But in the result ometiff xml, AnnotationRef is not in the Image tag but instead in StructuredAnnotations tag:
Code: Select all
  <StructuredAnnotations>
      <MapAnnotation Annotator="test_Annotator" ID="Annotation:1" Namespace="test_Namespace">
         <Description>
            test_Description
         </Description>
         <AnnotationRef ID="Annotation:1"/>
         <Value>
            <M K="test1">
               value1
            </M>
            <M K="test2">
               value2
            </M>
         </Value>
      </MapAnnotation>
   </StructuredAnnotations>

This is part of the code I am using to add the MapAnnotation:
Code: Select all
OMEXMLService = javaObject('loci.formats.services.OMEXMLServiceImpl');
metadata = OMEXMLService.createOMEXMLMetadata();
...
pairList=java.util.ArrayList;
pairList.add(ome.xml.model.MapPair('test1','value1'));
pairList.add(ome.xml.model.MapPair('test2','value2));
metadata.setMapAnnotationID('Annotation:1',0);
metadata.setMapAnnotationDescription('test_Description',0);
metadata.setMapAnnotationNamespace('test_Namespace',0)
metadata.setMapAnnotationValue(pairList,0);
metadata.setMapAnnotationAnnotator('test_Annotator',0)
metadata.setMapAnnotationAnnotationRef('Annotation:1',0,0);
...
bfsave( omeimg, test.ome.tif, 'metadata', metadata, 'Compression', 'LZW' );

Could anyone give me a solution to place AnnotationRef into Image tag but not in StructuredAnnotations tag using matlab calling java way ?
needonature
 
Posts: 2
Joined: Fri Sep 08, 2017 8:30 pm

Re: AnnotationRef is not in Image tag

Postby sbesson » Mon Sep 24, 2018 7:41 am

Hi,

Looking at your code

Code: Select all
metadata.setMapAnnotationAnnotationRef('Annotation:1',0,0);
...



is probably the source of the issue. With this call, you are annotating a map annotation with another annotation.
To annotate the image instead, could you update this line to use setImageAnnotationRef instead and see if this generates the expected OME metadata?

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

Re: AnnotationRef is not in Image tag

Postby needonature » Mon Sep 24, 2018 6:18 pm

sbesson wrote:Hi,

Looking at your code

Code: Select all
metadata.setMapAnnotationAnnotationRef('Annotation:1',0,0);
...



is probably the source of the issue. With this cal, you are annotating a map annotation with another annotation.
To annotate the image instead, could you update this line to use setImageAnnotationRef instead and see if this generates the expected OME metadata?

Best,
Sebastien


That works thank you so much !
needonature
 
Posts: 2
Joined: Fri Sep 08, 2017 8:30 pm


Return to Developer Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron