<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Chris,<div><br></div><div> This depends quite a bit on what OMERO version you're using and whether you're using the "Blitz Gateway" <a href="https://trac.openmicroscopy.org.uk/ome/wiki/OmeroPy/Gateway">https://trac.openmicroscopy.org.uk/ome/wiki/OmeroPy/Gateway</a></div><div><br></div><div>Without using the blitz gateway, it requires a bit more knowledge of the OMERO model and how objects are linked.</div><div><a href="http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/slice2html/omero/model.html">http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/slice2html/omero/model.html</a></div><div><br></div><div>Image -> Pixels -> Channel -> Logical Channel.excitation wavelength</div><div>Image -> Objective Settings -> Objective</div><div><br></div><div>For historical reasons the model is sometimes more complex than you might expect. </div><div>E.g. Image can have several sets of Pixels. </div><div>E.g. Channel -> Logical Channel. </div><div><br></div><div>You can traverse the graph by writing queries with iQuery, but this is the method of last resort, since it is tricky and susceptible to model changes.</div><div><br></div><div>Much easier to use the Blitz gateway, which handles lazy loading, making it easier to traverse the graph.</div><div>It also 'hides' some of the complexity of the model.</div><div>However, this module is at an early stage of development and there will be some API changes with the 4.3 release.</div><div>All breaking changes are listed here: <a href="http://trac.openmicroscopy.org.uk/ome/wiki/Api/BlitzGateway">http://trac.openmicroscopy.org.uk/ome/wiki/Api/BlitzGateway</a></div><div>Having said all that, you can get what you want with this code</div><div><br></div><div><div>import omero</div><div>from omero.gateway import BlitzGateway</div><div>conn = BlitzGateway('root', 'omero', port=4064, host='localhost')</div><div>conn.connect()</div><div><br></div><div>imageId = 1234</div><div>i = conn.getImage(imageId) # in 4.3 this will be getObject("Image", imageId)</div><div>for c in i.getChannels():</div><div> print c.getLogicalChannel().excitationWave # c.getExcitationWave() isn't supported - I'll fix that for 4.3</div></div><div><br></div><div><div>ob = i.getObjectiveSettings().getObjective()</div><div>print ob.model</div><div><div>print ob.nominalMagnification</div><div><div>print ob.lensNA</div><div><div>print ob.getImmersion().value <span class="Apple-tab-span" style="white-space:pre">                </span># enumeration</div><div><div>print ob.getCorrection().value<span class="Apple-tab-span" style="white-space:pre">                </span></div><div><br></div></div><div><br></div></div></div></div></div><div>Docs for the 4.2 ImageWrapper are <a href="http://hudson.openmicroscopy.org.uk/view/Beta4.2/job/OMERO-Beta4.2/javadoc/epydoc/omero.gateway._ImageWrapper-class.html">http://hudson.openmicroscopy.org.uk/view/Beta4.2/job/OMERO-Beta4.2/javadoc/epydoc/omero.gateway._ImageWrapper-class.html</a></div><div>The docs are much improved for the latest code (will be 4.3 release) allowing you to follow the traversal above.</div><div><a href="http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/epydoc/omero.gateway._ImageWrapper-class.html">http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/epydoc/omero.gateway._ImageWrapper-class.html</a></div><div>Attributes of the objective can be seen <a href="http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/slice2html/omero/model/Objective.html">http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/slice2html/omero/model/Objective.html</a></div><div>and are accessed 'directly' from the underlying object - instead of the methods on the ObjectiveWrapper</div><div><a href="http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/epydoc/omero.gateway._ObjectiveWrapper-class.html">http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/epydoc/omero.gateway._ObjectiveWrapper-class.html</a></div><div><br></div><div>As the Blitz Gateway evolves, some things will take a little trial and error, although the documentation is improving a lot and we'll do our best not to make breaking changes - at least after 4.3 release.</div><div><br></div><div>Finally, you might get something out of looking at the code that displays all the image metadata in web.</div><div>This uses the Blitz Gateway, imageWrapper, channelWrapper etc. </div><div>Look under def load_metadata_acquisition()</div><div><a href="https://trac.openmicroscopy.org.uk/ome/browser/ome.git/components/tools/OmeroWeb/omeroweb/webclient/views.py">https://trac.openmicroscopy.org.uk/ome/browser/ome.git/components/tools/OmeroWeb/omeroweb/webclient/views.py</a>#L947</div><div>although there is a bit more going on here with web forms etc. </div><div><br></div><div> Hope that helps,</div><div><br></div><div> Will. </div><div><br></div><div><br><div><div>On 9 May 2011, at 22:55, Wood, Christopher wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1"><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; ">Hi,<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; ">What is the best way to get metadata from an image using the python API?<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; ">For example, if I have a confocal image and I want to know the laser excitation wavelengths and the objective.<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; ">Thanks<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; ">Chris<o:p></o:p></div></div>_______________________________________________<br>ome-devel mailing list<br><a href="mailto:ome-devel@lists.openmicroscopy.org.uk" style="color: blue; text-decoration: underline; ">ome-devel@lists.openmicroscopy.org.uk</a><br><a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel" style="color: blue; text-decoration: underline; ">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a><br></div></blockquote></div><br><div apple-content-edited="true"> <div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>William Moore</div><div><div>Wellcome Trust Centre for Gene Regulation & Expression</div><div>College of Life Sciences</div><div>MSI/WTB/JBC Complex</div><div>University of Dundee</div><div>Dow Street</div><div>Dundee DD1 5EH</div><div>United Kingdom</div><div><br></div><div>Phone 01382 386364</div></div><div><a href="http://openmicroscopy.org">http://openmicroscopy.org</a></div></div></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"> </div><br></div></body></html>