<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Dear Omero devs,</p>
<p>I would like to access key value pairs assocaited to an image but created by other users. It seems, thanks to the code provided on the omero website, to extract all annotations from me, but I do not know how to get only annotatins assocaited to a specific
 image.</p>
<p>here the code I wrote with "image" being an imageData object.<br>
</p>
<pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:10.0pt;"><span style="color:#000080;font-weight:bold;">long </span>userId = <span style="color:#660e7a;font-weight:bold;">gateway</span>.getLoggedInUser().getId();
List<String> nsToInclude = <span style="color:#000080;font-weight:bold;">new </span>ArrayList<>();
<span style="color:#808080;font-style:italic;">//nsToInclude.add(MapAnnotationData.NS_CLIENT_CREATED);
</span>List<String> nsToExclude = <span style="color:#000080;font-weight:bold;">new </span>ArrayList<>();
ParametersI param = <span style="color:#000080;font-weight:bold;">new </span>ParametersI();
<span style="color:#808080;font-style:italic;">//param.exp(omero.rtypes.rlong(userId)); // user
</span>param.exp(omero.rtypes.<span style="font-style:italic;">rlong</span>(image.getId())); <span style="color:#808080;font-style:italic;">// image ??
</span>IMetadataPrx proxy = <span style="color:#660e7a;font-weight:bold;">gateway</span>.getMetadataService(<span style="color:#660e7a;font-weight:bold;">ctx</span>);
<span style="color:#000080;font-weight:bold;">try </span>{
    List<Annotation> annotations = proxy.loadSpecifiedAnnotations(MapAnnotation.<span style="color:#000080;font-weight:bold;">class</span>.getName(), nsToInclude, nsToExclude, param);
    IJ.<span style="font-style:italic;">log</span>(annotations.size() + <span style="color:#008000;font-weight:bold;">"  annotations found"</span>);
    <span style="color:#000080;font-weight:bold;">for </span>(Annotation annotation : annotations) {
        IJ.<span style="font-style:italic;">log</span>(<span style="color:#008000;font-weight:bold;">" "</span>+annotation.getClass()+<span style="color:#008000;font-weight:bold;">" "</span>+annotation.getId());
        MapAnnotation mapAnnotation = (MapAnnotation) annotation;
        List<NamedValue> list = mapAnnotation.getMapValue();
        <span style="color:#000080;font-weight:bold;">for </span>(NamedValue namedValue : list)
            IJ.<span style="font-style:italic;">log</span>(namedValue.<span style="color:#660e7a;font-weight:bold;">name </span>+ <span style="color:#008000;font-weight:bold;">"  " </span>+ namedValue.<span style="color:#660e7a;font-weight:bold;">value</span>);
    }
} <span style="color:#000080;font-weight:bold;">catch </span>(ServerError serverError) {
    IJ.<span style="font-style:italic;">log</span>(<span style="color:#008000;font-weight:bold;">"Pb reading annotation " </span>+ serverError.<span style="color:#660e7a;font-weight:bold;">message</span>);
    serverError.printStackTrace();
}

</pre>
<p>Thanks for any help.</p>
<p><br>
best</p>
<p><br>
Thomas</p>
<pre class="moz-signature" cols="72">-- 
/***************************************************************/
      Thomas Boudier, Senior Research Officer,
      BioImage Analyst, Dynamic Imaging Centre,
      Walter and Eliza Hall Institute (WEHI), Australia.
/**************************************************************/  
</pre>
<div>
<p style="font-size:8pt; line-height:10pt; font-family: 'Arial','Arial',serif;">_______________________________________________
<br>
<br>
The information in this email is confidential and intended solely for the addressee.<br>
You must not disclose, forward, print or use it without the permission of the sender.<br>
<br>
The Walter and Eliza Hall Institute acknowledges the Wurundjeri people of the Kulin
<br>
Nation as the traditional owners of the land where our campuses are located and <br>
the continuing connection to country and community.<br>
_______________________________________________ </p>
</div>
</body>
</html>