[ome-devel] getting metadata
Will Moore
will at lifesci.dundee.ac.uk
Tue May 10 00:00:04 BST 2011
Hi Chris,
This depends quite a bit on what OMERO version you're using and
whether you're using the "Blitz Gateway" https://trac.openmicroscopy.org.uk/ome/wiki/OmeroPy/Gateway
Without using the blitz gateway, it requires a bit more knowledge of
the OMERO model and how objects are linked.
http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/slice2html/omero/model.html
Image -> Pixels -> Channel -> Logical Channel.excitation wavelength
Image -> Objective Settings -> Objective
For historical reasons the model is sometimes more complex than you
might expect.
E.g. Image can have several sets of Pixels.
E.g. Channel -> Logical Channel.
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.
Much easier to use the Blitz gateway, which handles lazy loading,
making it easier to traverse the graph.
It also 'hides' some of the complexity of the model.
However, this module is at an early stage of development and there
will be some API changes with the 4.3 release.
All breaking changes are listed here: http://trac.openmicroscopy.org.uk/ome/wiki/Api/BlitzGateway
Having said all that, you can get what you want with this code
import omero
from omero.gateway import BlitzGateway
conn = BlitzGateway('root', 'omero', port=4064, host='localhost')
conn.connect()
imageId = 1234
i = conn.getImage(imageId) # in 4.3 this will be
getObject("Image", imageId)
for c in i.getChannels():
print c.getLogicalChannel().excitationWave #
c.getExcitationWave() isn't supported - I'll fix that for 4.3
ob = i.getObjectiveSettings().getObjective()
print ob.model
print ob.nominalMagnification
print ob.lensNA
print ob.getImmersion().value # enumeration
print ob.getCorrection().value
Docs for the 4.2 ImageWrapper are http://hudson.openmicroscopy.org.uk/view/Beta4.2/job/OMERO-Beta4.2/javadoc/epydoc/omero.gateway._ImageWrapper-class.html
The docs are much improved for the latest code (will be 4.3 release)
allowing you to follow the traversal above.
http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/epydoc/omero.gateway._ImageWrapper-class.html
Attributes of the objective can be seen http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/slice2html/omero/model/Objective.html
and are accessed 'directly' from the underlying object - instead of
the methods on the ObjectiveWrapper
http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/epydoc/omero.gateway._ObjectiveWrapper-class.html
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.
Finally, you might get something out of looking at the code that
displays all the image metadata in web.
This uses the Blitz Gateway, imageWrapper, channelWrapper etc.
Look under def load_metadata_acquisition()
https://trac.openmicroscopy.org.uk/ome/browser/ome.git/components/tools/OmeroWeb/omeroweb/webclient/views.py
#L947
although there is a bit more going on here with web forms etc.
Hope that helps,
Will.
On 9 May 2011, at 22:55, Wood, Christopher wrote:
> Hi,
>
> What is the best way to get metadata from an image using the python
> API?
>
> For example, if I have a confocal image and I want to know the laser
> excitation wavelengths and the objective.
>
> Thanks
> Chris
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
William Moore
Wellcome Trust Centre for Gene Regulation & Expression
College of Life Sciences
MSI/WTB/JBC Complex
University of Dundee
Dow Street
Dundee DD1 5EH
United Kingdom
Phone 01382 386364
http://openmicroscopy.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20110510/4194e93d/attachment.html>
More information about the ome-devel
mailing list