We're Hiring!

Thumbnail pixels and annotations/tag

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.

Thumbnail pixels and annotations/tag

Postby johnjhufnagle » Mon Feb 08, 2010 9:16 pm

Hi,

In a Java client, if I have a 'loaded' ImageI reference in my hand...(returned from SearchPrx) What do I need to do to load the tags and annotations tied to that image? Also I I wanted to get a hold of the thumbnail image what would be required in the code. I have Insight up and running in debug mode in Eclipse but was having a tough time tracking down where the ImageData object gets actually loaded and how to do that also.

Thanks for your help.
John
johnjhufnagle
 
Posts: 34
Joined: Tue Dec 15, 2009 8:50 pm

Re: Thumbnail pixels and annotations/tag

Postby jmoore » Mon Feb 08, 2010 9:31 pm

Hi John,

Almost all calls to services (*Prx instances) in Insight are made inside of OmeroGateway. Most of the annotation loading is done via IMetadata. The thumbnail is acquired via ThumbnailStore. Examples of using those interfaces can be found OmeroGateway, if you are stepping through Insight anyway..

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

Re: Thumbnail pixels and annotations/tag

Postby johnjhufnagle » Tue Feb 09, 2010 3:55 pm

Are the thumbnail files under <File Respository>/Thumbnails/xxx
fair game once I have an image id? They appear to be named by image id# ?
Or should I be going through an API to get the bits?

Thanks
John
johnjhufnagle
 
Posts: 34
Joined: Tue Dec 15, 2009 8:50 pm

Re: Thumbnail pixels and annotations/tag

Postby jmoore » Tue Feb 09, 2010 3:59 pm

Definitely use the API. Nothing under <File Repository>/ is fair game.

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

Re: Thumbnail pixels and annotations/tag

Postby johnjhufnagle » Wed Feb 17, 2010 3:15 pm

I'm wondering what the series of steps in Java should be to retrieve the bytes for a thumbnail.
Given an ImageI reference (loaded) that has been returned from the SearchPrx what should I do to get the bytes.
When I issue the getPrimaryPixels() in the code below I get:

omero.UnloadedCollectionException: Error updating collection:pixelsSeq
Collection is currently null. This can be seen
by testing "pixelsSeqLoaded". This implies
that this collection was unloaded. Please refresh this object
in order to update this collection.

ImageI i = (ImageI)batchIter.next();
Pixels px = i.getPrimaryPixels();
byte[] imgBytes = thumbnailService.getThumbnailByLongestSide.....(...)

What is needed to to have a 'loaded' pixel set?
johnjhufnagle
 
Posts: 34
Joined: Tue Dec 15, 2009 8:50 pm

Re: Thumbnail pixels and annotations/tag

Postby cxallan » Wed Feb 17, 2010 3:27 pm

How are you getting the Image/Image collection in your hand John?
cxallan
Site Admin
 
Posts: 509
Joined: Fri May 01, 2009 8:07 am

Re: Thumbnail pixels and annotations/tag

Postby johnjhufnagle » Wed Feb 17, 2010 3:34 pm

Here is the snippet. Thanks

search = serviceFactory.createSearchService();
search.setBatchSize(RESULT_BATCH_SIZE);
search.onlyType("Image");
search.setReturnUnloaded(false);
search.byFullText(qry.getSearchStr());
while (search.hasNext())
{
List<omero.model.IObject> batch = search.results();
Iterator batchIter = batch.iterator();
while(batchIter.hasNext())
{
ImageI i = (ImageI)batchIter.next();
Pixels px = i.getPrimaryPixels();
....
}
}
johnjhufnagle
 
Posts: 34
Joined: Tue Dec 15, 2009 8:50 pm

Re: Thumbnail pixels and annotations/tag

Postby cxallan » Wed Feb 17, 2010 3:55 pm

You'll need to either make a call to findByQuery iteratively (with getThumbnailByLongestSide) asking for both objects or collect all the image IDs and make one larger call followed by getThumbnailByLongestSideSet.
cxallan
Site Admin
 
Posts: 509
Joined: Fri May 01, 2009 8:07 am

Re: Thumbnail pixels and annotations/tag

Postby cxallan » Wed Feb 17, 2010 3:57 pm

cxallan
Site Admin
 
Posts: 509
Joined: Fri May 01, 2009 8:07 am

Re: Thumbnail pixels and annotations/tag

Postby johnjhufnagle » Wed Feb 17, 2010 4:15 pm

Hi Chris,

I currently use the IQuery interface to retrieve my image details at a later stage...with an image id that I cache. Not sure how I should then load the Pixel data though at this point given your instructions.

If I have an image id:

IQueryPrx qProxy = sf.getQueryService();
ImageI img = (ImageI)qProxy.find("Image", imgId);

...at this point how do I load the Pixels?
johnjhufnagle
 
Posts: 34
Joined: Tue Dec 15, 2009 8:50 pm

Next

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest