Page 1 of 1

AnnotationRef is not in Image tag

PostPosted: Thu Sep 20, 2018 11:51 pm
by needonature
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 ?

Re: AnnotationRef is not in Image tag

PostPosted: Mon Sep 24, 2018 7:41 am
by sbesson
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

Re: AnnotationRef is not in Image tag

PostPosted: Mon Sep 24, 2018 6:18 pm
by needonature
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 !