We're Hiring!

Lucene Index

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Lucene Index

Postby bhcho » Thu Feb 17, 2011 3:37 pm

Hi all,

1.
Does anyone have any idea to get all possible values of a specific key in Lucene Index by OMERO.script?
for example, I updated lucene index for an image with a key/value pair of "A.B.C1" and "BK".
And for another image, I added "A.B.C1" and "Bob" pair to lucene index.

So, I want to populate all possible values for "A.B.C1" to a drop-down box in my own script so that users can easily select one of them.


2.
Is it also possible to query the regular ome-xml fields from OMERO.script?
for example, is it possible to retrieve all images that has "Objective"'s "nominal magnification" as "40"?


Thanks in advance,
BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: Lucene Index

Postby jmoore » Thu Feb 17, 2011 4:24 pm

Hi BK,

there is currently no way to retrieve all values of a key from OMERO.search. I've added ticket 4413 if you would like to track its implementation. Currently it is unscheduled, but we will likely be working heavily on search for OMERO 4.4.

It is possible to query for objectives with nominal magnification of 40, but not yet to search for images with objectives of nominal magnification 40 as I mentioned under http://openmicroscopy.org/community/viewtopic.php?f=6&t=478&p=1485&hilit=nominal#p1486. That comment points to ticket 2953, but as I mentioned there, you can also set these fields from your own bridge.

Cheers,
~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Lucene Index

Postby wmoore » Thu Feb 17, 2011 4:36 pm

Hah - Josh beat me to this one. Here's what I was going to post...

I can only answer your second question just now...
Since the nominal magnification will be in the objective database table, you can search for matching images using a custom query from the query service...

Code: Select all
nominalMag = 40

params = omero.sys.Parameters()
params.map = {"nomMag": rint(nominalMag)}
query = "select i from Image i join fetch i.objectiveSettings as objS join fetch objS.objective as ob where ob.nominalMagnification=:nomMag"

# if you don't need to retrieve the objective itself, you can leave out the 'fetch' like this...
#query = "select i from Image i join i.objectiveSettings as objS join objS.objective as ob where ob.nominalMagnification=:nomMag"

images = qs.findAllByQuery(query, params);

for i in images:
    print i.getName().getValue()
    # if you have 'fetched' the objective above, you will have that data
    print i.objectiveSettings.objective.manufacturer.val
    print i.objectiveSettings.objective.lensNA.val


Hopefully someone else can help with the Lucene query. But I should warn you that setting options in one of the parameters of a script cannot be done before the script is run. Once the script has started running (and you do your Lucene query) you cannot then set the options for a parameter and present that UI to a user. There is no user interaction in the scripting service. It's fire and forget!

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: Lucene Index

Postby icaoberg » Mon Apr 23, 2012 6:18 pm

is it possible to retrieve the magnification from an image object using the existing API?

ivan
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: Lucene Index

Postby wmoore » Mon Apr 23, 2012 8:09 pm

Just editing the example above you can do

Code: Select all
params = omero.sys.Parameters()
params.map = {"iid": rlong(imageId)}
query = "select i from Image i join fetch i.objectiveSettings as objS join fetch objS.objective as ob where i.id=:iid"

image = queryService.findByQuery(query, params);
print i.objectiveSettings.objective.nominalMagnification.val
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest