We're Hiring!

search from OMERO.insight

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.

search from OMERO.insight

Postby bhcho » Thu Sep 30, 2010 6:59 pm

Hi all,

when I look at the Search menu on the left panel of OMERO.insight, it seems like there are multiple options.
If I want to search the image based on the regular ome-xml block, do I need to check the "Comments" box?
And if I check "Attachment" box, does it means the search is based on the name of attchment file?

Best,
BK
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: search from OMERO.insight

Postby jmoore » Thu Sep 30, 2010 7:17 pm

Hi BK,

what do you mean by the "regular ome-xml block"? For all of the known sections of OME-XML, the metadata does not get mapped to comments but rather to metadata on the objects themselves. What is it specifically you are trying to search for?

In the case of attachments, the file name is indexed, and if the file is of a well known type, then the contents are also parsed. This includes XML, PDF, TXT, and DOC.

You might take a look at https://trac.openmicroscopy.org.uk/omero/wiki/OmeroSearch for what gets indexed and how.

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

Re: search from OMERO.insight

Postby bhcho » Fri Oct 01, 2010 1:51 am

what I want to do is to query by, for example, "CMOS" from the regular ome-xml meta data. Or what if I want to search images that has been taken with the nominal magnification of 60?

And actually I attached an external xml file to an image, and I queried by "Bob", which is written somewhere in the xml file, but I dont get any retrieved image.

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

Re: search from OMERO.insight

Postby jmoore » Fri Oct 01, 2010 7:37 am

bhcho wrote:what I want to do is to query by, for example, "CMOS" from the regular ome-xml meta data.


Currently, much of the metadata is not attached directly to the image. I've opened http://trac.openmicroscopy.org.uk/omero/ticket/2953 as a place to discuss future changes.

Since you will be writing your own search bridge, however, it is certainly possible to start adding values there, and that code could then be refactored into the larger codebase when it's working for you.

And actually I attached an external xml file to an image, and I queried by "Bob", which is written somewhere in the xml file, but I dont get any retrieved image.


Hmmmm....we'll have to do some debugging there. Can you look in the Indexer-0.log file(s) and see if the Image that you attached it to was in fact parsed? If yes, could you attach the xml file here so I can try to reproduce what you're (not) seeing?


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

Re: search from OMERO.insight

Postby bhcho » Fri Oct 01, 2010 2:53 pm

I don't know how to figure out if the xml file is parsed or not from the Indexer log. could you tell me how?

anyway, I attached the external xml file here, which I attached to an image from OMERO.insight.

Thanks for your help,
BK
Attachments
SMP_ext_xml.cpe.tar
(20.5 KiB) Downloaded 296 times
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: search from OMERO.insight

Postby jmoore » Tue Oct 05, 2010 6:57 am

Hi BK,

Could you do me a favor and tell me the mimetype for the OriginalFile in your database? Also, could you attach your Indexer-0.log here? Testing through this I ran into two bugs that may be bothering you. With those corrected (in trunk), the following works for me:

Code: Select all
~/code/git/dist $ bin/omero -s localhost -u root user add bk bk bk demo
Previously logged in to localhost as root
Password:
Created session d93c1e8b-8fbe-47ac-875a-f7f7d6946e16 (root@localhost). Idle timeout: 10.0 min. Current group: system
Added user 23053
~/code/git/dist $ bin/omero -s bk@localhost upload /tmp/SMP_ext_xml.cpe.xml
Password:
Created session 998a7c80-c86e-4455-8406-68a28468985c (bk@localhost). Idle timeout: 10.0 min. Current group: demo
Uploaded /tmp/SMP_ext_xml.cpe.xml as 30916

~/code/git/dist $ bin/omero shell --login
Using session 7f549bba-bcd6-4486-8d40-af299ba92e7b (bk@localhost). Idle timeout: 10.0 min. Current group: demo

...

In [2]: queryPrx = client.sf.getQueryService()

In [3]: ofile = queryPrx.get("OriginalFile", 30916)

In [4]: ofile.mimetype.val
Out[4]: 'application/xml'

In [5]: searchPrx = client.sf.createSearchService()

In [6]: searchPrx.onlyType("OriginalFile")

In [7]: searchPrx.byFullText("Bob")

In [8]: searchPrx.hasNext()
Out[8]: True

In [9]: searchPrx.next().id.val
Out[9]: 30916L

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

Re: search from OMERO.insight

Postby bhcho » Sat Oct 09, 2010 9:43 am

Hi,

Sorry for a very late response.
the answers is as follows.

It seems the search query is successful from the shell. but why not from the OMERO.insight?


Code: Select all
[@omepslid OMERO.server-Beta-4.2.0]$ bin/omero -s demo@localhost upload tmp/SMP_ext_xml.cpe.xml
Password:
Created session 679aac74-cb7f-4125-a44e-7fb4d6d2a5c9 (demo@localhost). Idle timeout: 10.0 min. Current group: Researchers
Uploaded tmp/SMP_ext_xml.cpe.xml as 4463
[@omepslid OMERO.server-Beta-4.2.0]$ bin/omero shell --login
Using session 679aac74-cb7f-4125-a44e-7fb4d6d2a5c9 (demo@localhost). Idle timeout: 10.0 min. Current group: Researchers


In [1]: queryPrx = client.sf.getQueryService()

In [2]:

In [3]: ofile = queryPrx.get("OriginalFile", 4463)

In [4]: ofile.mimetype.val
Out[4]: 'application/xml'

In [5]: searchPrx = client.sf.createSearchService()

In [6]: searchPrx.onlyType("OriginalFile")

In [7]: searchPrx.byFullText("Bob")

In [8]: searchPrx.hasNext()
Out[8]: True

In [9]: searchPrx.next().id.val
Out[9]: 3820L
bhcho
 
Posts: 236
Joined: Mon Apr 05, 2010 2:15 pm

Re: search from OMERO.insight

Postby jburel » Thu Oct 14, 2010 2:37 pm

Hi,

I will have a look at what's happening in insight.
It seems to be a bug.
See http://trac.openmicroscopy.org.uk/shoola/ticket/1574
Thanks
jmarie
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: search from OMERO.insight

Postby jburel » Sat Oct 16, 2010 7:39 am

Hi BK

I had a look at the code in more details
In the current implementation, the search functionality only looks at the "Image" Type.
The idea was, in the first implementation, to only return images related to a given query.
In your query, the type is set to Original File, that why the results are different.

We will have to rethink and improve the search functionality in the client.
I will be good to start a discussion and collect requests/feedbacks

Thanks
jmarie
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: search from OMERO.insight

Postby jmoore » Sun Oct 17, 2010 7:03 pm

BK,

for the API example, if the file were linked to the Image then it's contents would be searchable:
Code: Select all
import omero
from omero.rtypes import *
c = omero.client("localhost")
s = c.createSession("root", "ome")

# Upload a file
f = c.upload("/tmp/example.txt", type="text/plain")

# Create an image
i = omero.model.ImageI()
i.name = rstring("search test")
i.acquisitionDate = rtime(0)
i = c.sf.getUpdateService().saveAndReturnObject(i)
print "Image created:", i.id.val

# Link the file to the image
fa = omero.model.FileAnnotationI()
fa.file = f
l = omero.model.ImageAnnotationLinkI()
l.link(i, fa)
l = c.sf.getUpdateService().saveAndReturnObject(l)

# Let time pass for indexing.

# Search
search = c.sf.createSearchService()
search.onlyType("Image")
search.byFullText("Bob")
i2 = search.next()
print "Image found:", i2.id.val



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

Next

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest