Page 1 of 1

Retrieve image acquired with specifics metadatas

PostPosted: Mon Jul 02, 2012 4:41 pm
by MLB
Hi,

How can I retrieve image acquired with specifics metadatas ?

For example, I would like to find all images with
in GlobalMetadata
- 9.2 < X position for position #1 < -9.1

or in SeriesMetadata
"IlluminationChannel #2 Wavelength" equal to 750.0

because I know that one time I have imported an image with this two metada.
X position for position #1 -9.144481149225193
IlluminationChannel #2 Wavelength 750.0


Thank you for your help.

Marie Laure

Re: Retrieve image acquired with specifics metadatas

PostPosted: Mon Jul 02, 2012 9:51 pm
by wmoore
Hi,

The Original Metadata is a text file attached to each Image, so you can't query it like in a database.

Unfortunately there's no easy way to do what you want, other than parse the Original Metadata text file for each image in turn.

I've adapted a similar script that parses Original Metadata, to basically do what you want: The user enters a key and value that they're looking for and the script iterates through ALL available images, parsing their metadata, looking for the key-value matches.

Script is here:
https://gist.github.com/3035653

The script returns the first of the list of matching images. The web and Insight clients should then provide a link to view that image.

You'll need to edit the script a bit to handle searching for a value between 2 parameters (your first case). Add a couple more parameters to the script etc.

The script might take a long time to run if you have a large number of images in your Database. You could maybe reduce the scope of the search by E.g. first filtering by Image name or Project / Dataset etc.

For info on how to upload and run OMERO scripts, see
http://trac.openmicroscopy.org.uk/ome/wiki/OmeroScripts
http://cvs.openmicroscopy.org.uk/snapsh ... ow-4.3.mov
http://trac.openmicroscopy.org.uk/ome/w ... rviceGuide

Re: Retrieve image acquired with specifics metadatas

PostPosted: Wed Jul 04, 2012 1:28 pm
by MLB
Thank you, that works fine.
It generates a file with name and ID.

Not really user friendly, but It works !

Thank you
Marie Laure

Re: Retrieve image acquired with specifics metadatas

PostPosted: Tue Jul 25, 2017 6:27 pm
by nstamari
Hello wmoore,

Thank you for the sample search original metadata script!

I'm quite new with OMERO and python scripting. But we're trying to implement OMERO as an imaging data server primarily for MRI and PET data, as well as microscopy data. We would like to search the original metadata for particular values, but may not know the key they are associated with (especially for previously acquired images in different scanners/vendors). For example, I know that a string value of ultrasound (as a descriptor of the study) exists somewhere in the metadata for the images we want to retrieve, but we don't know to what key the value is assigned. Any advice how to search the original metadata script to look at values with any key?

best regards,
Naomi

Re: Retrieve image acquired with specifics metadatas

PostPosted: Wed Jul 26, 2017 12:39 pm
by wmoore
Hi Naomi,

You could make some modifications to the script above to remove the restriction of using a defined key, but the proper way to do this is to use OMERO's search engine.

Unfortunately, the development of a custom search "bridge" has been deprecated
https://www-legacy.openmicroscopy.org/s ... idges.html
but we are working on a replacement.

In the mean time, you might find this script useful, depending on the number of images you need to search:
https://gist.github.com/will-moore/d492 ... 12f6fcfe3b

This script will load the Original Metadata for Images in the selected Project or Dataset and add this as a text attachment on to each Image. These will then be indexed by the OMERO search engine and allow you to search for the text. See http://help.openmicroscopy.org/search.html and https://docs.openmicroscopy.org/omero/5 ... earch.html

Anyone who has permissions to Annotate the Images will be able to run the script from the clients.
I have limited the script to processing selected Projects and Datasets instead of All images (as the script above does) simply because it takes some time to run. You can experiment with running this on one or two Datasets initially to see if it works and how long it takes, but can extend this to run on multiple selected Projects if needed.

Hope this helps,

Regards,

Will.

Re: Retrieve image acquired with specifics metadatas

PostPosted: Thu Jul 27, 2017 7:41 pm
by nstamari
Thank you very much for the help! It does what we need. I will go through it and test it out. Very much appreciated!

Sincerely,
Naomi